public inbox for [email protected]
 help / color / mirror / Atom feed
From: Keith Busch <[email protected]>
To: Caleb Sander Mateos <[email protected]>
Cc: Pavel Begunkov <[email protected]>,
	[email protected], Andres Freund <[email protected]>
Subject: Re: [PATCH 2/8] io_uring: add infra for importing vectored reg buffers
Date: Mon, 3 Mar 2025 13:57:28 -0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <CADUfDZobvM1V38qSizh=WqAv1o5-pTOSZ+PUDMgEhgY3OVAssg@mail.gmail.com>

On Mon, Mar 03, 2025 at 12:49:38PM -0800, Caleb Sander Mateos wrote:
> > +               u64 buf_end;
> > +
> > +               if (unlikely(check_add_overflow(buf_addr, (u64)iov_len, &buf_end)))
> > +                       return -EFAULT;
> > +               if (unlikely(buf_addr < imu->ubuf || buf_end > (imu->ubuf + imu->len)))
> > +                       return -EFAULT;
> > +
> > +               total_len += iov_len;
> > +               /* by using folio address it also accounts for bvec offset */
> > +               offset = buf_addr - folio_addr;
> > +               src_bvec = imu->bvec + (offset >> imu->folio_shift);
> > +               offset &= folio_mask;
> > +
> > +               for (; iov_len; offset = 0, bvec_idx++, src_bvec++) {
> > +                       size_t seg_size = min_t(size_t, iov_len,
> > +                                               folio_size - offset);
> > +
> > +                       res_bvec[bvec_idx].bv_page = src_bvec->bv_page;
> > +                       res_bvec[bvec_idx].bv_offset = offset;
> > +                       res_bvec[bvec_idx].bv_len = seg_size;
> 
> Could just increment res_bvec to avoid the variable bvec_idx?

And utilizing bvec_set_page() to initialize looks a bit cleaner too.

  reply	other threads:[~2025-03-03 20:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-03 15:50 [PATCH 0/8] Add support for vectored registered buffers Pavel Begunkov
2025-03-03 15:50 ` [PATCH 1/8] io_uring: introduce struct iou_vec Pavel Begunkov
2025-03-03 18:23   ` Caleb Sander Mateos
2025-03-03 15:50 ` [PATCH 2/8] io_uring: add infra for importing vectored reg buffers Pavel Begunkov
2025-03-03 20:49   ` Caleb Sander Mateos
2025-03-03 20:57     ` Keith Busch [this message]
2025-03-04 10:05     ` Pavel Begunkov
2025-03-04 15:18       ` Pavel Begunkov
2025-03-03 15:50 ` [PATCH 3/8] io_uring/rw: implement vectored registered rw Pavel Begunkov
2025-03-03 23:01   ` Caleb Sander Mateos
2025-03-03 23:37     ` Caleb Sander Mateos
2025-03-04 10:09     ` Pavel Begunkov
2025-03-03 15:50 ` [PATCH 4/8] io_uring/rw: defer reg buf vec import Pavel Begunkov
2025-03-03 23:37   ` Caleb Sander Mateos
2025-03-03 15:51 ` [PATCH 5/8] io_uring/net: combine msghdr copy Pavel Begunkov
2025-03-03 15:51 ` [PATCH 6/8] io_uring/net: pull vec alloc out of msghdr import Pavel Begunkov
2025-03-03 15:51 ` [PATCH 7/8] io_uring/net: convert to struct iou_vec Pavel Begunkov
2025-03-03 23:37   ` Caleb Sander Mateos
2025-03-03 15:51 ` [PATCH 8/8] io_uring/net: implement vectored reg bufs for zctx Pavel Begunkov
2025-03-03 21:03 ` [PATCH 0/8] Add support for vectored registered buffers Andres Freund
2025-03-04 10:21   ` Pavel Begunkov
2025-03-04  0:34 ` Caleb Sander Mateos
2025-03-04 10:26   ` Pavel Begunkov
2025-03-04 12:12   ` Stefan Metzmacher
2025-03-04 14:20     ` 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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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