All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH 0/3] xfs: clean up buffer cache disk addressing
Date: Tue, 10 Aug 2021 15:28:48 +1000	[thread overview]
Message-ID: <20210810052851.42312-1-david@fromorbit.com> (raw)

Over time, we've moved from using bp->b_bn as the physical disk
address for a buffer to using the address of the first buffer map
attached to the buffer. This can be seen by the implementation of
XFS_BUF_ADDR() macro:

#define XFS_BUF_ADDR(bp) ((bp)->b_maps[0].bm_bn)

The bp->b_bn value is now used as the buffer cache index for the
buffer, and it is always set to XFS_BUF_DADDR_NULL for uncached
buffers. Hence code that uses bp->b_bn for the physical address of
the buffer will not do the right thing when passed an uncached
buffer.

This series of patches addresses this problem. It adds a helper
function xfs_buf_daddr() to extract the physical address of the
buffer from it, and replaces all the open coded bp->b_bn accesses
and the XFS_BUF_ADDR() users to use it. It then renames b_bn to
b_index and converts all the internal cache lookup code to use
b_index rather than b_bn.

The result is that all code now uses xfs_buf_daddr() where physical
addresses are required, and the cache index variable isn't named in
a manner that engenders external use of access. The changes end up
being relatively small, and the impact on userspace outside libxfs
is even smaller (only a couple of dozen references to b_bn or
XFS_BUF_ADDR).

Version 1
- based on 5.14-rc4 + for-next + "xfs: rework feature flags"


             reply	other threads:[~2021-08-10  5:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-10  5:28 Dave Chinner [this message]
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
2021-08-18  0:07         ` Dave Chinner
2021-08-12  8:23   ` 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=20210810052851.42312-1-david@fromorbit.com \
    --to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.