public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fuse: Send FORGET over io_uring when ring is ready
@ 2026-04-01 10:40 Li Wang
  2026-04-01 11:52 ` Bernd Schubert
  2026-04-05  2:26 ` kernel test robot
  0 siblings, 2 replies; 5+ messages in thread
From: Li Wang @ 2026-04-01 10:40 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: Bernd Schubert, linux-fsdevel, linux-kernel, Li Wang

Once the FUSE io_uring is registered and marked ready, most request
types are delivered through io_uring, while FORGET notifications were still
queued with fuse_dev_queue_forget() and only consumed through the legacy
path on /dev/fuse.

Deliver single FORGET operations through fuse_uring_queue_fuse_req() when
the ring is ready. Otherwise, fall back to fuse_dev_queue_forget()
so behavior matches the previous implementation.

Benefits:
- While io-uring is active, the daemon can handle forgets in the same
  commit/fetch loop as other opcodes instead of also draining a separate
  /dev/fuse read path for forget traffic.
- Reduces split-brain transport for high-volume forgets (eviction,
  unmount) when the ring is already the primary channel, which simplifies
  userspace and keeps teardown forgets on the same completion path as
  other uring-backed work.
- Reuses the same per-queue io-uring machinery and noreply/force request
  setup (creds, FR_WAITING/FR_FORCE, etc.) already used for similar
  kernel-initiated traffic.

Signed-off-by: Li Wang <liwang@kylinos.cn>
---
 fs/fuse/dev.c        | 84 ++++++++++++++++++++++++++++++++++++++++++++
 fs/fuse/dev_uring.c  |  2 +-
 fs/fuse/fuse_dev_i.h |  4 +++
 3 files changed, 89 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index b212565a78cf..f58abc80fd7b 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -665,6 +665,90 @@ static void fuse_args_to_req(struct fuse_req *req, struct fuse_args *args)
 		__set_bit(FR_ASYNC, &req->flags);
 }
 
+#ifdef CONFIG_FUSE_IO_URING
+struct fuse_forget_uring_data {
+	struct fuse_args args;
+	struct fuse_forget_in inarg;
+};
+
+static void fuse_forget_uring_free(struct fuse_mount *fm, struct fuse_args *args,
+				   int error)
+{
+	struct fuse_forget_uring_data *d =
+		container_of(args, struct fuse_forget_uring_data, args);
+
+	kfree(d);
+}
+
+/*
+ * Send FUSE_FORGET through the io-uring ring when active; same payload as
+ * fuse_read_single_forget(), with userspace committing like any other request.
+ */
+void fuse_io_uring_send_forget(struct fuse_iqueue *fiq,
+				struct fuse_forget_link *forget)
+{
+	struct fuse_conn *fc = container_of(fiq, struct fuse_conn, iq);
+	struct fuse_mount *fm;
+	struct fuse_req *req;
+	struct fuse_forget_uring_data *d;
+
+	if (!fuse_uring_ready(fc)) {
+		fuse_dev_queue_forget(fiq, forget);
+		return;
+	}
+
+	down_read(&fc->killsb);
+	if (list_empty(&fc->mounts)) {
+		up_read(&fc->killsb);
+		fuse_dev_queue_forget(fiq, forget);
+		return;
+	}
+	fm = list_first_entry(&fc->mounts, struct fuse_mount, fc_entry);
+	up_read(&fc->killsb);
+
+	d = kmalloc(sizeof(*d), GFP_KERNEL);
+	if (!d)
+		goto fallback;
+
+	atomic_inc(&fc->num_waiting);
+	req = fuse_request_alloc(fm, GFP_KERNEL);
+	if (!req) {
+		kfree(d);
+		fuse_drop_waiting(fc);
+		goto fallback;
+	}
+
+	memset(&d->args, 0, sizeof(d->args));
+	d->inarg.nlookup = forget->forget_one.nlookup;
+	d->args.opcode = FUSE_FORGET;
+	d->args.nodeid = forget->forget_one.nodeid;
+	d->args.in_numargs = 1;
+	d->args.in_args[0].size = sizeof(d->inarg);
+	d->args.in_args[0].value = &d->inarg;
+	d->args.force = true;
+	d->args.noreply = true;
+	d->args.end = fuse_forget_uring_free;
+
+	kfree(forget);
+
+	fuse_force_creds(req);
+	__set_bit(FR_WAITING, &req->flags);
+	if (!d->args.abort_on_kill)
+		__set_bit(FR_FORCE, &req->flags);
+	fuse_adjust_compat(fc, &d->args);
+	fuse_args_to_req(req, &d->args);
+	req->in.h.len = sizeof(struct fuse_in_header) +
+		fuse_len_args(req->args->in_numargs,
+			      (struct fuse_arg *)req->args->in_args);
+
+	fuse_uring_queue_fuse_req(fiq, req);
+	return;
+
+fallback:
+	fuse_dev_queue_forget(fiq, forget);
+}
+#endif
+
 ssize_t __fuse_simple_request(struct mnt_idmap *idmap,
 			      struct fuse_mount *fm,
 			      struct fuse_args *args)
diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
index 7b9822e8837b..a96539ea400a 100644
--- a/fs/fuse/dev_uring.c
+++ b/fs/fuse/dev_uring.c
@@ -1360,7 +1360,7 @@ bool fuse_uring_remove_pending_req(struct fuse_req *req)
 
 static const struct fuse_iqueue_ops fuse_io_uring_ops = {
 	/* should be send over io-uring as enhancement */
-	.send_forget = fuse_dev_queue_forget,
+	.send_forget = fuse_io_uring_send_forget,
 
 	/*
 	 * could be send over io-uring, but interrupts should be rare,
diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h
index 134bf44aff0d..264a25d7e47a 100644
--- a/fs/fuse/fuse_dev_i.h
+++ b/fs/fuse/fuse_dev_i.h
@@ -70,6 +70,10 @@ int fuse_copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args,
 		       unsigned int nbytes);
 void fuse_dev_queue_forget(struct fuse_iqueue *fiq,
 			   struct fuse_forget_link *forget);
+#ifdef CONFIG_FUSE_IO_URING
+void fuse_io_uring_send_forget(struct fuse_iqueue *fiq,
+			       struct fuse_forget_link *forget);
+#endif
 void fuse_dev_queue_interrupt(struct fuse_iqueue *fiq, struct fuse_req *req);
 bool fuse_remove_pending_req(struct fuse_req *req, spinlock_t *lock);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] fuse: Send FORGET over io_uring when ring is ready
  2026-04-01 10:40 [PATCH] fuse: Send FORGET over io_uring when ring is ready Li Wang
@ 2026-04-01 11:52 ` Bernd Schubert
  2026-04-01 13:41   ` Horst Birthelmer
  2026-04-05  2:26 ` kernel test robot
  1 sibling, 1 reply; 5+ messages in thread
From: Bernd Schubert @ 2026-04-01 11:52 UTC (permalink / raw)
  To: Li Wang, Miklos Szeredi; +Cc: linux-fsdevel, linux-kernel



On 4/1/26 10:40, Li Wang wrote:
> Once the FUSE io_uring is registered and marked ready, most request
> types are delivered through io_uring, while FORGET notifications were still
> queued with fuse_dev_queue_forget() and only consumed through the legacy
> path on /dev/fuse.
> 
> Deliver single FORGET operations through fuse_uring_queue_fuse_req() when
> the ring is ready. Otherwise, fall back to fuse_dev_queue_forget()
> so behavior matches the previous implementation.
> 
> Benefits:
> - While io-uring is active, the daemon can handle forgets in the same
>   commit/fetch loop as other opcodes instead of also draining a separate
>   /dev/fuse read path for forget traffic.
> - Reduces split-brain transport for high-volume forgets (eviction,
>   unmount) when the ring is already the primary channel, which simplifies
>   userspace and keeps teardown forgets on the same completion path as
>   other uring-backed work.
> - Reuses the same per-queue io-uring machinery and noreply/force request
>   setup (creds, FR_WAITING/FR_FORCE, etc.) already used for similar
>   kernel-initiated traffic.
> 
> Signed-off-by: Li Wang <liwang@kylinos.cn>
> ---
>  fs/fuse/dev.c        | 84 ++++++++++++++++++++++++++++++++++++++++++++
>  fs/fuse/dev_uring.c  |  2 +-
>  fs/fuse/fuse_dev_i.h |  4 +++
>  3 files changed, 89 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
> index b212565a78cf..f58abc80fd7b 100644
> --- a/fs/fuse/dev.c
> +++ b/fs/fuse/dev.c
> @@ -665,6 +665,90 @@ static void fuse_args_to_req(struct fuse_req *req, struct fuse_args *args)
>  		__set_bit(FR_ASYNC, &req->flags);
>  }
>  
> +#ifdef CONFIG_FUSE_IO_URING
> +struct fuse_forget_uring_data {
> +	struct fuse_args args;
> +	struct fuse_forget_in inarg;
> +};
> +
> +static void fuse_forget_uring_free(struct fuse_mount *fm, struct fuse_args *args,
> +				   int error)
> +{
> +	struct fuse_forget_uring_data *d =
> +		container_of(args, struct fuse_forget_uring_data, args);
> +
> +	kfree(d);
> +}
> +
> +/*
> + * Send FUSE_FORGET through the io-uring ring when active; same payload as
> + * fuse_read_single_forget(), with userspace committing like any other request.
> + */
> +void fuse_io_uring_send_forget(struct fuse_iqueue *fiq,
> +				struct fuse_forget_link *forget)
> +{
> +	struct fuse_conn *fc = container_of(fiq, struct fuse_conn, iq);
> +	struct fuse_mount *fm;
> +	struct fuse_req *req;
> +	struct fuse_forget_uring_data *d;
> +
> +	if (!fuse_uring_ready(fc)) {
> +		fuse_dev_queue_forget(fiq, forget);
> +		return;
> +	}
> +
> +	down_read(&fc->killsb);
> +	if (list_empty(&fc->mounts)) {
> +		up_read(&fc->killsb);
> +		fuse_dev_queue_forget(fiq, forget);
> +		return;
> +	}
> +	fm = list_first_entry(&fc->mounts, struct fuse_mount, fc_entry);
> +	up_read(&fc->killsb);
> +
> +	d = kmalloc(sizeof(*d), GFP_KERNEL);
> +	if (!d)
> +		goto fallback;
> +
> +	atomic_inc(&fc->num_waiting);
> +	req = fuse_request_alloc(fm, GFP_KERNEL);
> +	if (!req) {
> +		kfree(d);
> +		fuse_drop_waiting(fc);
> +		goto fallback;
> +	}
> +
> +	memset(&d->args, 0, sizeof(d->args));
> +	d->inarg.nlookup = forget->forget_one.nlookup;
> +	d->args.opcode = FUSE_FORGET;
> +	d->args.nodeid = forget->forget_one.nodeid;
> +	d->args.in_numargs = 1;
> +	d->args.in_args[0].size = sizeof(d->inarg);
> +	d->args.in_args[0].value = &d->inarg;
> +	d->args.force = true;
> +	d->args.noreply = true;
> +	d->args.end = fuse_forget_uring_free;
> +
> +	kfree(forget);
> +
> +	fuse_force_creds(req);
> +	__set_bit(FR_WAITING, &req->flags);
> +	if (!d->args.abort_on_kill)
> +		__set_bit(FR_FORCE, &req->flags);
> +	fuse_adjust_compat(fc, &d->args);
> +	fuse_args_to_req(req, &d->args);
> +	req->in.h.len = sizeof(struct fuse_in_header) +
> +		fuse_len_args(req->args->in_numargs,
> +			      (struct fuse_arg *)req->args->in_args);
> +
> +	fuse_uring_queue_fuse_req(fiq, req);
> +	return;
> +
> +fallback:
> +	fuse_dev_queue_forget(fiq, forget);
> +}
> +#endif
> +
>  ssize_t __fuse_simple_request(struct mnt_idmap *idmap,
>  			      struct fuse_mount *fm,
>  			      struct fuse_args *args)
> diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
> index 7b9822e8837b..a96539ea400a 100644
> --- a/fs/fuse/dev_uring.c
> +++ b/fs/fuse/dev_uring.c
> @@ -1360,7 +1360,7 @@ bool fuse_uring_remove_pending_req(struct fuse_req *req)
>  
>  static const struct fuse_iqueue_ops fuse_io_uring_ops = {
>  	/* should be send over io-uring as enhancement */
> -	.send_forget = fuse_dev_queue_forget,
> +	.send_forget = fuse_io_uring_send_forget,

I will check the other parts more thoroughly in the evening, but please
take a look into fuse_uring_register(), it also also overrides other
pointers at startup - I would like leave it here as it is, move the
function above into dev_uring.c and then update this part in dev_uring.c

static const struct fuse_iqueue_ops fuse_io_uring_ops = {
        /* should be send over io-uring as enhancement */
        .send_forget = fuse_dev_queue_forget,


Thanks,
Bernd

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [PATCH] fuse: Send FORGET over io_uring when ring is ready
  2026-04-01 11:52 ` Bernd Schubert
@ 2026-04-01 13:41   ` Horst Birthelmer
  2026-04-01 16:59     ` Bernd Schubert
  0 siblings, 1 reply; 5+ messages in thread
From: Horst Birthelmer @ 2026-04-01 13:41 UTC (permalink / raw)
  To: Bernd Schubert; +Cc: Li Wang, Miklos Szeredi, linux-fsdevel, linux-kernel

On Wed, Apr 01, 2026 at 11:52:28AM +0000, Bernd Schubert wrote:
> 
> 
> On 4/1/26 10:40, Li Wang wrote:
> > Once the FUSE io_uring is registered and marked ready, most request
> > types are delivered through io_uring, while FORGET notifications were still
> > queued with fuse_dev_queue_forget() and only consumed through the legacy
> > path on /dev/fuse.
> > 
> > Deliver single FORGET operations through fuse_uring_queue_fuse_req() when
> > the ring is ready. Otherwise, fall back to fuse_dev_queue_forget()
> > so behavior matches the previous implementation.
> > 
> > Benefits:
> > - While io-uring is active, the daemon can handle forgets in the same
> >   commit/fetch loop as other opcodes instead of also draining a separate
> >   /dev/fuse read path for forget traffic.
> > - Reduces split-brain transport for high-volume forgets (eviction,
> >   unmount) when the ring is already the primary channel, which simplifies
> >   userspace and keeps teardown forgets on the same completion path as
> >   other uring-backed work.
> > - Reuses the same per-queue io-uring machinery and noreply/force request
> >   setup (creds, FR_WAITING/FR_FORCE, etc.) already used for similar
> >   kernel-initiated traffic.
> > 
> > Signed-off-by: Li Wang <liwang@kylinos.cn>
> > ---
> >  fs/fuse/dev.c        | 84 ++++++++++++++++++++++++++++++++++++++++++++
> >  fs/fuse/dev_uring.c  |  2 +-
> >  fs/fuse/fuse_dev_i.h |  4 +++
> >  3 files changed, 89 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
> > index b212565a78cf..f58abc80fd7b 100644
> > --- a/fs/fuse/dev.c
> > +++ b/fs/fuse/dev.c
> > @@ -665,6 +665,90 @@ static void fuse_args_to_req(struct fuse_req *req, struct fuse_args *args)
> >  		__set_bit(FR_ASYNC, &req->flags);
> >  }
> >  
> > +#ifdef CONFIG_FUSE_IO_URING
> > +struct fuse_forget_uring_data {
> > +	struct fuse_args args;
> > +	struct fuse_forget_in inarg;
> > +};
> > +
> > +static void fuse_forget_uring_free(struct fuse_mount *fm, struct fuse_args *args,
> > +				   int error)
> > +{
> > +	struct fuse_forget_uring_data *d =
> > +		container_of(args, struct fuse_forget_uring_data, args);
> > +
> > +	kfree(d);
> > +}
> > +
> > +/*
> > + * Send FUSE_FORGET through the io-uring ring when active; same payload as
> > + * fuse_read_single_forget(), with userspace committing like any other request.
> > + */
> > +void fuse_io_uring_send_forget(struct fuse_iqueue *fiq,
> > +				struct fuse_forget_link *forget)
> > +{
> > +	struct fuse_conn *fc = container_of(fiq, struct fuse_conn, iq);
> > +	struct fuse_mount *fm;
> > +	struct fuse_req *req;
> > +	struct fuse_forget_uring_data *d;
> > +
> > +	if (!fuse_uring_ready(fc)) {
> > +		fuse_dev_queue_forget(fiq, forget);
> > +		return;
> > +	}
> > +
> > +	down_read(&fc->killsb);
> > +	if (list_empty(&fc->mounts)) {
> > +		up_read(&fc->killsb);
> > +		fuse_dev_queue_forget(fiq, forget);
> > +		return;
> > +	}
> > +	fm = list_first_entry(&fc->mounts, struct fuse_mount, fc_entry);
> > +	up_read(&fc->killsb);
> > +
> > +	d = kmalloc(sizeof(*d), GFP_KERNEL);
> > +	if (!d)
> > +		goto fallback;
> > +
> > +	atomic_inc(&fc->num_waiting);
> > +	req = fuse_request_alloc(fm, GFP_KERNEL);
> > +	if (!req) {
> > +		kfree(d);
> > +		fuse_drop_waiting(fc);
> > +		goto fallback;
> > +	}
> > +
> > +	memset(&d->args, 0, sizeof(d->args));
> > +	d->inarg.nlookup = forget->forget_one.nlookup;
> > +	d->args.opcode = FUSE_FORGET;
> > +	d->args.nodeid = forget->forget_one.nodeid;
> > +	d->args.in_numargs = 1;
> > +	d->args.in_args[0].size = sizeof(d->inarg);
> > +	d->args.in_args[0].value = &d->inarg;
> > +	d->args.force = true;
> > +	d->args.noreply = true;
> > +	d->args.end = fuse_forget_uring_free;
> > +
> > +	kfree(forget);
> > +
> > +	fuse_force_creds(req);
> > +	__set_bit(FR_WAITING, &req->flags);
> > +	if (!d->args.abort_on_kill)
> > +		__set_bit(FR_FORCE, &req->flags);
> > +	fuse_adjust_compat(fc, &d->args);
> > +	fuse_args_to_req(req, &d->args);
> > +	req->in.h.len = sizeof(struct fuse_in_header) +
> > +		fuse_len_args(req->args->in_numargs,
> > +			      (struct fuse_arg *)req->args->in_args);
> > +
> > +	fuse_uring_queue_fuse_req(fiq, req);
> > +	return;
> > +
> > +fallback:
> > +	fuse_dev_queue_forget(fiq, forget);
> > +}
> > +#endif
> > +
> >  ssize_t __fuse_simple_request(struct mnt_idmap *idmap,
> >  			      struct fuse_mount *fm,
> >  			      struct fuse_args *args)
> > diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
> > index 7b9822e8837b..a96539ea400a 100644
> > --- a/fs/fuse/dev_uring.c
> > +++ b/fs/fuse/dev_uring.c
> > @@ -1360,7 +1360,7 @@ bool fuse_uring_remove_pending_req(struct fuse_req *req)
> >  
> >  static const struct fuse_iqueue_ops fuse_io_uring_ops = {
> >  	/* should be send over io-uring as enhancement */
> > -	.send_forget = fuse_dev_queue_forget,
> > +	.send_forget = fuse_io_uring_send_forget,
> 
> I will check the other parts more thoroughly in the evening, but please
> take a look into fuse_uring_register(), it also also overrides other
> pointers at startup - I would like leave it here as it is, move the
> function above into dev_uring.c and then update this part in dev_uring.c
> 
> static const struct fuse_iqueue_ops fuse_io_uring_ops = {
>         /* should be send over io-uring as enhancement */
>         .send_forget = fuse_dev_queue_forget,

Hi Bernd,

I have never asked the question before, but now I'm a bit intrigued ...
Why wasn't this not done before? Was it a performance thing?

thanks,
Horst

> 
> 
> Thanks,
> Bernd
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fuse: Send FORGET over io_uring when ring is ready
  2026-04-01 13:41   ` Horst Birthelmer
@ 2026-04-01 16:59     ` Bernd Schubert
  0 siblings, 0 replies; 5+ messages in thread
From: Bernd Schubert @ 2026-04-01 16:59 UTC (permalink / raw)
  To: Horst Birthelmer; +Cc: Li Wang, Miklos Szeredi, linux-fsdevel, linux-kernel



On 4/1/26 15:41, Horst Birthelmer wrote:
> On Wed, Apr 01, 2026 at 11:52:28AM +0000, Bernd Schubert wrote:
>>
>>
>> On 4/1/26 10:40, Li Wang wrote:
>>> Once the FUSE io_uring is registered and marked ready, most request
>>> types are delivered through io_uring, while FORGET notifications were still
>>> queued with fuse_dev_queue_forget() and only consumed through the legacy
>>> path on /dev/fuse.
>>>
>>> Deliver single FORGET operations through fuse_uring_queue_fuse_req() when
>>> the ring is ready. Otherwise, fall back to fuse_dev_queue_forget()
>>> so behavior matches the previous implementation.
>>>
>>> Benefits:
>>> - While io-uring is active, the daemon can handle forgets in the same
>>>   commit/fetch loop as other opcodes instead of also draining a separate
>>>   /dev/fuse read path for forget traffic.
>>> - Reduces split-brain transport for high-volume forgets (eviction,
>>>   unmount) when the ring is already the primary channel, which simplifies
>>>   userspace and keeps teardown forgets on the same completion path as
>>>   other uring-backed work.
>>> - Reuses the same per-queue io-uring machinery and noreply/force request
>>>   setup (creds, FR_WAITING/FR_FORCE, etc.) already used for similar
>>>   kernel-initiated traffic.
>>>
>>> Signed-off-by: Li Wang <liwang@kylinos.cn>
>>> ---
>>>  fs/fuse/dev.c        | 84 ++++++++++++++++++++++++++++++++++++++++++++
>>>  fs/fuse/dev_uring.c  |  2 +-
>>>  fs/fuse/fuse_dev_i.h |  4 +++
>>>  3 files changed, 89 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
>>> index b212565a78cf..f58abc80fd7b 100644
>>> --- a/fs/fuse/dev.c
>>> +++ b/fs/fuse/dev.c
>>> @@ -665,6 +665,90 @@ static void fuse_args_to_req(struct fuse_req *req, struct fuse_args *args)
>>>  		__set_bit(FR_ASYNC, &req->flags);
>>>  }
>>>  
>>> +#ifdef CONFIG_FUSE_IO_URING
>>> +struct fuse_forget_uring_data {
>>> +	struct fuse_args args;
>>> +	struct fuse_forget_in inarg;
>>> +};
>>> +
>>> +static void fuse_forget_uring_free(struct fuse_mount *fm, struct fuse_args *args,
>>> +				   int error)
>>> +{
>>> +	struct fuse_forget_uring_data *d =
>>> +		container_of(args, struct fuse_forget_uring_data, args);
>>> +
>>> +	kfree(d);
>>> +}
>>> +
>>> +/*
>>> + * Send FUSE_FORGET through the io-uring ring when active; same payload as
>>> + * fuse_read_single_forget(), with userspace committing like any other request.
>>> + */
>>> +void fuse_io_uring_send_forget(struct fuse_iqueue *fiq,
>>> +				struct fuse_forget_link *forget)
>>> +{
>>> +	struct fuse_conn *fc = container_of(fiq, struct fuse_conn, iq);
>>> +	struct fuse_mount *fm;
>>> +	struct fuse_req *req;
>>> +	struct fuse_forget_uring_data *d;
>>> +
>>> +	if (!fuse_uring_ready(fc)) {
>>> +		fuse_dev_queue_forget(fiq, forget);
>>> +		return;
>>> +	}
>>> +
>>> +	down_read(&fc->killsb);
>>> +	if (list_empty(&fc->mounts)) {
>>> +		up_read(&fc->killsb);
>>> +		fuse_dev_queue_forget(fiq, forget);
>>> +		return;
>>> +	}
>>> +	fm = list_first_entry(&fc->mounts, struct fuse_mount, fc_entry);
>>> +	up_read(&fc->killsb);
>>> +
>>> +	d = kmalloc(sizeof(*d), GFP_KERNEL);
>>> +	if (!d)
>>> +		goto fallback;
>>> +
>>> +	atomic_inc(&fc->num_waiting);
>>> +	req = fuse_request_alloc(fm, GFP_KERNEL);
>>> +	if (!req) {
>>> +		kfree(d);
>>> +		fuse_drop_waiting(fc);
>>> +		goto fallback;
>>> +	}
>>> +
>>> +	memset(&d->args, 0, sizeof(d->args));
>>> +	d->inarg.nlookup = forget->forget_one.nlookup;
>>> +	d->args.opcode = FUSE_FORGET;
>>> +	d->args.nodeid = forget->forget_one.nodeid;
>>> +	d->args.in_numargs = 1;
>>> +	d->args.in_args[0].size = sizeof(d->inarg);
>>> +	d->args.in_args[0].value = &d->inarg;
>>> +	d->args.force = true;
>>> +	d->args.noreply = true;
>>> +	d->args.end = fuse_forget_uring_free;
>>> +
>>> +	kfree(forget);
>>> +
>>> +	fuse_force_creds(req);
>>> +	__set_bit(FR_WAITING, &req->flags);
>>> +	if (!d->args.abort_on_kill)
>>> +		__set_bit(FR_FORCE, &req->flags);
>>> +	fuse_adjust_compat(fc, &d->args);
>>> +	fuse_args_to_req(req, &d->args);
>>> +	req->in.h.len = sizeof(struct fuse_in_header) +
>>> +		fuse_len_args(req->args->in_numargs,
>>> +			      (struct fuse_arg *)req->args->in_args);
>>> +
>>> +	fuse_uring_queue_fuse_req(fiq, req);
>>> +	return;
>>> +
>>> +fallback:
>>> +	fuse_dev_queue_forget(fiq, forget);
>>> +}
>>> +#endif
>>> +
>>>  ssize_t __fuse_simple_request(struct mnt_idmap *idmap,
>>>  			      struct fuse_mount *fm,
>>>  			      struct fuse_args *args)
>>> diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
>>> index 7b9822e8837b..a96539ea400a 100644
>>> --- a/fs/fuse/dev_uring.c
>>> +++ b/fs/fuse/dev_uring.c
>>> @@ -1360,7 +1360,7 @@ bool fuse_uring_remove_pending_req(struct fuse_req *req)
>>>  
>>>  static const struct fuse_iqueue_ops fuse_io_uring_ops = {
>>>  	/* should be send over io-uring as enhancement */
>>> -	.send_forget = fuse_dev_queue_forget,
>>> +	.send_forget = fuse_io_uring_send_forget,
>>
>> I will check the other parts more thoroughly in the evening, but please
>> take a look into fuse_uring_register(), it also also overrides other
>> pointers at startup - I would like leave it here as it is, move the
>> function above into dev_uring.c and then update this part in dev_uring.c
>>
>> static const struct fuse_iqueue_ops fuse_io_uring_ops = {
>>         /* should be send over io-uring as enhancement */
>>         .send_forget = fuse_dev_queue_forget,
> 
> Hi Bernd,
> 
> I have never asked the question before, but now I'm a bit intrigued ...
> Why wasn't this not done before? Was it a performance thing?

Hi Horst,

never had a priority for me - I didn't consider it performance relevant.


Cheers,
Bernd

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fuse: Send FORGET over io_uring when ring is ready
  2026-04-01 10:40 [PATCH] fuse: Send FORGET over io_uring when ring is ready Li Wang
  2026-04-01 11:52 ` Bernd Schubert
@ 2026-04-05  2:26 ` kernel test robot
  1 sibling, 0 replies; 5+ messages in thread
From: kernel test robot @ 2026-04-05  2:26 UTC (permalink / raw)
  To: Li Wang, Miklos Szeredi
  Cc: llvm, oe-kbuild-all, Bernd Schubert, linux-fsdevel, linux-kernel,
	Li Wang

Hi Li,

kernel test robot noticed the following build errors:

[auto build test ERROR on v7.0-rc6]
[also build test ERROR on linus/master]
[cannot apply to mszeredi-fuse/for-next next-20260403]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Li-Wang/fuse-Send-FORGET-over-io_uring-when-ring-is-ready/20260405-064557
base:   v7.0-rc6
patch link:    https://lore.kernel.org/r/20260401104008.8827-1-liwang%40kylinos.cn
patch subject: [PATCH] fuse: Send FORGET over io_uring when ring is ready
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260405/202604050417.m1KBL3ur-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260405/202604050417.m1KBL3ur-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604050417.m1KBL3ur-lkp@intel.com/

All errors (new ones prefixed by >>):

>> fs/fuse/dev.c:731:15: error: no member named 'abort_on_kill' in 'struct fuse_args'
     731 |         if (!d->args.abort_on_kill)
         |              ~~~~~~~ ^
   1 error generated.


vim +731 fs/fuse/dev.c

   677	
   678	/*
   679	 * Send FUSE_FORGET through the io-uring ring when active; same payload as
   680	 * fuse_read_single_forget(), with userspace committing like any other request.
   681	 */
   682	void fuse_io_uring_send_forget(struct fuse_iqueue *fiq,
   683					struct fuse_forget_link *forget)
   684	{
   685		struct fuse_conn *fc = container_of(fiq, struct fuse_conn, iq);
   686		struct fuse_mount *fm;
   687		struct fuse_req *req;
   688		struct fuse_forget_uring_data *d;
   689	
   690		if (!fuse_uring_ready(fc)) {
   691			fuse_dev_queue_forget(fiq, forget);
   692			return;
   693		}
   694	
   695		down_read(&fc->killsb);
   696		if (list_empty(&fc->mounts)) {
   697			up_read(&fc->killsb);
   698			fuse_dev_queue_forget(fiq, forget);
   699			return;
   700		}
   701		fm = list_first_entry(&fc->mounts, struct fuse_mount, fc_entry);
   702		up_read(&fc->killsb);
   703	
   704		d = kmalloc(sizeof(*d), GFP_KERNEL);
   705		if (!d)
   706			goto fallback;
   707	
   708		atomic_inc(&fc->num_waiting);
   709		req = fuse_request_alloc(fm, GFP_KERNEL);
   710		if (!req) {
   711			kfree(d);
   712			fuse_drop_waiting(fc);
   713			goto fallback;
   714		}
   715	
   716		memset(&d->args, 0, sizeof(d->args));
   717		d->inarg.nlookup = forget->forget_one.nlookup;
   718		d->args.opcode = FUSE_FORGET;
   719		d->args.nodeid = forget->forget_one.nodeid;
   720		d->args.in_numargs = 1;
   721		d->args.in_args[0].size = sizeof(d->inarg);
   722		d->args.in_args[0].value = &d->inarg;
   723		d->args.force = true;
   724		d->args.noreply = true;
   725		d->args.end = fuse_forget_uring_free;
   726	
   727		kfree(forget);
   728	
   729		fuse_force_creds(req);
   730		__set_bit(FR_WAITING, &req->flags);
 > 731		if (!d->args.abort_on_kill)
   732			__set_bit(FR_FORCE, &req->flags);
   733		fuse_adjust_compat(fc, &d->args);
   734		fuse_args_to_req(req, &d->args);
   735		req->in.h.len = sizeof(struct fuse_in_header) +
   736			fuse_len_args(req->args->in_numargs,
   737				      (struct fuse_arg *)req->args->in_args);
   738	
   739		fuse_uring_queue_fuse_req(fiq, req);
   740		return;
   741	
   742	fallback:
   743		fuse_dev_queue_forget(fiq, forget);
   744	}
   745	#endif
   746	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-04-05  2:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-01 10:40 [PATCH] fuse: Send FORGET over io_uring when ring is ready Li Wang
2026-04-01 11:52 ` Bernd Schubert
2026-04-01 13:41   ` Horst Birthelmer
2026-04-01 16:59     ` Bernd Schubert
2026-04-05  2:26 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox