linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ilya Dryomov <idryomov@gmail.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	 Minchan Kim <minchan@kernel.org>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	 Keith Busch <kbusch@kernel.org>,
	Sagi Grimberg <sagi@grimberg.me>,
	 Chaitanya Kulkarni <kch@nvidia.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	 David Howells <dhowells@redhat.com>,
	Marc Dionne <marc.dionne@auristor.com>,
	 Xiubo Li <xiubli@redhat.com>, Steve French <sfrench@samba.org>,
	 Trond Myklebust <trond.myklebust@hammerspace.com>,
	Anna Schumaker <anna@kernel.org>,
	 Mike Marshall <hubcap@omnibond.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	 Chuck Lever <chuck.lever@oracle.com>,
	linux-block@vger.kernel.org,  ceph-devel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	 linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org,
	 target-devel@vger.kernel.org, kvm@vger.kernel.org,
	netdev@vger.kernel.org,  linux-afs@lists.infradead.org,
	linux-cifs@vger.kernel.org,  samba-technical@lists.samba.org,
	linux-fsdevel@vger.kernel.org,  linux-nfs@vger.kernel.org,
	devel@lists.orangefs.org, io-uring@vger.kernel.org,
	 linux-mm@kvack.org
Subject: Re: [PATCH 23/23] net-ceph: use bvec_set_page to initialize bvecs
Date: Mon, 30 Jan 2023 19:20:15 +0100	[thread overview]
Message-ID: <CAOi1vP9U6kTyLgiXDFPtg4nr2ut++cAoowZONsoAtzWV0VosUw@mail.gmail.com> (raw)
In-Reply-To: <20230130092157.1759539-24-hch@lst.de>

On Mon, Jan 30, 2023 at 10:23 AM Christoph Hellwig <hch@lst.de> wrote:
>
> Use the bvec_set_page helper to initialize bvecs.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  net/ceph/messenger_v1.c |  7 ++-----
>  net/ceph/messenger_v2.c | 28 +++++++++++-----------------
>  2 files changed, 13 insertions(+), 22 deletions(-)
>
> diff --git a/net/ceph/messenger_v1.c b/net/ceph/messenger_v1.c
> index d1787d7d33ef9a..d664cb1593a777 100644
> --- a/net/ceph/messenger_v1.c
> +++ b/net/ceph/messenger_v1.c
> @@ -40,15 +40,12 @@ static int ceph_tcp_recvmsg(struct socket *sock, void *buf, size_t len)
>  static int ceph_tcp_recvpage(struct socket *sock, struct page *page,
>                      int page_offset, size_t length)
>  {
> -       struct bio_vec bvec = {
> -               .bv_page = page,
> -               .bv_offset = page_offset,
> -               .bv_len = length
> -       };
> +       struct bio_vec bvec;
>         struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL };
>         int r;
>
>         BUG_ON(page_offset + length > PAGE_SIZE);
> +       bvec_set_page(&bvec, page, length, page_offset);
>         iov_iter_bvec(&msg.msg_iter, ITER_DEST, &bvec, 1, length);
>         r = sock_recvmsg(sock, &msg, msg.msg_flags);
>         if (r == -EAGAIN)
> diff --git a/net/ceph/messenger_v2.c b/net/ceph/messenger_v2.c
> index 3009028c4fa28f..301a991dc6a68e 100644
> --- a/net/ceph/messenger_v2.c
> +++ b/net/ceph/messenger_v2.c
> @@ -149,10 +149,10 @@ static int do_try_sendpage(struct socket *sock, struct iov_iter *it)
>
>         while (iov_iter_count(it)) {
>                 /* iov_iter_iovec() for ITER_BVEC */
> -               bv.bv_page = it->bvec->bv_page;
> -               bv.bv_offset = it->bvec->bv_offset + it->iov_offset;
> -               bv.bv_len = min(iov_iter_count(it),
> -                               it->bvec->bv_len - it->iov_offset);
> +               bvec_set_page(&bv, it->bvec->bv_page,
> +                             min(iov_iter_count(it),
> +                                 it->bvec->bv_len - it->iov_offset),
> +                             it->bvec->bv_offset + it->iov_offset);
>
>                 /*
>                  * sendpage cannot properly handle pages with
> @@ -286,9 +286,8 @@ static void set_out_bvec_zero(struct ceph_connection *con)
>         WARN_ON(iov_iter_count(&con->v2.out_iter));
>         WARN_ON(!con->v2.out_zero);
>
> -       con->v2.out_bvec.bv_page = ceph_zero_page;
> -       con->v2.out_bvec.bv_offset = 0;
> -       con->v2.out_bvec.bv_len = min(con->v2.out_zero, (int)PAGE_SIZE);
> +       bvec_set_page(&con->v2.out_bvec, ceph_zero_page,
> +                     min(con->v2.out_zero, (int)PAGE_SIZE), 0);
>         con->v2.out_iter_sendpage = true;
>         iov_iter_bvec(&con->v2.out_iter, ITER_SOURCE, &con->v2.out_bvec, 1,
>                       con->v2.out_bvec.bv_len);
> @@ -863,10 +862,7 @@ static void get_bvec_at(struct ceph_msg_data_cursor *cursor,
>
>         /* get a piece of data, cursor isn't advanced */
>         page = ceph_msg_data_next(cursor, &off, &len);
> -
> -       bv->bv_page = page;
> -       bv->bv_offset = off;
> -       bv->bv_len = len;
> +       bvec_set_page(bv, page, len, off);
>  }
>
>  static int calc_sg_cnt(void *buf, int buf_len)
> @@ -1855,9 +1851,8 @@ static void prepare_read_enc_page(struct ceph_connection *con)
>              con->v2.in_enc_resid);
>         WARN_ON(!con->v2.in_enc_resid);
>
> -       bv.bv_page = con->v2.in_enc_pages[con->v2.in_enc_i];
> -       bv.bv_offset = 0;
> -       bv.bv_len = min(con->v2.in_enc_resid, (int)PAGE_SIZE);
> +       bvec_set_page(&bv, con->v2.in_enc_pages[con->v2.in_enc_i],
> +                     min(con->v2.in_enc_resid, (int)PAGE_SIZE), 0);
>
>         set_in_bvec(con, &bv);
>         con->v2.in_enc_i++;
> @@ -2998,9 +2993,8 @@ static void queue_enc_page(struct ceph_connection *con)
>              con->v2.out_enc_resid);
>         WARN_ON(!con->v2.out_enc_resid);
>
> -       bv.bv_page = con->v2.out_enc_pages[con->v2.out_enc_i];
> -       bv.bv_offset = 0;
> -       bv.bv_len = min(con->v2.out_enc_resid, (int)PAGE_SIZE);
> +       bvec_set_page(&bv, con->v2.out_enc_pages[con->v2.out_enc_i],
> +                     min(con->v2.out_enc_resid, (int)PAGE_SIZE), 0);
>
>         set_out_bvec(con, &bv, false);
>         con->v2.out_enc_i++;
> --
> 2.39.0
>

Hi Christoph,

Nit on the patch title: this subsystem should be referred to as
libceph instead of net-ceph or similar, see "git log -- net/ceph" or
MAINTAINERS.

Reviewed-by: Ilya Dryomov <idryomov@gmail.com>

Thanks,

                Ilya


  reply	other threads:[~2023-01-30 18:20 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30  9:21 add bvec initialization helpers Christoph Hellwig
2023-01-30  9:21 ` [PATCH 01/23] block: factor out a bvec_set_page helper Christoph Hellwig
2023-01-30 11:55   ` Johannes Thumshirn
2023-01-30 17:09   ` Bart Van Assche
2023-01-30 19:24     ` Bart Van Assche
2023-01-31 13:45     ` Christoph Hellwig
2023-01-31  4:47   ` Jakub Kicinski
2023-01-31  5:00     ` Matthew Wilcox
2023-01-31  5:28       ` Matthew Wilcox
2023-01-31  5:52         ` Jakub Kicinski
2023-01-31  6:55   ` Chaitanya Kulkarni
2023-01-30  9:21 ` [PATCH 02/23] block: add a bvec_set_folio helper Christoph Hellwig
2023-01-30 11:54   ` Johannes Thumshirn
2023-01-31  6:55   ` Chaitanya Kulkarni
2023-01-30  9:21 ` [PATCH 03/23] block: add a bvec_set_virt helper Christoph Hellwig
2023-01-30 12:08   ` Johannes Thumshirn
2023-01-31  6:55   ` Chaitanya Kulkarni
2023-01-30  9:21 ` [PATCH 04/23] sd: factor out a sd_set_special_bvec helper Christoph Hellwig
2023-01-31  6:56   ` Chaitanya Kulkarni
2023-01-30  9:21 ` [PATCH 05/23] target: use bvec_set_page to initialize bvecs Christoph Hellwig
2023-01-31  6:56   ` Chaitanya Kulkarni
2023-01-30  9:21 ` [PATCH 06/23] nvmet: " Christoph Hellwig
2023-01-30 12:07   ` Johannes Thumshirn
2023-01-31  6:57   ` Chaitanya Kulkarni
2023-01-30  9:21 ` [PATCH 07/23] nvme: use bvec_set_virt to initialize special_vec Christoph Hellwig
2023-01-30 12:09   ` Johannes Thumshirn
2023-01-31  6:58   ` Chaitanya Kulkarni
2023-01-30  9:21 ` [PATCH 08/23] rbd: use bvec_set_page to initialize the copy up bvec Christoph Hellwig
2023-01-30 17:47   ` Ilya Dryomov
2023-01-30  9:21 ` [PATCH 09/23] virtio_blk: use bvec_set_virt to initialize special_vec Christoph Hellwig
2023-01-30 15:17   ` Michael S. Tsirkin
2023-01-31  3:22     ` Jason Wang
2023-01-31  6:57   ` Chaitanya Kulkarni
2023-01-30  9:21 ` [PATCH 10/23] zram: use bvec_set_page to initialize bvecs Christoph Hellwig
2023-01-30 13:31   ` Johannes Thumshirn
2023-01-31  2:34   ` Sergey Senozhatsky
2023-01-30  9:21 ` [PATCH 11/23] afs: use bvec_set_folio to initialize a bvec Christoph Hellwig
2023-01-30  9:21 ` [PATCH 12/23] ceph: use bvec_set_page " Christoph Hellwig
2023-01-30 18:02   ` Ilya Dryomov
2023-01-31  1:51     ` Xiubo Li
2023-01-30  9:21 ` [PATCH 13/23] cifs: use bvec_set_page to initialize bvecs Christoph Hellwig
2023-01-30 15:56   ` Paulo Alcantara
2023-01-30  9:21 ` [PATCH 14/23] coredump: use bvec_set_page to initialize a bvec Christoph Hellwig
2023-01-30  9:21 ` [PATCH 15/23] nfs: use bvec_set_page to initialize bvecs Christoph Hellwig
2023-01-30  9:21 ` [PATCH 16/23] orangefs: use bvec_set_{page,folio} " Christoph Hellwig
2023-01-30  9:21 ` [PATCH 17/23] splice: use bvec_set_page to initialize a bvec Christoph Hellwig
2023-01-30  9:21 ` [PATCH 18/23] io_uring: " Christoph Hellwig
2023-01-31  6:59   ` Chaitanya Kulkarni
2023-01-30  9:21 ` [PATCH 19/23] swap: use bvec_set_page to initialize bvecs Christoph Hellwig
2023-01-30  9:21 ` [PATCH 20/23] rxrpc: use bvec_set_page to initialize a bvec Christoph Hellwig
2023-01-30  9:21 ` [PATCH 21/23] sunrpc: use bvec_set_page to initialize bvecs Christoph Hellwig
2023-01-30 15:38   ` Chuck Lever III
2023-01-30  9:21 ` [PATCH 22/23] vring: use bvec_set_page to initialize a bvec Christoph Hellwig
2023-01-30 15:19   ` Michael S. Tsirkin
2023-01-31  2:31   ` Jason Wang
2023-01-30  9:21 ` [PATCH 23/23] net-ceph: use bvec_set_page to initialize bvecs Christoph Hellwig
2023-01-30 18:20   ` Ilya Dryomov [this message]
2023-01-30 10:31 ` [PATCH 20/23] rxrpc: use bvec_set_page to initialize a bvec David Howells
2023-01-30 10:33   ` Christoph Hellwig
2023-01-30 11:24   ` David Howells
2023-01-30 12:18     ` Christoph Hellwig
2023-01-30 10:33 ` [PATCH 01/23] block: factor out a bvec_set_page helper David Howells
2023-01-30 10:36   ` Christoph Hellwig
2023-01-30 18:35     ` Ilya Dryomov
2023-01-30 15:58 ` [PATCH 20/23] rxrpc: use bvec_set_page to initialize a bvec David Howells
2023-01-30 15:59 ` [PATCH 11/23] afs: use bvec_set_folio " David Howells

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=CAOi1vP9U6kTyLgiXDFPtg4nr2ut++cAoowZONsoAtzWV0VosUw@mail.gmail.com \
    --to=idryomov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=anna@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=ceph-devel@vger.kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=davem@davemloft.net \
    --cc=devel@lists.orangefs.org \
    --cc=dhowells@redhat.com \
    --cc=edumazet@google.com \
    --cc=hch@lst.de \
    --cc=hubcap@omnibond.com \
    --cc=io-uring@vger.kernel.org \
    --cc=jasowang@redhat.com \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=marc.dionne@auristor.com \
    --cc=martin.petersen@oracle.com \
    --cc=minchan@kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sagi@grimberg.me \
    --cc=samba-technical@lists.samba.org \
    --cc=senozhatsky@chromium.org \
    --cc=sfrench@samba.org \
    --cc=target-devel@vger.kernel.org \
    --cc=trond.myklebust@hammerspace.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xiubli@redhat.com \
    /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