public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, io-uring@vger.kernel.org
Subject: Re: [PATCH 4/4] io_uring: reuse buffer updates for registration
Date: Fri, 4 Apr 2025 22:38:33 +0100	[thread overview]
Message-ID: <609ff085-34a2-4b3d-a984-57ab2f9fcad6@gmail.com> (raw)
In-Reply-To: <1f12d9bc-b20f-4228-af96-a5c885f255ee@kernel.dk>

On 4/4/25 17:38, Jens Axboe wrote:
> On 4/4/25 10:22 AM, Pavel Begunkov wrote:
>> @@ -316,17 +318,26 @@ static int __io_sqe_buffers_update(struct io_ring_ctx *ctx,
>>   			err = PTR_ERR(node);
>>   			break;
>>   		}
>> -		i = array_index_nospec(up->offset + done, ctx->buf_table.nr);
>> -		io_reset_rsrc_node(ctx, &ctx->buf_table, i);
>> -		ctx->buf_table.nodes[i] = node;
>> +		i = array_index_nospec(up->offset + done, buf_table->nr);
>> +		io_reset_rsrc_node(ctx, buf_table, i);
>> +		buf_table->nodes[i] = node;
>>   		if (ctx->compat)
>>   			user_data += sizeof(struct compat_iovec);
>>   		else
>>   			user_data += sizeof(struct iovec);
>>   	}
>> +	if (last_error)
>> +		*last_error = err;
>>   	return done ? done : err;
>>   }
>>   
>> +static int __io_sqe_buffers_update(struct io_ring_ctx *ctx,
>> +				   struct io_uring_rsrc_update2 *up,
>> +				   unsigned int nr_args)
>> +{
>> +	return io_buffer_table_update(ctx, &ctx->buf_table, up, nr_args, NULL);
>> +}
> 
> Minor style preference, but just do:
> 
> 	unsigned last_err;
> 	return io_buffer_table_update(ctx, &ctx->buf_table, up, nr_args, &last_err);
> 
> and skip that last_error could be conditionally set?

I can't say I see how that's better though

-- 
Pavel Begunkov


  reply	other threads:[~2025-04-04 21:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-04 16:22 [PATCH 0/4] buffer table registration cleanup Pavel Begunkov
2025-04-04 16:22 ` [PATCH 1/4] io_uring/rsrc: avoid assigning buf table on failure Pavel Begunkov
2025-04-04 16:22 ` [PATCH 2/4] io_uring: deduplicate node tagging Pavel Begunkov
2025-04-04 16:22 ` [PATCH 3/4] io_uring: early return for sparse buf table registration Pavel Begunkov
2025-04-04 16:22 ` [PATCH 4/4] io_uring: reuse buffer updates for registration Pavel Begunkov
2025-04-04 16:38   ` Jens Axboe
2025-04-04 21:38     ` Pavel Begunkov [this message]
2025-04-04 22:00       ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=609ff085-34a2-4b3d-a984-57ab2f9fcad6@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox