public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Pavel Begunkov <asml.silence@gmail.com>, io-uring@vger.kernel.org
Subject: Re: [PATCH 4/4] io_uring: reuse buffer updates for registration
Date: Fri, 4 Apr 2025 10:38:33 -0600	[thread overview]
Message-ID: <1f12d9bc-b20f-4228-af96-a5c885f255ee@kernel.dk> (raw)
In-Reply-To: <8996ffd533db8bd12c84cdc2ccef1fddbbb3da27.1743783348.git.asml.silence@gmail.com>

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?

Outside of that, no comments on the series, nice cleanups.

-- 
Jens Axboe

  reply	other threads:[~2025-04-04 16:38 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 [this message]
2025-04-04 21:38     ` Pavel Begunkov
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=1f12d9bc-b20f-4228-af96-a5c885f255ee@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --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