Skip to contentSkip to conversation

io_uring support for buffered writes

GIT PULL Merged Jens Axboe 2 participants 2 messages Jul 31, 2022 – Aug 2, 2022 io_uring

lore
Share & tools
lore

Jens Axboe

author maintainer
#0 lore raw

Hi Linus,

On top of the core io_uring changes for 5.20, this pull request contains support for buffered writes, specifically for XFS. btrfs is in progress, will be coming in the next release.

io_uring does support buffered writes on any file type, but since the buffered write path just always -EAGAIN (or -EOPNOTSUPP) any attempt to do so if IOCB_NOWAIT is set, any buffered write will effectively be handled by io-wq offload. This isn't very efficient, and we even have specific code in io-wq to serialize buffered writes to the same inode to avoid further inefficiencies with thread offload.

This is particularly sad since most buffered writes don't block, they simply copy data to a page and dirty it. With this pull request, we can handle buffered writes a lot more effiently. If balance_dirty_pages() needs to block, we back off on writes as indicated.

This improves buffered write support by 2-3x.

Jan Kara helped with the mm bits for this, and Stefan handled the fs/iomap/xfs/io_uring parts of it.

Please pull!

The following changes since commit f6b543fd03d347e8bf245cee4f2d54eb6ffd8fcb:

io_uring: ensure REQ_F_ISREG is set async offload (2022-07-24 18:39:18 -0600)

are available in the Git repository at:

git://git.kernel.dk/linux-block.git tags/for-5.20/io_uring-buffered-writes-2022-07-29

for you to fetch changes up to 0dd316ba8692c2374fbb82cce57c0b23144f2977:

mm: honor FGP_NOWAIT for page cache page allocation (2022-07-24 18:39:32 -0600)

----------------------------------------------------------------
for-5.20/io_uring-buffered-writes-2022-07-29

----------------------------------------------------------------
Jan Kara (3):
mm: Move starting of background writeback into the main balancing loop
mm: Move updates of dirty_exceeded into one place
mm: Add balance_dirty_pages_ratelimited_flags() function

Jens Axboe (2):
io_uring: fix issue with io_write() not always undoing sb_start_write()
mm: honor FGP_NOWAIT for page cache page allocation

Stefan Roesch (11):
iomap: Add flags parameter to iomap_page_create()
iomap: Add async buffered write support
iomap: Return -EAGAIN from iomap_write_iter()
fs: add a FMODE_BUF_WASYNC flags for f_mode
fs: add __remove_file_privs() with flags parameter
fs: Split off inode_needs_update_time and __file_update_time
fs: Add async write file modification handling.
io_uring: Add support for async buffered writes
io_uring: Add tracepoint for short writes
xfs: Specify lockmode when calling xfs_ilock_for_iomap()
xfs: Add async buffered write support

 fs/inode.c                      | 168 +++++++++++++++++++++++++++++-----------
 fs/iomap/buffered-io.c          |  67 ++++++++++++----
 fs/read_write.c                 |   4 +-
 fs/xfs/xfs_file.c               |  11 ++-
 fs/xfs/xfs_iomap.c              |  11 ++-
 include/linux/fs.h              |   4 +
 include/linux/writeback.h       |   7 ++
 include/trace/events/io_uring.h |  25 ++++++
 io_uring/rw.c                   |  41 ++++++++--
 mm/filemap.c                    |   4 +
 mm/page-writeback.c             |  89 +++++++++++++--------
 11 files changed, 323 insertions(+), 108 deletions(-)
Signature · 1 line
Jens Axboe
merge bot Merged
#1 lore raw
The pull request you sent on Sun, 31 Jul 2022 09:03:30 -0600:

The pull request you sent on Sun, 31 Jul 2022 09:03:30 -0600:

Quoted 1 line

git://git.kernel.dk/linux-block.git tags/for-5.20/io_uring-buffered-writes-2022-07-29

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/98e247464088a11ce2328a214fdb87d4c06f8db6

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html