xfs: remove XFS_IFBROOT

Just check for a btree format fork instead of the using the equivalent
in-memory XFS_IFBROOT flag.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
This commit is contained in:
Christoph Hellwig 2021-04-13 11:15:11 -07:00 committed by Darrick J. Wong
parent 0eba048dd3
commit ac1e067211
4 changed files with 8 additions and 14 deletions

View file

@ -633,7 +633,6 @@ xfs_bmap_btree_to_extents(
cur->bc_bufs[0] = NULL; cur->bc_bufs[0] = NULL;
xfs_iroot_realloc(ip, -1, whichfork); xfs_iroot_realloc(ip, -1, whichfork);
ASSERT(ifp->if_broot == NULL); ASSERT(ifp->if_broot == NULL);
ASSERT((ifp->if_flags & XFS_IFBROOT) == 0);
ifp->if_format = XFS_DINODE_FMT_EXTENTS; ifp->if_format = XFS_DINODE_FMT_EXTENTS;
*logflagsp |= XFS_ILOG_CORE | xfs_ilog_fext(whichfork); *logflagsp |= XFS_ILOG_CORE | xfs_ilog_fext(whichfork);
return 0; return 0;
@ -677,7 +676,6 @@ xfs_bmap_extents_to_btree(
* to expand the root. * to expand the root.
*/ */
xfs_iroot_realloc(ip, 1, whichfork); xfs_iroot_realloc(ip, 1, whichfork);
ifp->if_flags |= XFS_IFBROOT;
/* /*
* Fill in the root. * Fill in the root.
@ -4196,7 +4194,7 @@ xfs_bmapi_allocate(
return error; return error;
} }
if ((ifp->if_flags & XFS_IFBROOT) && !bma->cur) if (ifp->if_format == XFS_DINODE_FMT_BTREE && !bma->cur)
bma->cur = xfs_bmbt_init_cursor(mp, bma->tp, bma->ip, whichfork); bma->cur = xfs_bmbt_init_cursor(mp, bma->tp, bma->ip, whichfork);
/* /*
* Bump the number of extents we've allocated * Bump the number of extents we've allocated
@ -4269,7 +4267,7 @@ xfs_bmapi_convert_unwritten(
* Modify (by adding) the state flag, if writing. * Modify (by adding) the state flag, if writing.
*/ */
ASSERT(mval->br_blockcount <= len); ASSERT(mval->br_blockcount <= len);
if ((ifp->if_flags & XFS_IFBROOT) && !bma->cur) { if (ifp->if_format == XFS_DINODE_FMT_BTREE && !bma->cur) {
bma->cur = xfs_bmbt_init_cursor(bma->ip->i_mount, bma->tp, bma->cur = xfs_bmbt_init_cursor(bma->ip->i_mount, bma->tp,
bma->ip, whichfork); bma->ip, whichfork);
} }
@ -4732,7 +4730,7 @@ xfs_bmapi_remap(
ip->i_nblocks += len; ip->i_nblocks += len;
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
if (ifp->if_flags & XFS_IFBROOT) { if (ifp->if_format == XFS_DINODE_FMT_BTREE) {
cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork); cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork);
cur->bc_ino.flags = 0; cur->bc_ino.flags = 0;
} }
@ -5411,7 +5409,7 @@ __xfs_bunmapi(
end--; end--;
logflags = 0; logflags = 0;
if (ifp->if_flags & XFS_IFBROOT) { if (ifp->if_format == XFS_DINODE_FMT_BTREE) {
ASSERT(ifp->if_format == XFS_DINODE_FMT_BTREE); ASSERT(ifp->if_format == XFS_DINODE_FMT_BTREE);
cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork); cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork);
cur->bc_ino.flags = 0; cur->bc_ino.flags = 0;
@ -5885,7 +5883,7 @@ xfs_bmap_collapse_extents(
if (error) if (error)
return error; return error;
if (ifp->if_flags & XFS_IFBROOT) { if (ifp->if_format == XFS_DINODE_FMT_BTREE) {
cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork); cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork);
cur->bc_ino.flags = 0; cur->bc_ino.flags = 0;
} }
@ -6000,7 +5998,7 @@ xfs_bmap_insert_extents(
if (error) if (error)
return error; return error;
if (ifp->if_flags & XFS_IFBROOT) { if (ifp->if_format == XFS_DINODE_FMT_BTREE) {
cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork); cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork);
cur->bc_ino.flags = 0; cur->bc_ino.flags = 0;
} }
@ -6115,7 +6113,7 @@ xfs_bmap_split_extent(
new.br_blockcount = got.br_blockcount - gotblkcnt; new.br_blockcount = got.br_blockcount - gotblkcnt;
new.br_state = got.br_state; new.br_state = got.br_state;
if (ifp->if_flags & XFS_IFBROOT) { if (ifp->if_format == XFS_DINODE_FMT_BTREE) {
cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork); cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork);
cur->bc_ino.flags = 0; cur->bc_ino.flags = 0;
error = xfs_bmbt_lookup_eq(cur, &got, &i); error = xfs_bmbt_lookup_eq(cur, &got, &i);

View file

@ -387,7 +387,6 @@ xfs_btree_bload_prep_block(
new_size = bbl->iroot_size(cur, nr_this_block, priv); new_size = bbl->iroot_size(cur, nr_this_block, priv);
ifp->if_broot = kmem_zalloc(new_size, 0); ifp->if_broot = kmem_zalloc(new_size, 0);
ifp->if_broot_bytes = (int)new_size; ifp->if_broot_bytes = (int)new_size;
ifp->if_flags |= XFS_IFBROOT;
/* Initialize it and send it out. */ /* Initialize it and send it out. */
xfs_btree_init_block_int(cur->bc_mp, ifp->if_broot, xfs_btree_init_block_int(cur->bc_mp, ifp->if_broot,

View file

@ -60,7 +60,7 @@ xfs_init_local_fork(
} }
ifp->if_bytes = size; ifp->if_bytes = size;
ifp->if_flags &= ~(XFS_IFEXTENTS | XFS_IFBROOT); ifp->if_flags &= ~XFS_IFEXTENTS;
ifp->if_flags |= XFS_IFINLINE; ifp->if_flags |= XFS_IFINLINE;
} }
@ -214,7 +214,6 @@ xfs_iformat_btree(
xfs_bmdr_to_bmbt(ip, dfp, XFS_DFORK_SIZE(dip, ip->i_mount, whichfork), xfs_bmdr_to_bmbt(ip, dfp, XFS_DFORK_SIZE(dip, ip->i_mount, whichfork),
ifp->if_broot, size); ifp->if_broot, size);
ifp->if_flags &= ~XFS_IFEXTENTS; ifp->if_flags &= ~XFS_IFEXTENTS;
ifp->if_flags |= XFS_IFBROOT;
ifp->if_bytes = 0; ifp->if_bytes = 0;
ifp->if_u1.if_root = NULL; ifp->if_u1.if_root = NULL;
@ -433,7 +432,6 @@ xfs_iroot_realloc(
XFS_BMBT_BLOCK_LEN(ip->i_mount)); XFS_BMBT_BLOCK_LEN(ip->i_mount));
} else { } else {
new_broot = NULL; new_broot = NULL;
ifp->if_flags &= ~XFS_IFBROOT;
} }
/* /*

View file

@ -32,7 +32,6 @@ struct xfs_ifork {
*/ */
#define XFS_IFINLINE 0x01 /* Inline data is read in */ #define XFS_IFINLINE 0x01 /* Inline data is read in */
#define XFS_IFEXTENTS 0x02 /* All extent pointers are read in */ #define XFS_IFEXTENTS 0x02 /* All extent pointers are read in */
#define XFS_IFBROOT 0x04 /* i_broot points to the bmap b-tree root */
/* /*
* Worst-case increase in the fork extent count when we're adding a single * Worst-case increase in the fork extent count when we're adding a single