nfs: support FMODE_NOWAIT on O_DIRECT reads
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest2 patches 0 repliesNew
- v12 patches 0 repliesSuperseded
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | nfs: add nowait version of nfs_start_io_directfs/ fs/ | +42 | 0 replies | |
| 2/2 | nfs: expose FMODE_NOWAIT for read-only filesfs/ fs/ | +25 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/2] nfs: support FMODE_NOWAIT on O_DIRECT reads
I had noticed that io_uring always punts O_DIRECT NFS reads to a background thread since the file does not advertise FMODE_NOWAIT.
I am not very familiar with the NFS codebase, but looking around suggests a simple change to nfs_start_io_direct is all that is required to properly support this functionality. On the request issue side, it seems everything in NFS is actually run in the background (post this lock change), and the completion codepaths all look to have no similar locking semantics.
I have restricted this to read-only files initially, as the code paths are simpler.
I unfortunately do not have the means to test the performance improvement, since even without this change my local network is the bottleneck here.
However I do suspect that there are people that would want this fix ([1]). Applying a similar patch on that GitHub issue did give performance gains.
To convince myself this works at all I did trace io_uring events through with and without the patch.
Using a test app ([2]) to issue O_DIRECT io_uring reads calls io_uring_queue_async_work without this patch, while with it the call is skipped and the completion is queued into io_uring directly from nfs_direct_read_completion.
Patch 1 here adds an unused nfs_start_io_direct_nowait which patch 2 uses in order to safely advertise FMODE_NOWAIT.
v2: Suggestions from Sashiko:
* Handle file flags changing
* Do not use mapping_empty anymore as it was apparently racy
[1]: https://github.com/axboe/liburing/issues/1499
[2]: https://github.com/DylanZA/liburing/commit/264c06f1939dfd6b6bc4c967ada5960c4f4f2db3
Dylan Yudaken (2):
nfs: add nowait version of nfs_start_io_direct
nfs: expose FMODE_NOWAIT for read-only files
fs/nfs/direct.c | 12 ++++++++++-- fs/nfs/file.c | 16 +++++++++++++++- fs/nfs/internal.h | 1 + fs/nfs/io.c | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 3 deletions(-)
base-commit: a2be31abc3fac6a20f662f6118815b9c40c371c9
Signature · 1 line
2.50.1