All of lore.kernel.org
 help / color / mirror / Atom feed
From: Noah Goldstein <goldstein.w.n@gmail.com>
To: Pavel Begunkov <asml.silence@gmail.com>
Cc: noah <goldstein.n@wustl.edu>, Jens Axboe <axboe@kernel.dk>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	io-uring@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs: io_uring.c: Add skip option for __io_sqe_files_update
Date: Mon, 21 Dec 2020 21:10:43 -0500	[thread overview]
Message-ID: <20201222021043.GA139782@gmail.com> (raw)
In-Reply-To: <0cdf2aac-6364-742d-debb-cfd58b4c6f2b@gmail.com>

On Sun, Dec 20, 2020 at 03:18:05PM +0000, Pavel Begunkov wrote:
> On 20/12/2020 06:50, noah wrote:> From: noah <goldstein.n@wustl.edu>
> > 
> > This patch makes it so that specify a file descriptor value of -2 will
> > skip updating the corresponding fixed file index.
> > 
> > This will allow for users to reduce the number of syscalls necessary
> > to update a sparse file range when using the fixed file option.
> 
> Answering the github thread -- it's indeed a simple change, I had it the
> same day you posted the issue. See below it's a bit cleaner. However, I
> want to first review "io_uring: buffer registration enhancements", and
> if it's good, for easier merging/etc I'd rather prefer to let it go
> first (even if partially).
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 941fe9b64fd9..b3ae9d5da17e 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -7847,9 +7847,8 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
>  	if (IS_ERR(ref_node))
>  		return PTR_ERR(ref_node);
>  
> -	done = 0;
>  	fds = u64_to_user_ptr(up->fds);
> -	while (nr_args) {
> +	for (done = 0; done < nr_args; done++) {
>  		struct fixed_file_table *table;
>  		unsigned index;
>  
> @@ -7858,7 +7857,10 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
>  			err = -EFAULT;
>  			break;
>  		}
> -		i = array_index_nospec(up->offset, ctx->nr_user_files);
> +		if (fd == IORING_REGISTER_FILES_SKIP)
> +			continue;
> +
> +		i = array_index_nospec(up->offset + done, ctx->nr_user_files);
>  		table = &ctx->file_data->table[i >> IORING_FILE_TABLE_SHIFT];
>  		index = i & IORING_FILE_TABLE_MASK;
>  		if (table->files[index]) {
> @@ -7896,9 +7898,6 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
>  				break;
>  			}
>  		}
> -		nr_args--;
> -		done++;
> -		up->offset++;
>  	}
>  
>  	if (needs_switch) {
> 
> -- 
> Pavel Begunkov
Ah. Got it.

  reply	other threads:[~2020-12-22  2:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-20  6:50 [PATCH] fs: io_uring.c: Add skip option for __io_sqe_files_update noah
2020-12-20 15:18 ` Pavel Begunkov
2020-12-22  2:10   ` Noah Goldstein [this message]
2021-01-26 12:26     ` Pavel Begunkov
2021-01-26 17:14       ` Noah Goldstein
2021-01-26 17:20         ` Pavel Begunkov
2021-01-26 18:43           ` Noah Goldstein
2021-01-26 19:39             ` Pavel Begunkov

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=20201222021043.GA139782@gmail.com \
    --to=goldstein.w.n@gmail.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=goldstein.n@wustl.edu \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.