]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xfs: remove most in-flight buffer accounting
authorChristoph Hellwig <hch@lst.de>
Mon, 24 Feb 2025 23:48:54 +0000 (15:48 -0800)
committerCarlos Maiolino <cem@kernel.org>
Tue, 25 Feb 2025 12:05:59 +0000 (13:05 +0100)
commit0d1120b9bbe48a2d119afe0dc64f9c0666745bc8
tree9aacd018c8475ddf5a93be7ee18f4cf1c627bb5e
parentefc5f7a9f3d887ce44b7610bc39388094b6f97d5
xfs: remove most in-flight buffer accounting

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_nowait the only caller (AIL writeback)
   tracks the log items that the buffer attached to

This only leaves only xfs_buf_readahead_map as a submitter of
asynchronous I/O that is not tracked by anything else.  Replace the
bt_io_count per-cpu counter with a more specific bt_readahead_count
counter only tracking readahead I/O.  This allows to simply increment
it when submitting readahead I/O and decrementing it when it completed,
and thus simplify xfs_buf_rele and remove the needed for the
XBF_NO_IOACCT flags and the XFS_BSTATE_IN_FLIGHT buffer state.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_buf.c
fs/xfs/xfs_buf.h
fs/xfs/xfs_buf_mem.c
fs/xfs/xfs_mount.c
fs/xfs/xfs_rtalloc.c