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 3/4] xfs: remove most in-flight buffer accounting
Date: Tue, 18 Feb 2025 21:37:33 -0800 [thread overview]
Message-ID: <20250219053733.GN21808@frogsfrogsfrogs> (raw)
In-Reply-To: <20250219053527.GC10173@lst.de>
On Wed, Feb 19, 2025 at 06:35:27AM +0100, Christoph Hellwig wrote:
> On Tue, Feb 18, 2025 at 12:23:27PM -0800, Darrick J. Wong wrote:
> > On Mon, Feb 17, 2025 at 10:31:28AM +0100, Christoph Hellwig wrote:
> > > The buffer cache keeps a bt_io_count per-CPU counter to track all
> > > in-flight I/O, which is used to ensure no I/O is in flight when
> > > unmounting the file system.
> > >
> > > For most I/O we already keep track of inflight I/O at higher levels:
> > >
> > > - for synchronous I/O (xfs_buf_read/xfs_bwrite/xfs_buf_delwri_submit),
> > > the caller has a reference and waits for I/O completions using
> > > xfs_buf_iowait
> > > - for xfs_buf_delwri_submit the only caller (AIL writeback) tracks the
> >
> > Do you mean xfs_buf_delwri_submit_nowait here?
>
> Yes.
>
> > IOWs, only asynchronous readahead needs an explicit counter in the
> > xfs_buf to prevent unmount because:
> >
> > 0. Anything done in mount/unmount/freeze holds s_umount
> > 1. Buffer reads done on behalf of a file hold the file open and pin the
> > mount
> > 2. Dirty buffers have log items, and we can't unmount until those are
> > dealt with
> > 3. Fsck holds an open fd and hence pins the mount
> > 4. Unmount blocks until background gc finishes
> >
> > Right?
>
> Yes.
>
> > I almost wonder if you could just have a percpu counter in the
> > xfs_mount but that sounds pretty hot.
>
> Well, that would remove the nice xfs_buftarg_wait() abstraction.
> Givne that we don't even allocate an extra buftrag unless we use
> it that doesn't seem very useful.
Heheh. Anyway, the changes look good to me so with that cleared up
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
> > > + /* there are currently no valid flags for xfs_buf_get_uncached */
> > > + ASSERT(flags == 0);
> >
> > Can we just get rid of flags then? AFAICT nobody uses it either here or
> > in xfsprogs, and in fact I think there's a nasty bug in the userspace
> > rtsb code:
>
> See my reply to the last patch: I actually have a patch to remove it,
> but it conflicts with the zoned series. So for now I'll defer it until
> that is merged.
<nod>
--D
next prev parent reply other threads:[~2025-02-19 5:37 UTC|newest]
Thread overview: 16+ 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 [this message]
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
-- 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 3/4] xfs: remove most in-flight buffer accounting Christoph Hellwig
2025-02-24 19:16 ` Darrick J. Wong
2025-02-24 23:48 buffer cache simplifications v3 Christoph Hellwig
2025-02-24 23:48 ` [PATCH 3/4] xfs: remove most in-flight buffer accounting 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=20250219053733.GN21808@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