afs: Make {Y,}FS.FetchData an asynchronous operation
authorDavid Howells <dhowells@redhat.com>
Mon, 16 Dec 2024 20:41:15 +0000 (20:41 +0000)
committerChristian Brauner <brauner@kernel.org>
Fri, 20 Dec 2024 21:34:08 +0000 (22:34 +0100)
commiteddf51f2bb2c28b082199c6f5fd95611ca511135
treedd6819ac492d181ef1402b59bce125bd2c19462d
parent9750be93b2be12b6d92323b97d7c055099d279e6
afs: Make {Y,}FS.FetchData an asynchronous operation

Make FS.FetchData and YFS.FetchData an asynchronous operation in that the
request is queued in AF_RXRPC and then we return to the caller rather than
waiting.  Processing of the returning packets is then done inline if it's a
synchronous VFS/VM call (readdir, read_folio, sync DIO, prep for write) or
offloaded to a workqueue if asynchronous VM calls (eg. readahead, async
DIO).

This reduces the chain of workqueues invoking workqueues and cuts out some
of the overhead, driving rxrpc data extraction and netfslib read collection
from a thread that's going to block to completion anyway if possible.

The ->done() call op is also split with ->immediate_cancel() handling the
cancellation on failure to begin the call and ->done() handling the rest.
This means that the AFS async FetchData code doesn't try to terminate the
netfs subrequest twice.

Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/20241216204124.3752367-26-dhowells@redhat.com
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/afs/file.c
fs/afs/fs_operation.c
fs/afs/fsclient.c
fs/afs/internal.h
fs/afs/main.c
fs/afs/rxrpc.c
fs/afs/vlclient.c
fs/afs/write.c
fs/afs/yfsclient.c