Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

afs: Make read subreqs async

Perform AFS read subrequests in a work item rather than in the calling
thread. For normal buffered reads, this will allow the calling thread to
copy data from the pagecache to the application at the same time as the
demarshalling thread is shovelling data from skbuffs into the pagecache.

This will also allow the RA mark to trigger a new read before we've
finished shovelling the data from the current one.

Note: This would be a bit safer if the FS.FetchData RPC ops returned the
metadata (including the data version number) before returning the data.
This would allow me to flush the pagecache before installing the new data.

In future, it may be possible to asynchronously flush the pagecache either
side of the region being read.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: linux-afs@lists.infradead.org
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Link: https://lore.kernel.org/r/20240814203850.2240469-19-dhowells@redhat.com/ # v2
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

David Howells and committed by
Christian Brauner
2e45b922 983cdcf8

+8 -1
+8 -1
fs/afs/file.c
··· 305 305 return afs_do_sync_operation(op); 306 306 } 307 307 308 - static void afs_issue_read(struct netfs_io_subrequest *subreq) 308 + static void afs_read_worker(struct work_struct *work) 309 309 { 310 + struct netfs_io_subrequest *subreq = container_of(work, struct netfs_io_subrequest, work); 310 311 struct afs_vnode *vnode = AFS_FS_I(subreq->rreq->inode); 311 312 struct afs_read *fsreq; 312 313 ··· 324 323 325 324 afs_fetch_data(fsreq->vnode, fsreq); 326 325 afs_put_read(fsreq); 326 + } 327 + 328 + static void afs_issue_read(struct netfs_io_subrequest *subreq) 329 + { 330 + INIT_WORK(&subreq->work, afs_read_worker); 331 + queue_work(system_long_wq, &subreq->work); 327 332 } 328 333 329 334 static int afs_symlink_read_folio(struct file *file, struct folio *folio)