From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/4] xfs: remove the XBF_STALE check from xfs_buf_rele_cached
Date: Tue, 18 Feb 2025 12:23:56 -0800 [thread overview]
Message-ID: <20250218202356.GJ21808@frogsfrogsfrogs> (raw)
In-Reply-To: <20250217093207.3769550-5-hch@lst.de>
On Mon, Feb 17, 2025 at 10:31:29AM +0100, Christoph Hellwig wrote:
> xfs_buf_stale already set b_lru_ref to 0, and thus prevents the buffer
> from moving to the LRU. Remove the duplicate check.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
I'd long wondered why that was necessary...
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> fs/xfs/xfs_buf.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index f8efdee3c8b4..cf88b25fe3c5 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -99,12 +99,6 @@ xfs_buf_stale(
> */
> bp->b_flags &= ~_XBF_DELWRI_Q;
>
> - /*
> - * Once the buffer is marked stale and unlocked, a subsequent lookup
> - * could reset b_flags. There is no guarantee that the buffer is
> - * unaccounted (released to LRU) before that occurs. Drop in-flight
> - * status now to preserve accounting consistency.
> - */
> spin_lock(&bp->b_lock);
> atomic_set(&bp->b_lru_ref, 0);
> if (!(bp->b_state & XFS_BSTATE_DISPOSE) &&
> @@ -1033,7 +1027,7 @@ xfs_buf_rele_cached(
> }
>
> /* we are asked to drop the last reference */
> - if (!(bp->b_flags & XBF_STALE) && atomic_read(&bp->b_lru_ref)) {
> + if (atomic_read(&bp->b_lru_ref)) {
> /*
> * If the buffer is added to the LRU, keep the reference to the
> * buffer for the LRU and clear the (now stale) dispose list
> --
> 2.45.2
>
>
next prev parent reply other threads:[~2025-02-18 20:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 9:31 buffer cache simplifications Christoph Hellwig
2025-02-17 9:31 ` [PATCH 1/4] xfs: reduce context switches for synchronous buffered I/O Christoph Hellwig
2025-02-18 20:05 ` Darrick J. Wong
2025-02-19 5:32 ` Christoph Hellwig
2025-02-17 9:31 ` [PATCH 2/4] xfs: decouple buffer readahead from the normal buffer read path Christoph Hellwig
2025-02-18 20:10 ` Darrick J. Wong
2025-02-19 5:32 ` Christoph Hellwig
2025-02-17 9:31 ` [PATCH 3/4] xfs: remove most in-flight buffer accounting Christoph Hellwig
2025-02-18 20:23 ` Darrick J. Wong
2025-02-19 5:35 ` Christoph Hellwig
2025-02-19 5:37 ` Darrick J. Wong
2025-02-17 9:31 ` [PATCH 4/4] xfs: remove the XBF_STALE check from xfs_buf_rele_cached Christoph Hellwig
2025-02-18 20:23 ` Darrick J. Wong [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-02-24 15:11 buffer cache simplifications v2 Christoph Hellwig
2025-02-24 15:11 ` [PATCH 4/4] xfs: remove the XBF_STALE check from xfs_buf_rele_cached Christoph Hellwig
2025-02-24 23:48 buffer cache simplifications v3 Christoph Hellwig
2025-02-24 23:48 ` [PATCH 4/4] xfs: remove the XBF_STALE check from xfs_buf_rele_cached 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=20250218202356.GJ21808@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@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