diff mbox series

[2/2,V2] xfs_db: consolidate set_iocur_type() behavior

Message ID bf4a939b-d02b-a916-62e0-e24b967eff38@redhat.com
State New
Headers show
Series None | expand

Commit Message

Eric Sandeen Aug. 24, 2020, 4:51 p.m. UTC
Right now there are 3 cases to type_f(): inode type, type with fields,
and a default. The first two were added to address issues with handling
V5 metadata.

The first two already use some version of set_cur(), which handles all
of the validation etc. There's no reason to leave the open-coded bits
at the end, just send every non-inode type through set_cur() and be
done with it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

V2: Drop unused *bp var declaration
    un-indent/un-else the non-inode code

Comments

Darrick J. Wong Aug. 24, 2020, 5:03 p.m. UTC | #1
On Mon, Aug 24, 2020 at 11:51:56AM -0500, Eric Sandeen wrote:
> Right now there are 3 cases to type_f(): inode type, type with fields,
> and a default. The first two were added to address issues with handling
> V5 metadata.
> 
> The first two already use some version of set_cur(), which handles all
> of the validation etc. There's no reason to leave the open-coded bits
> at the end, just send every non-inode type through set_cur() and be
> done with it.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> V2: Drop unused *bp var declaration
>     un-indent/un-else the non-inode code
> 
> diff --git a/db/io.c b/db/io.c
> index 884da599..b8cb767e 100644
> --- a/db/io.c
> +++ b/db/io.c
> @@ -586,7 +586,7 @@ void
>  set_iocur_type(
>  	const typ_t	*type)
>  {
> -	struct xfs_buf	*bp = iocur_top->bp;
> +	int 		bb_count = 1;	/* type's size in basic blocks */

Space after 'int' and before tabs.

With that fixed,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

>  
>  	/*
>  	 * Inodes are special; verifier checks all inodes in the chunk, the
> @@ -607,29 +607,10 @@ set_iocur_type(
>  	}
>  
>  	/* adjust buffer size for types with fields & hence fsize() */
> -	if (type->fields) {
> -		int bb_count;	/* type's size in basic blocks */
> -
> +	if (type->fields)
>  		bb_count = BTOBB(byteize(fsize(type->fields,
> -					       iocur_top->data, 0, 0)));
> -		set_cur(type, iocur_top->bb, bb_count, DB_RING_IGN, NULL);
> -	}
> -	iocur_top->typ = type;
> -
> -	/* verify the buffer if the type has one. */
> -	if (!bp)
> -		return;
> -	if (!type->bops) {
> -		bp->b_ops = NULL;
> -		bp->b_flags |= LIBXFS_B_UNCHECKED;
> -		return;
> -	}
> -	if (!(bp->b_flags & LIBXFS_B_UPTODATE))
> -		return;
> -	bp->b_error = 0;
> -	bp->b_ops = type->bops;
> -	bp->b_ops->verify_read(bp);
> -	bp->b_flags &= ~LIBXFS_B_UNCHECKED;
> +				       iocur_top->data, 0, 0)));
> +	set_cur(type, iocur_top->bb, bb_count, DB_RING_IGN, NULL);
>  }
>  
>  static void
> 
>
diff mbox series

Patch

diff --git a/db/io.c b/db/io.c
index 884da599..b8cb767e 100644
--- a/db/io.c
+++ b/db/io.c
@@ -586,7 +586,7 @@  void
 set_iocur_type(
 	const typ_t	*type)
 {
-	struct xfs_buf	*bp = iocur_top->bp;
+	int 		bb_count = 1;	/* type's size in basic blocks */
 
 	/*
 	 * Inodes are special; verifier checks all inodes in the chunk, the
@@ -607,29 +607,10 @@  set_iocur_type(
 	}
 
 	/* adjust buffer size for types with fields & hence fsize() */
-	if (type->fields) {
-		int bb_count;	/* type's size in basic blocks */
-
+	if (type->fields)
 		bb_count = BTOBB(byteize(fsize(type->fields,
-					       iocur_top->data, 0, 0)));
-		set_cur(type, iocur_top->bb, bb_count, DB_RING_IGN, NULL);
-	}
-	iocur_top->typ = type;
-
-	/* verify the buffer if the type has one. */
-	if (!bp)
-		return;
-	if (!type->bops) {
-		bp->b_ops = NULL;
-		bp->b_flags |= LIBXFS_B_UNCHECKED;
-		return;
-	}
-	if (!(bp->b_flags & LIBXFS_B_UPTODATE))
-		return;
-	bp->b_error = 0;
-	bp->b_ops = type->bops;
-	bp->b_ops->verify_read(bp);
-	bp->b_flags &= ~LIBXFS_B_UNCHECKED;
+				       iocur_top->data, 0, 0)));
+	set_cur(type, iocur_top->bb, bb_count, DB_RING_IGN, NULL);
 }
 
 static void