Skip to content

NFS: O_DIRECT aio and io_uring support

Avi Kivity io-uring linux-nfs 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 0 repliesNew
  2. v15 patches 1 replySuperseded

Changes in v2 from the cover letter

- new patch exporting task_work_add() for modular builds

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6nfs: complete direct writes inline when nothing is left to dofs/nfs/direct.c fs/nfs/pnfs.h+59 -20 replies
2/6task_work: export task_work_add() to the NFS clientkernel/task_work.c+2 -00 replies
3/6nfs: run the direct write completion tail from task_workfs/nfs/direct.c fs/nfs/internal.h+52 -10 replies
4/6nfs: honour IOCB_NOWAIT in nfs_file_direct_write()fs/nfs/direct.c+19 -10 replies
5/6nfs: advertise FMODE_NOWAIT on writable filesfs/nfs/dir.c fs/nfs/file.c fs/nfs/nfs4file.c +1 more+28 -80 replies
6/6nfs: set FOP_DIO_PARALLEL_WRITEfs/nfs/file.c fs/nfs/nfs4file.c+2 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/6] NFS: O_DIRECT aio and io_uring support

From: Avi Kivity <[email protected]>

This series completes NFS client support for O_DIRECT writes.

Support was mostly there, but NFS did not communicate well with aio and io_uring (IOCB_NOWAIT/FMODE_NOWAIT/FOP_DIO_PARALLEL_WRITE) and scheduled work even when there was nothing to do. In addition, the series prefers io_uring task_work to the knfsiod as this avoids context switches.

Before the series, io_uring punted every write to its workqueues (due to lack of NOWAIT support). Linux-aio initiated writes directly, but all of them completed in knfsiod.

One thing is that task_work can now take the inode commit_mutex. It seems benign to me.

Performance is up 16-64% against loopback knfsd on tmpfs. Detailed results (written by AI) are available [1], both fio and my target application, ScyllaDB.

DisclAImer: Claude wrote the patches, I reviewed them to the best of
my ability. I have kernel experience but not in NFS.

[1] https://gist.github.com/avikivity/110cfc22f2c5381e473423437e9ca210

v2:
- new patch exporting task_work_add() for modular builds

Avi Kivity (6):
nfs: complete direct writes inline when nothing is left to do
task_work: export task_work_add() to the NFS client
nfs: run the direct write completion tail from task_work
nfs: honour IOCB_NOWAIT in nfs_file_direct_write()
nfs: advertise FMODE_NOWAIT on writable files
nfs: set FOP_DIO_PARALLEL_WRITE

 fs/nfs/dir.c       |   4 ++
 fs/nfs/direct.c    | 118 +++++++++++++++++++++++++++++++++++++++++++--
 fs/nfs/file.c      |  26 ++++++----
 fs/nfs/internal.h  |   2 +
 fs/nfs/nfs4file.c  |   5 +-
 fs/nfs/pnfs.h      |  19 ++++++++
 kernel/task_work.c |   2 +
 7 files changed, 162 insertions(+), 14 deletions(-)
Signature · 1 line
2.56.1