diff mbox series

[v2,2/7] fuse: Use the existing fuse_req in fuse_uring_commit

Message ID 20250125-optimize-fuse-uring-req-timeouts-v2-2-7771a2300343@ddn.com (mailing list archive)
State New
Headers show
Series fuse: {io-uring} Ensure fuse requests are set/read with locks | expand

Commit Message

Bernd Schubert Jan. 25, 2025, 5:43 p.m. UTC
fuse_uring_commit_fetch() has obtained a fuse_req and while holding
a lock - we can use that for fuse_uring_commit.

Fixes: 2981fcfd7af1 ("fuse: Add io-uring sqe commit and fetch support")
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
---
 fs/fuse/dev_uring.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Joanne Koong Jan. 27, 2025, 11:34 p.m. UTC | #1
On Sat, Jan 25, 2025 at 9:44 AM Bernd Schubert <bschubert@ddn.com> wrote:
>
> fuse_uring_commit_fetch() has obtained a fuse_req and while holding
> a lock - we can use that for fuse_uring_commit.
>
> Fixes: 2981fcfd7af1 ("fuse: Add io-uring sqe commit and fetch support")
> Signed-off-by: Bernd Schubert <bschubert@ddn.com>

Reviewed-by: Joanne Koong <joannelkoong@gmail.com>
> ---
>  fs/fuse/dev_uring.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
> index 2477bbdfcbab7cd27a513bbcf9b6ed69e90d2e72..3f2aef702694444cb3b817fd2f58b898a0af86bd 100644
> --- a/fs/fuse/dev_uring.c
> +++ b/fs/fuse/dev_uring.c
> @@ -796,12 +796,11 @@ static bool fuse_uring_ent_assign_req(struct fuse_ring_ent *ent)
>   * This is comparible with handling of classical write(/dev/fuse).
>   * Also make the ring request available again for new fuse requests.
>   */
> -static void fuse_uring_commit(struct fuse_ring_ent *ent,
> +static void fuse_uring_commit(struct fuse_ring_ent *ent, struct fuse_req *req,
>                               unsigned int issue_flags)
>  {
>         struct fuse_ring *ring = ent->queue->ring;
>         struct fuse_conn *fc = ring->fc;
> -       struct fuse_req *req = ent->fuse_req;
>         ssize_t err = 0;
>
>         err = copy_from_user(&req->out.h, &ent->headers->in_out,
> @@ -923,7 +922,7 @@ static int fuse_uring_commit_fetch(struct io_uring_cmd *cmd, int issue_flags,
>
>         /* without the queue lock, as other locks are taken */
>         fuse_uring_prepare_cancel(cmd, issue_flags, ent);
> -       fuse_uring_commit(ent, issue_flags);
> +       fuse_uring_commit(ent, req, issue_flags);
>
>         /*
>          * Fetching the next request is absolutely required as queued
>
> --
> 2.43.0
>
diff mbox series

Patch

diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
index 2477bbdfcbab7cd27a513bbcf9b6ed69e90d2e72..3f2aef702694444cb3b817fd2f58b898a0af86bd 100644
--- a/fs/fuse/dev_uring.c
+++ b/fs/fuse/dev_uring.c
@@ -796,12 +796,11 @@  static bool fuse_uring_ent_assign_req(struct fuse_ring_ent *ent)
  * This is comparible with handling of classical write(/dev/fuse).
  * Also make the ring request available again for new fuse requests.
  */
-static void fuse_uring_commit(struct fuse_ring_ent *ent,
+static void fuse_uring_commit(struct fuse_ring_ent *ent, struct fuse_req *req,
 			      unsigned int issue_flags)
 {
 	struct fuse_ring *ring = ent->queue->ring;
 	struct fuse_conn *fc = ring->fc;
-	struct fuse_req *req = ent->fuse_req;
 	ssize_t err = 0;
 
 	err = copy_from_user(&req->out.h, &ent->headers->in_out,
@@ -923,7 +922,7 @@  static int fuse_uring_commit_fetch(struct io_uring_cmd *cmd, int issue_flags,
 
 	/* without the queue lock, as other locks are taken */
 	fuse_uring_prepare_cancel(cmd, issue_flags, ent);
-	fuse_uring_commit(ent, issue_flags);
+	fuse_uring_commit(ent, req, issue_flags);
 
 	/*
 	 * Fetching the next request is absolutely required as queued