From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org, hch@lst.de
Subject: Re: [PATCH 07/10] xfs: refactor creation of bmap btree roots
Date: Thu, 29 Aug 2024 12:13:09 +1000 [thread overview]
Message-ID: <Zs/ZNSQ74BOefzUm@dread.disaster.area> (raw)
In-Reply-To: <172480131627.2291268.8798821424165754100.stgit@frogsfrogsfrogs>
On Tue, Aug 27, 2024 at 04:35:33PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Now that we've created inode fork helpers to allocate and free btree
> roots, create a new bmap btree helper to create a new bmbt root, and
> refactor the extents <-> btree conversion functions to use our new
> helpers.
>
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
> fs/xfs/libxfs/xfs_bmap.c | 20 ++++++--------------
> fs/xfs/libxfs/xfs_bmap_btree.c | 13 +++++++++++++
> fs/xfs/libxfs/xfs_bmap_btree.h | 2 ++
> 3 files changed, 21 insertions(+), 14 deletions(-)
>
>
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index 00cac756c9566..e3922cf75381c 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
> @@ -614,7 +614,7 @@ xfs_bmap_btree_to_extents(
> xfs_trans_binval(tp, cbp);
> if (cur->bc_levels[0].bp == cbp)
> cur->bc_levels[0].bp = NULL;
> - xfs_iroot_realloc(ip, -1, whichfork);
> + xfs_iroot_free(ip, whichfork);
I feel like the "whichfork" interface is unnecessary here. We
already have the ifp in all cases here, and so
xfs_iroot_free(ifp);
avoids the need to look up the ifp again in xfs_iroot_free().
The same happens with xfs_iroot_alloc() - the callers already have
the ifp in a local variable, so...
> ASSERT(ifp->if_broot == NULL);
> ifp->if_format = XFS_DINODE_FMT_EXTENTS;
> *logflagsp |= XFS_ILOG_CORE | xfs_ilog_fext(whichfork);
> @@ -655,19 +655,10 @@ xfs_bmap_extents_to_btree(
> ASSERT(ifp->if_format == XFS_DINODE_FMT_EXTENTS);
>
> /*
> - * Make space in the inode incore. This needs to be undone if we fail
> - * to expand the root.
> - */
> - xfs_iroot_realloc(ip, 1, whichfork);
> -
> - /*
> - * Fill in the root.
> - */
> - block = ifp->if_broot;
> - xfs_bmbt_init_block(ip, block, NULL, 1, 1);
> - /*
> - * Need a cursor. Can't allocate until bb_level is filled in.
> + * Fill in the root, create a cursor. Can't allocate until bb_level is
> + * filled in.
> */
> + xfs_bmbt_iroot_alloc(ip, whichfork);
.... this becomes xfs_bmbt_iroot_alloc(ip, ifp);
i.e. once we already have an ifp resolved for the fork, it makes no
sense to pass whichfork down the stack instead of the ifp...
-Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2024-08-29 2:13 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 23:33 [PATCHSET v4.1] xfs: cleanups for inode rooted btree code Darrick J. Wong
2024-08-27 23:33 ` [PATCH 01/10] xfs: fix C++ compilation errors in xfs_fs.h Darrick J. Wong
2024-08-28 4:09 ` Christoph Hellwig
2024-08-29 1:29 ` Dave Chinner
2024-09-02 15:20 ` Carlos Maiolino
2024-08-27 23:34 ` [PATCH 02/10] xfs: fix FITRIM reporting again Darrick J. Wong
2024-08-28 4:10 ` Christoph Hellwig
2024-08-27 23:34 ` [PATCH 03/10] xfs: fix a sloppy memory handling bug in xfs_iroot_realloc Darrick J. Wong
2024-08-28 4:10 ` Christoph Hellwig
2024-08-27 23:34 ` [PATCH 04/10] xfs: replace shouty XFS_BM{BT,DR} macros Darrick J. Wong
2024-08-28 4:11 ` Christoph Hellwig
2024-08-29 2:00 ` Dave Chinner
2024-08-29 22:10 ` Darrick J. Wong
2024-08-30 3:43 ` Christoph Hellwig
2024-08-27 23:35 ` [PATCH 05/10] xfs: move the zero records logic into xfs_bmap_broot_space_calc Darrick J. Wong
2024-08-28 4:14 ` Christoph Hellwig
2024-08-29 1:15 ` Darrick J. Wong
2024-08-29 3:51 ` Christoph Hellwig
2024-08-29 2:05 ` Dave Chinner
2024-08-29 22:34 ` Darrick J. Wong
2024-08-27 23:35 ` [PATCH 06/10] xfs: refactor the allocation and freeing of incore inode fork btree roots Darrick J. Wong
2024-08-28 4:15 ` Christoph Hellwig
2024-08-28 4:17 ` Christoph Hellwig
2024-08-28 21:50 ` Darrick J. Wong
2024-08-27 23:35 ` [PATCH 07/10] xfs: refactor creation of bmap " Darrick J. Wong
2024-08-28 4:19 ` Christoph Hellwig
2024-08-29 2:13 ` Dave Chinner [this message]
2024-08-29 22:46 ` Darrick J. Wong
2024-08-27 23:35 ` [PATCH 08/10] xfs: hoist the code that moves the incore inode fork broot memory Darrick J. Wong
2024-08-28 4:20 ` Christoph Hellwig
2024-08-29 2:54 ` Dave Chinner
2024-08-29 23:35 ` Darrick J. Wong
2024-08-27 23:36 ` [PATCH 09/10] xfs: rearrange xfs_iroot_realloc a bit Darrick J. Wong
2024-08-28 4:21 ` Christoph Hellwig
2024-08-27 23:36 ` [PATCH 10/10] xfs: standardize the btree maxrecs function parameters Darrick J. Wong
2024-08-28 4:21 ` Christoph Hellwig
2024-08-27 23:45 ` [RFC PATCH] libxfs: compile with a C++ compiler Darrick J. Wong
2024-08-28 0:01 ` Sam James
2024-08-28 0:10 ` Sam James
2024-08-28 23:53 ` Darrick J. Wong
2024-08-29 0:17 ` Sam James
2024-08-29 1:30 ` Kees Cook
2024-08-28 4:25 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zs/ZNSQ74BOefzUm@dread.disaster.area \
--to=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox