From: "Darrick J. Wong" <djwong@kernel.org>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/3] xfs: rename buffer cache index variable b_bn
Date: Tue, 17 Aug 2021 16:56:09 -0700 [thread overview]
Message-ID: <20210817235609.GF12640@magnolia> (raw)
In-Reply-To: <20210817234827.GK3657114@dread.disaster.area>
On Wed, Aug 18, 2021 at 09:48:27AM +1000, Dave Chinner wrote:
> On Tue, Aug 10, 2021 at 05:46:32PM -0700, Darrick J. Wong wrote:
> > On Tue, Aug 10, 2021 at 03:28:51PM +1000, Dave Chinner wrote:
> > > From: Dave Chinner <dchinner@redhat.com>
> > >
> > > TO stop external users from using b_bn as the disk address of the
> > > buffer, rename it to b_index to indicate that it is the buffer cache
> > > index, not the block number of the buffer. Code that needs the disk
> > > address should use xfs_buf_daddr() to obtain it.
> > >
> > > Do the rename and clean up any of the remaining b_bn cruft that is
> > > left over and is now unused.
> > >
> > > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> > > ---
> > > fs/xfs/xfs_buf.c | 19 +++++++++++--------
> > > fs/xfs/xfs_buf.h | 18 +-----------------
> > > 2 files changed, 12 insertions(+), 25 deletions(-)
> > >
> > > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> > > index c1bb6e41595b..6f6c6937baaa 100644
> > > --- a/fs/xfs/xfs_buf.c
> > > +++ b/fs/xfs/xfs_buf.c
> > > @@ -251,7 +251,7 @@ _xfs_buf_alloc(
> > > return error;
> > > }
> > >
> > > - bp->b_bn = map[0].bm_bn;
> > > + bp->b_index = map[0].bm_bn;
> > > bp->b_length = 0;
> > > for (i = 0; i < nmaps; i++) {
> > > bp->b_maps[i].bm_bn = map[i].bm_bn;
> > > @@ -459,7 +459,7 @@ _xfs_buf_obj_cmp(
> > > */
> > > BUILD_BUG_ON(offsetof(struct xfs_buf_map, bm_bn) != 0);
> > >
> > > - if (bp->b_bn != map->bm_bn)
> > > + if (bp->b_index != map->bm_bn)
> > > return 1;
> > >
> > > if (unlikely(bp->b_length != map->bm_len)) {
> > > @@ -481,7 +481,7 @@ static const struct rhashtable_params xfs_buf_hash_params = {
> > > .min_size = 32, /* empty AGs have minimal footprint */
> > > .nelem_hint = 16,
> > > .key_len = sizeof(xfs_daddr_t),
> > > - .key_offset = offsetof(struct xfs_buf, b_bn),
> > > + .key_offset = offsetof(struct xfs_buf, b_index),
> >
> > I would've called this field b_rhash_key, since "index" is a kind of
> > vague.
>
> Ok.
>
> > > @@ -875,7 +877,7 @@ xfs_buf_read_uncached(
> > >
> > > /* set up the buffer for a read IO */
> > > ASSERT(bp->b_map_count == 1);
> > > - bp->b_bn = XFS_BUF_DADDR_NULL; /* always null for uncached buffers */
> > > + bp->b_index = XFS_BUF_DADDR_NULL;
> > > bp->b_maps[0].bm_bn = daddr;
> > > bp->b_flags |= XBF_READ;
> > > bp->b_ops = ops;
> > > @@ -1513,7 +1515,7 @@ _xfs_buf_ioapply(
> > > SHUTDOWN_CORRUPT_INCORE);
> > > return;
> > > }
> > > - } else if (bp->b_bn != XFS_BUF_DADDR_NULL) {
> > > + } else if (bp->b_index != XFS_BUF_DADDR_NULL) {
> > > struct xfs_mount *mp = bp->b_mount;
> > >
> > > /*
> > > @@ -1523,7 +1525,8 @@ _xfs_buf_ioapply(
> > > if (xfs_has_crc(mp)) {
> > > xfs_warn(mp,
> > > "%s: no buf ops on daddr 0x%llx len %d",
> > > - __func__, bp->b_bn, bp->b_length);
> > > + __func__, xfs_buf_daddr(bp),
> > > + bp->b_length);
> > > xfs_hex_dump(bp->b_addr,
> > > XFS_CORRUPTION_DUMP_LEN);
> > > dump_stack();
> > > @@ -1793,7 +1796,7 @@ xfs_buftarg_drain(
> > > xfs_buf_alert_ratelimited(bp,
> > > "XFS: Corruption Alert",
> > > "Corruption Alert: Buffer at daddr 0x%llx had permanent write failures!",
> > > - (long long)bp->b_bn);
> > > + (long long)xfs_buf_daddr(bp));
> >
> > These belong in the previous patch, right?
>
> Depends on your POV. This patch cleans up all the internal (mis)uses of
> b_bn, while the previous patches addressed all the external uses.
> The mods could be in either, I just chose to split internal/external
> modification based on the file rather than on the specific (ab)use
> being corrected....
<nod> Ok then. Would you mind noting that in the commit message with
something along the lines of "...and convert internal users."? My brain
is likely to fall out before you repost this patch. :/
--D
>
> Cheers,
>
> Dave.
> --
> Dave Chinner
> david@fromorbit.com
next prev parent reply other threads:[~2021-08-17 23:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-10 5:28 [PATCH 0/3] xfs: clean up buffer cache disk addressing Dave Chinner
2021-08-10 5:28 ` [PATCH 1/3] xfs: introduce xfs_buf_daddr() Dave Chinner
2021-08-11 0:40 ` Darrick J. Wong
2021-08-12 8:10 ` Christoph Hellwig
2021-08-12 8:16 ` Christoph Hellwig
2021-08-10 5:28 ` [PATCH 2/3] xfs: convert bp->b_bn references to xfs_buf_daddr() Dave Chinner
2021-08-11 0:44 ` Darrick J. Wong
2021-08-12 8:20 ` Christoph Hellwig
2021-08-10 5:28 ` [PATCH 3/3] xfs: rename buffer cache index variable b_bn Dave Chinner
2021-08-11 0:46 ` Darrick J. Wong
2021-08-17 23:48 ` Dave Chinner
2021-08-17 23:56 ` Darrick J. Wong [this message]
2021-08-18 0:07 ` Dave Chinner
2021-08-12 8:23 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2021-08-19 0:00 [PATCH 0/3 v2] xfs: clean up buffer cache disk addressing Dave Chinner
2021-08-19 0:00 ` [PATCH 3/3] xfs: rename buffer cache index variable b_bn Dave Chinner
2021-08-19 1:59 ` Darrick J. Wong
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=20210817235609.GF12640@magnolia \
--to=djwong@kernel.org \
--cc=david@fromorbit.com \
--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;
as well as URLs for NNTP newsgroup(s).