]> git.ipfire.org Git - thirdparty/linux.git/commit
iomap: optimize pending async writeback accounting
authorJoanne Koong <joannelkoong@gmail.com>
Tue, 11 Nov 2025 19:36:53 +0000 (11:36 -0800)
committerChristian Brauner <brauner@kernel.org>
Wed, 12 Nov 2025 09:50:32 +0000 (10:50 +0100)
commit6b1fd2281fb0873ec56f8791d4e4898302070804
treef0f1597493b50e586e7958e966d80217d290d5be
parent7e6cea5ae2f5e62112fce69acc07ee8b694b6dd0
iomap: optimize pending async writeback accounting

Pending writebacks must be accounted for to determine when all requests
have completed and writeback on the folio should be ended. Currently
this is done by atomically incrementing ifs->write_bytes_pending for
every range to be written back.

Instead, the number of atomic operations can be minimized by setting
ifs->write_bytes_pending to the folio size, internally tracking how many
bytes are written back asynchronously, and then after sending off all
the requests, decrementing ifs->write_bytes_pending by the number of
bytes not written back asynchronously. Now, for N ranges written back,
only N + 2 atomic operations are required instead of 2N + 2.

Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Link: https://patch.msgid.link/20251111193658.3495942-5-joannelkoong@gmail.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/fuse/file.c
fs/iomap/buffered-io.c
fs/iomap/ioend.c
include/linux/iomap.h