[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aAANDZUvjPckRik4@kbusch-mbp.dhcp.thefacebook.com>
Date: Wed, 16 Apr 2025 14:03:25 -0600
From: Keith Busch <kbusch@...nel.org>
To: Nitesh Shetty <nitheshshetty@...il.com>
Cc: Jens Axboe <axboe@...nel.dk>, Pavel Begunkov <asml.silence@...il.com>,
Nitesh Shetty <nj.shetty@...sung.com>, gost.dev@...sung.com,
io-uring@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] io_uring/rsrc: send exact nr_segs for fixed buffer
On Thu, Apr 17, 2025 at 01:27:55AM +0530, Nitesh Shetty wrote:
> > + /*
> > + * Offset trimmed front segments too, if any, now trim the tail.
> > + * For is_kbuf we'll iterate them as they may be different sizes,
> > + * otherwise we can just do straight up math.
> > + */
> > + if (len + offset < imu->len) {
> > + bvec = iter->bvec;
> > + if (imu->is_kbuf) {
> > + while (len > bvec->bv_len) {
> > + len -= bvec->bv_len;
> > + bvec++;
> > + }
> > + iter->nr_segs = bvec - iter->bvec;
> > + } else {
> > + size_t vec_len;
> > +
> > + vec_len = bvec->bv_offset + iter->iov_offset +
> > + iter->count + ((1UL << folio_shift) - 1);
> > + iter->nr_segs = vec_len >> folio_shift;
> > + }
> > + }
> > return 0;
> > }
> This might not be needed for is_kbuf , as they already update nr_seg
> inside iov_iter_advance.
iov_iter_advance only handles the front segs. We still need something
for any trailing segments that are not part of this mapping request.
Powered by blists - more mailing lists