public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fuse: rename confusing ring->max_payload_sz
@ 2026-03-05 12:35 Li Wang
  2026-03-10 16:31 ` Bernd Schubert
  0 siblings, 1 reply; 3+ messages in thread
From: Li Wang @ 2026-03-05 12:35 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-fsdevel, Li Wang

In the fuse_uring_create_ring_ent function of dev_uring.c,
when payload_size < ring->max_payload_sz, it reports an error,
which is confusing because  ring->max_payload_sz feels like
it should represent the allowed upper limit. Therefore, rename it
to indicate the maximum possible payload size of the fuse requests.

Signed-off-by: Li Wang <liwang@kylinos.cn>
---
 fs/fuse/dev_uring.c   | 14 +++++++-------
 fs/fuse/dev_uring_i.h |  4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
index 3a38b61aac26..9afa0c7cf92a 100644
--- a/fs/fuse/dev_uring.c
+++ b/fs/fuse/dev_uring.c
@@ -229,7 +229,7 @@ static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc)
 	struct fuse_ring *ring;
 	size_t nr_queues = num_possible_cpus();
 	struct fuse_ring *res = NULL;
-	size_t max_payload_size;
+	size_t max_req_payload_size;
 
 	ring = kzalloc_obj(*fc->ring, GFP_KERNEL_ACCOUNT);
 	if (!ring)
@@ -240,8 +240,8 @@ static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc)
 	if (!ring->queues)
 		goto out_err;
 
-	max_payload_size = max(FUSE_MIN_READ_BUFFER, fc->max_write);
-	max_payload_size = max(max_payload_size, fc->max_pages * PAGE_SIZE);
+	max_req_payload_size = max(FUSE_MIN_READ_BUFFER, fc->max_write);
+	max_req_payload_size = max(max_req_payload_size, fc->max_pages * PAGE_SIZE);
 
 	spin_lock(&fc->lock);
 	if (fc->ring) {
@@ -255,7 +255,7 @@ static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc)
 
 	ring->nr_queues = nr_queues;
 	ring->fc = fc;
-	ring->max_payload_sz = max_payload_size;
+	ring->max_req_payload_sz = max_req_payload_size;
 	smp_store_release(&fc->ring, ring);
 
 	spin_unlock(&fc->lock);
@@ -590,7 +590,7 @@ static int fuse_uring_copy_from_ring(struct fuse_ring *ring,
 	if (err)
 		return -EFAULT;
 
-	err = import_ubuf(ITER_SOURCE, ent->payload, ring->max_payload_sz,
+	err = import_ubuf(ITER_SOURCE, ent->payload, ring->max_req_payload_sz,
 			  &iter);
 	if (err)
 		return err;
@@ -621,7 +621,7 @@ static int fuse_uring_args_to_ring(struct fuse_ring *ring, struct fuse_req *req,
 		.commit_id = req->in.h.unique,
 	};
 
-	err = import_ubuf(ITER_DEST, ent->payload, ring->max_payload_sz, &iter);
+	err = import_ubuf(ITER_DEST, ent->payload, ring->max_req_payload_sz, &iter);
 	if (err) {
 		pr_info_ratelimited("fuse: Import of user buffer failed\n");
 		return err;
@@ -1056,7 +1056,7 @@ fuse_uring_create_ring_ent(struct io_uring_cmd *cmd,
 	}
 
 	payload_size = iov[1].iov_len;
-	if (payload_size < ring->max_payload_sz) {
+	if (payload_size < ring->max_req_payload_sz) {
 		pr_info_ratelimited("Invalid req payload len %zu\n",
 				    payload_size);
 		return ERR_PTR(err);
diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h
index 51a563922ce1..544f7afb3866 100644
--- a/fs/fuse/dev_uring_i.h
+++ b/fs/fuse/dev_uring_i.h
@@ -112,8 +112,8 @@ struct fuse_ring {
 	/* number of ring queues */
 	size_t nr_queues;
 
-	/* maximum payload/arg size */
-	size_t max_payload_sz;
+	/* maximum request payload/arg size */
+	size_t max_req_payload_sz;
 
 	struct fuse_ring_queue **queues;
 
-- 
2.34.1


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

* Re: [PATCH] fuse: rename confusing ring->max_payload_sz
  2026-03-05 12:35 [PATCH] fuse: rename confusing ring->max_payload_sz Li Wang
@ 2026-03-10 16:31 ` Bernd Schubert
  2026-03-17  8:12   ` Li Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Bernd Schubert @ 2026-03-10 16:31 UTC (permalink / raw)
  To: Li Wang, Miklos Szeredi; +Cc: linux-fsdevel



On 3/5/26 13:35, Li Wang wrote:
> In the fuse_uring_create_ring_ent function of dev_uring.c,
> when payload_size < ring->max_payload_sz, it reports an error,
> which is confusing because  ring->max_payload_sz feels like
> it should represent the allowed upper limit. Therefore, rename it
> to indicate the maximum possible payload size of the fuse requests.
> 
> Signed-off-by: Li Wang <liwang@kylinos.cn>
> ---
>  fs/fuse/dev_uring.c   | 14 +++++++-------
>  fs/fuse/dev_uring_i.h |  4 ++--
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
> index 3a38b61aac26..9afa0c7cf92a 100644
> --- a/fs/fuse/dev_uring.c
> +++ b/fs/fuse/dev_uring.c
> @@ -229,7 +229,7 @@ static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc)
>  	struct fuse_ring *ring;
>  	size_t nr_queues = num_possible_cpus();
>  	struct fuse_ring *res = NULL;
> -	size_t max_payload_size;
> +	size_t max_req_payload_size;
>  
>  	ring = kzalloc_obj(*fc->ring, GFP_KERNEL_ACCOUNT);
>  	if (!ring)
> @@ -240,8 +240,8 @@ static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc)
>  	if (!ring->queues)
>  		goto out_err;
>  
> -	max_payload_size = max(FUSE_MIN_READ_BUFFER, fc->max_write);
> -	max_payload_size = max(max_payload_size, fc->max_pages * PAGE_SIZE);
> +	max_req_payload_size = max(FUSE_MIN_READ_BUFFER, fc->max_write);
> +	max_req_payload_size = max(max_req_payload_size, fc->max_pages * PAGE_SIZE);
>  
>  	spin_lock(&fc->lock);
>  	if (fc->ring) {
> @@ -255,7 +255,7 @@ static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc)
>  
>  	ring->nr_queues = nr_queues;
>  	ring->fc = fc;
> -	ring->max_payload_sz = max_payload_size;
> +	ring->max_req_payload_sz = max_req_payload_size;
>  	smp_store_release(&fc->ring, ring);
>  
>  	spin_unlock(&fc->lock);
> @@ -590,7 +590,7 @@ static int fuse_uring_copy_from_ring(struct fuse_ring *ring,
>  	if (err)
>  		return -EFAULT;
>  
> -	err = import_ubuf(ITER_SOURCE, ent->payload, ring->max_payload_sz,
> +	err = import_ubuf(ITER_SOURCE, ent->payload, ring->max_req_payload_sz,
>  			  &iter);
>  	if (err)
>  		return err;
> @@ -621,7 +621,7 @@ static int fuse_uring_args_to_ring(struct fuse_ring *ring, struct fuse_req *req,
>  		.commit_id = req->in.h.unique,
>  	};
>  
> -	err = import_ubuf(ITER_DEST, ent->payload, ring->max_payload_sz, &iter);
> +	err = import_ubuf(ITER_DEST, ent->payload, ring->max_req_payload_sz, &iter);
>  	if (err) {
>  		pr_info_ratelimited("fuse: Import of user buffer failed\n");
>  		return err;
> @@ -1056,7 +1056,7 @@ fuse_uring_create_ring_ent(struct io_uring_cmd *cmd,
>  	}
>  
>  	payload_size = iov[1].iov_len;
> -	if (payload_size < ring->max_payload_sz) {
> +	if (payload_size < ring->max_req_payload_sz) {
>  		pr_info_ratelimited("Invalid req payload len %zu\n",
>  				    payload_size);
>  		return ERR_PTR(err);
> diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h
> index 51a563922ce1..544f7afb3866 100644
> --- a/fs/fuse/dev_uring_i.h
> +++ b/fs/fuse/dev_uring_i.h
> @@ -112,8 +112,8 @@ struct fuse_ring {
>  	/* number of ring queues */
>  	size_t nr_queues;
>  
> -	/* maximum payload/arg size */
> -	size_t max_payload_sz;
> +	/* maximum request payload/arg size */
> +	size_t max_req_payload_sz;
>  
>  	struct fuse_ring_queue **queues;
>  

I don't have a strong opinion here, wouldn't be sufficient to update the
comment?


Thanks,
Bernd


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

* Re: [PATCH] fuse: rename confusing ring->max_payload_sz
  2026-03-10 16:31 ` Bernd Schubert
@ 2026-03-17  8:12   ` Li Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Li Wang @ 2026-03-17  8:12 UTC (permalink / raw)
  To: Bernd Schubert, Miklos Szeredi; +Cc: linux-fsdevel

Hi Bernd,

On 11/03/2026 00:31, Bernd Schubert wrote:
> 
> 
> On 3/5/26 13:35, Li Wang wrote:
>> In the fuse_uring_create_ring_ent function of dev_uring.c,
>> when payload_size < ring->max_payload_sz, it reports an error,
>> which is confusing because  ring->max_payload_sz feels like
>> it should represent the allowed upper limit. Therefore, rename it
>> to indicate the maximum possible payload size of the fuse requests.
>>
>> Signed-off-by: Li Wang <liwang@kylinos.cn>
>> ---
>>  fs/fuse/dev_uring.c   | 14 +++++++-------
>>  fs/fuse/dev_uring_i.h |  4 ++--
>>  2 files changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
>> index 3a38b61aac26..9afa0c7cf92a 100644
>> --- a/fs/fuse/dev_uring.c
>> +++ b/fs/fuse/dev_uring.c
>> @@ -229,7 +229,7 @@ static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc)
>>  	struct fuse_ring *ring;
>>  	size_t nr_queues = num_possible_cpus();
>>  	struct fuse_ring *res = NULL;
>> -	size_t max_payload_size;
>> +	size_t max_req_payload_size;
>>  
>>  	ring = kzalloc_obj(*fc->ring, GFP_KERNEL_ACCOUNT);
>>  	if (!ring)
>> @@ -240,8 +240,8 @@ static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc)
>>  	if (!ring->queues)
>>  		goto out_err;
>>  
>> -	max_payload_size = max(FUSE_MIN_READ_BUFFER, fc->max_write);
>> -	max_payload_size = max(max_payload_size, fc->max_pages * PAGE_SIZE);
>> +	max_req_payload_size = max(FUSE_MIN_READ_BUFFER, fc->max_write);
>> +	max_req_payload_size = max(max_req_payload_size, fc->max_pages * PAGE_SIZE);
>>  
>>  	spin_lock(&fc->lock);
>>  	if (fc->ring) {
>> @@ -255,7 +255,7 @@ static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc)
>>  
>>  	ring->nr_queues = nr_queues;
>>  	ring->fc = fc;
>> -	ring->max_payload_sz = max_payload_size;
>> +	ring->max_req_payload_sz = max_req_payload_size;
>>  	smp_store_release(&fc->ring, ring);
>>  
>>  	spin_unlock(&fc->lock);
>> @@ -590,7 +590,7 @@ static int fuse_uring_copy_from_ring(struct fuse_ring *ring,
>>  	if (err)
>>  		return -EFAULT;
>>  
>> -	err = import_ubuf(ITER_SOURCE, ent->payload, ring->max_payload_sz,
>> +	err = import_ubuf(ITER_SOURCE, ent->payload, ring->max_req_payload_sz,
>>  			  &iter);
>>  	if (err)
>>  		return err;
>> @@ -621,7 +621,7 @@ static int fuse_uring_args_to_ring(struct fuse_ring *ring, struct fuse_req *req,
>>  		.commit_id = req->in.h.unique,
>>  	};
>>  
>> -	err = import_ubuf(ITER_DEST, ent->payload, ring->max_payload_sz, &iter);
>> +	err = import_ubuf(ITER_DEST, ent->payload, ring->max_req_payload_sz, &iter);
>>  	if (err) {
>>  		pr_info_ratelimited("fuse: Import of user buffer failed\n");
>>  		return err;
>> @@ -1056,7 +1056,7 @@ fuse_uring_create_ring_ent(struct io_uring_cmd *cmd,
>>  	}
>>  
>>  	payload_size = iov[1].iov_len;
>> -	if (payload_size < ring->max_payload_sz) {
>> +	if (payload_size < ring->max_req_payload_sz) {
>>  		pr_info_ratelimited("Invalid req payload len %zu\n",
>>  				    payload_size);
>>  		return ERR_PTR(err);
>> diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h
>> index 51a563922ce1..544f7afb3866 100644
>> --- a/fs/fuse/dev_uring_i.h
>> +++ b/fs/fuse/dev_uring_i.h
>> @@ -112,8 +112,8 @@ struct fuse_ring {
>>  	/* number of ring queues */
>>  	size_t nr_queues;
>>  
>> -	/* maximum payload/arg size */
>> -	size_t max_payload_sz;
>> +	/* maximum request payload/arg size */
>> +	size_t max_req_payload_sz;
>>  
>>  	struct fuse_ring_queue **queues;
>>  
> 
> I don't have a strong opinion here, wouldn't be sufficient to update the
> comment?
> 
Thanks for the review. I'm fine with either approach, so I'd like to defer to Miklos's preference. 
> 
> Thanks,
> Bernd


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

end of thread, other threads:[~2026-03-17  8:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-05 12:35 [PATCH] fuse: rename confusing ring->max_payload_sz Li Wang
2026-03-10 16:31 ` Bernd Schubert
2026-03-17  8:12   ` Li Wang

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