History

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.

David Howells committed 2 years ago

Commit 2e45b921 parent 983cdcf1 file · +8 −1Browse files

Unified · Split

fs/afs/file.c+8−1
@@ -305,8 +305,9 @@ int afs_fetch_data(struct afs_vnode *vnode, struct afs_read *req) · 304 unmodified lines
305 return afs_do_sync_operation(op);305 return afs_do_sync_operation(op);
306}306}
307 307
308static void afs_issue_read(struct netfs_io_subrequest *subreq)308static 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 struct afs_vnode *vnode = AFS_FS_I(subreq->rreq->inode);311 struct afs_vnode *vnode = AFS_FS_I(subreq->rreq->inode);
311 struct afs_read *fsreq;312 struct afs_read *fsreq;
312 313
@@ -325,6 +326,12 @@ static void afs_issue_read(struct netfs_io_subrequest *subreq) · 12 unmodified lines
325 afs_put_read(fsreq);326 afs_put_read(fsreq);
326}327}
327 328
329static void afs_issue_read(struct netfs_io_subrequest *subreq)
330{
331 INIT_WORK(&subreq->work, afs_read_worker);
332 queue_work(system_long_wq, &subreq->work);
333}
334
328static int afs_symlink_read_folio(struct file *file, struct folio *folio)335static int afs_symlink_read_folio(struct file *file, struct folio *folio)
329{336{
330 struct afs_vnode *vnode = AFS_FS_I(folio->mapping->host);337 struct afs_vnode *vnode = AFS_FS_I(folio->mapping->host);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t