diff options
| author | David Howells <[email protected]> | 2025-05-19 09:07:04 +0000 |
|---|---|---|
| committer | Christian Brauner <[email protected]> | 2025-05-21 12:35:21 +0000 |
| commit | 2b1424cd131cfaba4cf7040473133d26cddac088 (patch) | |
| tree | cf279e47bbadebd7cad6cd589641c4d99f0da644 /fs/netfs/direct_write.c | |
| parent | netfs: Fix the request's work item to not require a ref (diff) | |
| download | kernel-2b1424cd131cfaba4cf7040473133d26cddac088.tar.gz kernel-2b1424cd131cfaba4cf7040473133d26cddac088.zip | |
netfs: Fix wait/wake to be consistent about the waitqueue used
Fix further inconsistencies in the use of waitqueues
(clear_and_wake_up_bit() vs private waitqueue).
Move some of this stuff from the read and write sides into common code so
that it can be done in fewer places.
To make this work, async I/O needs to set NETFS_RREQ_OFFLOAD_COLLECTION to
indicate that a workqueue will do the collecting and places that call the
wait function need to deal with it returning the amount transferred.
Fixes: e2d46f2ec332 ("netfs: Change the read result collector to only use one work item")
Signed-off-by: David Howells <[email protected]>
Link: https://lore.kernel.org/[email protected]
cc: Marc Dionne <[email protected]>
cc: Steve French <[email protected]>
cc: Ihor Solodrai <[email protected]>
cc: Eric Van Hensbergen <[email protected]>
cc: Latchesar Ionkov <[email protected]>
cc: Dominique Martinet <[email protected]>
cc: Christian Schoenebeck <[email protected]>
cc: Paulo Alcantara <[email protected]>
cc: Jeff Layton <[email protected]>
cc: [email protected]
cc: [email protected]
cc: [email protected]
cc: [email protected]
Signed-off-by: Christian Brauner <[email protected]>
Diffstat (limited to 'fs/netfs/direct_write.c')
| -rw-r--r-- | fs/netfs/direct_write.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/netfs/direct_write.c b/fs/netfs/direct_write.c index c98f1676f86d..fa9a5bf3c6d5 100644 --- a/fs/netfs/direct_write.c +++ b/fs/netfs/direct_write.c @@ -87,6 +87,8 @@ ssize_t netfs_unbuffered_write_iter_locked(struct kiocb *iocb, struct iov_iter * } __set_bit(NETFS_RREQ_USE_IO_ITER, &wreq->flags); + if (async) + __set_bit(NETFS_RREQ_OFFLOAD_COLLECTION, &wreq->flags); /* Copy the data into the bounce buffer and encrypt it. */ // TODO @@ -105,13 +107,9 @@ ssize_t netfs_unbuffered_write_iter_locked(struct kiocb *iocb, struct iov_iter * if (!async) { trace_netfs_rreq(wreq, netfs_rreq_trace_wait_ip); - wait_on_bit(&wreq->flags, NETFS_RREQ_IN_PROGRESS, - TASK_UNINTERRUPTIBLE); - ret = wreq->error; - if (ret == 0) { - ret = wreq->transferred; + ret = netfs_wait_for_write(wreq); + if (ret > 0) iocb->ki_pos += ret; - } } else { ret = -EIOCBQUEUED; } |
