[4/7] xfs: rename btree cursur private btree member flags
diff mbox series

Message ID 20200305014537.11236-5-david@fromorbit.com
State New
Headers show
Series
  • xfs: make btree cursor private unions anonymous
Related show

Commit Message

Dave Chinner March 5, 2020, 1:45 a.m. UTC
From: Dave Chinner <dchinner@redhat.com>

BPRV is not longer appropriate because bc_private is going away.
Script:

$ sed -i 's/BTCUR_BPRV/BC_BT/g' fs/xfs/*[ch] fs/xfs/*/*[ch]

With manual cleanup to the definitions in fs/xfs/libxfs/xfs_btree.h

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 fs/xfs/libxfs/xfs_bmap.c       | 8 ++++----
 fs/xfs/libxfs/xfs_bmap_btree.c | 4 ++--
 fs/xfs/libxfs/xfs_btree.c      | 2 +-
 fs/xfs/libxfs/xfs_btree.h      | 4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

Comments

Darrick J. Wong March 5, 2020, 2:08 a.m. UTC | #1
On Thu, Mar 05, 2020 at 12:45:34PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> BPRV is not longer appropriate because bc_private is going away.
> Script:
> 
> $ sed -i 's/BTCUR_BPRV/BC_BT/g' fs/xfs/*[ch] fs/xfs/*/*[ch]

I kinda hate the name though... BTCUR_BMBT?

(Also 'cursor' is misspelled in the subject line)

--D

> With manual cleanup to the definitions in fs/xfs/libxfs/xfs_btree.h
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
>  fs/xfs/libxfs/xfs_bmap.c       | 8 ++++----
>  fs/xfs/libxfs/xfs_bmap_btree.c | 4 ++--
>  fs/xfs/libxfs/xfs_btree.c      | 2 +-
>  fs/xfs/libxfs/xfs_btree.h      | 4 ++--
>  4 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index 81a8e70c6957..c5d0cbff3780 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
> @@ -690,7 +690,7 @@ xfs_bmap_extents_to_btree(
>  	 * Need a cursor.  Can't allocate until bb_level is filled in.
>  	 */
>  	cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork);
> -	cur->bc_bt.flags = wasdel ? XFS_BTCUR_BPRV_WASDEL : 0;
> +	cur->bc_bt.flags = wasdel ? XFS_BC_BT_WASDEL : 0;
>  	/*
>  	 * Convert to a btree with two levels, one record in root.
>  	 */
> @@ -1528,7 +1528,7 @@ xfs_bmap_add_extent_delay_real(
>  
>  	ASSERT(!isnullstartblock(new->br_startblock));
>  	ASSERT(!bma->cur ||
> -	       (bma->cur->bc_bt.flags & XFS_BTCUR_BPRV_WASDEL));
> +	       (bma->cur->bc_bt.flags & XFS_BC_BT_WASDEL));
>  
>  	XFS_STATS_INC(mp, xs_add_exlist);
>  
> @@ -2752,7 +2752,7 @@ xfs_bmap_add_extent_hole_real(
>  	struct xfs_bmbt_irec	old;
>  
>  	ASSERT(!isnullstartblock(new->br_startblock));
> -	ASSERT(!cur || !(cur->bc_bt.flags & XFS_BTCUR_BPRV_WASDEL));
> +	ASSERT(!cur || !(cur->bc_bt.flags & XFS_BC_BT_WASDEL));
>  
>  	XFS_STATS_INC(mp, xs_add_exlist);
>  
> @@ -4188,7 +4188,7 @@ xfs_bmapi_allocate(
>  
>  	if (bma->cur)
>  		bma->cur->bc_bt.flags =
> -			bma->wasdel ? XFS_BTCUR_BPRV_WASDEL : 0;
> +			bma->wasdel ? XFS_BC_BT_WASDEL : 0;
>  
>  	bma->got.br_startoff = bma->offset;
>  	bma->got.br_startblock = bma->blkno;
> diff --git a/fs/xfs/libxfs/xfs_bmap_btree.c b/fs/xfs/libxfs/xfs_bmap_btree.c
> index 909cc02256f5..bcf0e19f57d6 100644
> --- a/fs/xfs/libxfs/xfs_bmap_btree.c
> +++ b/fs/xfs/libxfs/xfs_bmap_btree.c
> @@ -230,7 +230,7 @@ xfs_bmbt_alloc_block(
>  	}
>  
>  	args.minlen = args.maxlen = args.prod = 1;
> -	args.wasdel = cur->bc_bt.flags & XFS_BTCUR_BPRV_WASDEL;
> +	args.wasdel = cur->bc_bt.flags & XFS_BC_BT_WASDEL;
>  	if (!args.wasdel && args.tp->t_blk_res == 0) {
>  		error = -ENOSPC;
>  		goto error0;
> @@ -644,7 +644,7 @@ xfs_bmbt_change_owner(
>  	cur = xfs_bmbt_init_cursor(ip->i_mount, tp, ip, whichfork);
>  	if (!cur)
>  		return -ENOMEM;
> -	cur->bc_bt.flags |= XFS_BTCUR_BPRV_INVALID_OWNER;
> +	cur->bc_bt.flags |= XFS_BC_BT_INVALID_OWNER;
>  
>  	error = xfs_btree_change_owner(cur, new_owner, buffer_list);
>  	xfs_btree_del_cursor(cur, error);
> diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
> index 142497032df4..d54b4a3273a4 100644
> --- a/fs/xfs/libxfs/xfs_btree.c
> +++ b/fs/xfs/libxfs/xfs_btree.c
> @@ -1743,7 +1743,7 @@ xfs_btree_lookup_get_block(
>  
>  	/* Check the inode owner since the verifiers don't. */
>  	if (xfs_sb_version_hascrc(&cur->bc_mp->m_sb) &&
> -	    !(cur->bc_bt.flags & XFS_BTCUR_BPRV_INVALID_OWNER) &&
> +	    !(cur->bc_bt.flags & XFS_BC_BT_INVALID_OWNER) &&
>  	    (cur->bc_flags & XFS_BTREE_LONG_PTRS) &&
>  	    be64_to_cpu((*blkp)->bb_u.l.bb_owner) !=
>  			cur->bc_bt.ip->i_ino)
> diff --git a/fs/xfs/libxfs/xfs_btree.h b/fs/xfs/libxfs/xfs_btree.h
> index bd5a2bfca64e..93063479264c 100644
> --- a/fs/xfs/libxfs/xfs_btree.h
> +++ b/fs/xfs/libxfs/xfs_btree.h
> @@ -220,8 +220,8 @@ typedef struct xfs_btree_cur
>  			short		forksize;	/* fork's inode space */
>  			char		whichfork;	/* data or attr fork */
>  			char		flags;		/* flags */
> -#define	XFS_BTCUR_BPRV_WASDEL		(1<<0)		/* was delayed */
> -#define	XFS_BTCUR_BPRV_INVALID_OWNER	(1<<1)		/* for ext swap */
> +#define	XFS_BC_BT_WASDEL	(1 << 0)		/* was delayed */
> +#define	XFS_BC_BT_INVALID_OWNER	(1 << 1)		/* for ext swap */
>  		} b;
>  	}		bc_private;	/* per-btree type data */
>  #define bc_ag	bc_private.a
> -- 
> 2.24.0.rc0
>
Dave Chinner March 5, 2020, 2:29 a.m. UTC | #2
On Wed, Mar 04, 2020 at 06:08:04PM -0800, Darrick J. Wong wrote:
> On Thu, Mar 05, 2020 at 12:45:34PM +1100, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > BPRV is not longer appropriate because bc_private is going away.
> > Script:
> > 
> > $ sed -i 's/BTCUR_BPRV/BC_BT/g' fs/xfs/*[ch] fs/xfs/*/*[ch]
> 
> I kinda hate the name though... BTCUR_BMBT?

Sure, that's simple enough to change. It's just a

s/BC_BT/BTCUR_BMBT/g

on the patch before I pop/push all the patches for a repost.

> (Also 'cursor' is misspelled in the subject line)

Fixed.

-Dave.

Patch
diff mbox series

diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 81a8e70c6957..c5d0cbff3780 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -690,7 +690,7 @@  xfs_bmap_extents_to_btree(
 	 * Need a cursor.  Can't allocate until bb_level is filled in.
 	 */
 	cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork);
-	cur->bc_bt.flags = wasdel ? XFS_BTCUR_BPRV_WASDEL : 0;
+	cur->bc_bt.flags = wasdel ? XFS_BC_BT_WASDEL : 0;
 	/*
 	 * Convert to a btree with two levels, one record in root.
 	 */
@@ -1528,7 +1528,7 @@  xfs_bmap_add_extent_delay_real(
 
 	ASSERT(!isnullstartblock(new->br_startblock));
 	ASSERT(!bma->cur ||
-	       (bma->cur->bc_bt.flags & XFS_BTCUR_BPRV_WASDEL));
+	       (bma->cur->bc_bt.flags & XFS_BC_BT_WASDEL));
 
 	XFS_STATS_INC(mp, xs_add_exlist);
 
@@ -2752,7 +2752,7 @@  xfs_bmap_add_extent_hole_real(
 	struct xfs_bmbt_irec	old;
 
 	ASSERT(!isnullstartblock(new->br_startblock));
-	ASSERT(!cur || !(cur->bc_bt.flags & XFS_BTCUR_BPRV_WASDEL));
+	ASSERT(!cur || !(cur->bc_bt.flags & XFS_BC_BT_WASDEL));
 
 	XFS_STATS_INC(mp, xs_add_exlist);
 
@@ -4188,7 +4188,7 @@  xfs_bmapi_allocate(
 
 	if (bma->cur)
 		bma->cur->bc_bt.flags =
-			bma->wasdel ? XFS_BTCUR_BPRV_WASDEL : 0;
+			bma->wasdel ? XFS_BC_BT_WASDEL : 0;
 
 	bma->got.br_startoff = bma->offset;
 	bma->got.br_startblock = bma->blkno;
diff --git a/fs/xfs/libxfs/xfs_bmap_btree.c b/fs/xfs/libxfs/xfs_bmap_btree.c
index 909cc02256f5..bcf0e19f57d6 100644
--- a/fs/xfs/libxfs/xfs_bmap_btree.c
+++ b/fs/xfs/libxfs/xfs_bmap_btree.c
@@ -230,7 +230,7 @@  xfs_bmbt_alloc_block(
 	}
 
 	args.minlen = args.maxlen = args.prod = 1;
-	args.wasdel = cur->bc_bt.flags & XFS_BTCUR_BPRV_WASDEL;
+	args.wasdel = cur->bc_bt.flags & XFS_BC_BT_WASDEL;
 	if (!args.wasdel && args.tp->t_blk_res == 0) {
 		error = -ENOSPC;
 		goto error0;
@@ -644,7 +644,7 @@  xfs_bmbt_change_owner(
 	cur = xfs_bmbt_init_cursor(ip->i_mount, tp, ip, whichfork);
 	if (!cur)
 		return -ENOMEM;
-	cur->bc_bt.flags |= XFS_BTCUR_BPRV_INVALID_OWNER;
+	cur->bc_bt.flags |= XFS_BC_BT_INVALID_OWNER;
 
 	error = xfs_btree_change_owner(cur, new_owner, buffer_list);
 	xfs_btree_del_cursor(cur, error);
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
index 142497032df4..d54b4a3273a4 100644
--- a/fs/xfs/libxfs/xfs_btree.c
+++ b/fs/xfs/libxfs/xfs_btree.c
@@ -1743,7 +1743,7 @@  xfs_btree_lookup_get_block(
 
 	/* Check the inode owner since the verifiers don't. */
 	if (xfs_sb_version_hascrc(&cur->bc_mp->m_sb) &&
-	    !(cur->bc_bt.flags & XFS_BTCUR_BPRV_INVALID_OWNER) &&
+	    !(cur->bc_bt.flags & XFS_BC_BT_INVALID_OWNER) &&
 	    (cur->bc_flags & XFS_BTREE_LONG_PTRS) &&
 	    be64_to_cpu((*blkp)->bb_u.l.bb_owner) !=
 			cur->bc_bt.ip->i_ino)
diff --git a/fs/xfs/libxfs/xfs_btree.h b/fs/xfs/libxfs/xfs_btree.h
index bd5a2bfca64e..93063479264c 100644
--- a/fs/xfs/libxfs/xfs_btree.h
+++ b/fs/xfs/libxfs/xfs_btree.h
@@ -220,8 +220,8 @@  typedef struct xfs_btree_cur
 			short		forksize;	/* fork's inode space */
 			char		whichfork;	/* data or attr fork */
 			char		flags;		/* flags */
-#define	XFS_BTCUR_BPRV_WASDEL		(1<<0)		/* was delayed */
-#define	XFS_BTCUR_BPRV_INVALID_OWNER	(1<<1)		/* for ext swap */
+#define	XFS_BC_BT_WASDEL	(1 << 0)		/* was delayed */
+#define	XFS_BC_BT_INVALID_OWNER	(1 << 1)		/* for ext swap */
 		} b;
 	}		bc_private;	/* per-btree type data */
 #define bc_ag	bc_private.a