From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Ilya Dryomov <idryomov@gmail.com>,
"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, Paulo Alcantara <pc@cjr.nz>
Subject: [PATCH 13/23] cifs: use bvec_set_page to initialize bvecs
Date: Fri, 3 Feb 2023 16:06:24 +0100 [thread overview]
Message-ID: <20230203150634.3199647-14-hch@lst.de> (raw)
In-Reply-To: <20230203150634.3199647-1-hch@lst.de>
Use the bvec_set_page helper to initialize bvecs.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
---
fs/cifs/connect.c | 5 +++--
fs/cifs/fscache.c | 16 ++++++----------
fs/cifs/misc.c | 5 ++---
fs/cifs/smb2ops.c | 6 +++---
4 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index b2a04b4e89a5e7..e6088d96eb04d2 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -759,8 +759,9 @@ cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *page,
unsigned int page_offset, unsigned int to_read)
{
struct msghdr smb_msg = {};
- struct bio_vec bv = {
- .bv_page = page, .bv_len = to_read, .bv_offset = page_offset};
+ struct bio_vec bv;
+
+ bvec_set_page(&bv, page, to_read, page_offset);
iov_iter_bvec(&smb_msg.msg_iter, ITER_DEST, &bv, 1, to_read);
return cifs_readv_from_socket(server, &smb_msg);
}
diff --git a/fs/cifs/fscache.c b/fs/cifs/fscache.c
index f6f3a6b75601be..0911327ebfdeb4 100644
--- a/fs/cifs/fscache.c
+++ b/fs/cifs/fscache.c
@@ -143,14 +143,12 @@ static int fscache_fallback_read_page(struct inode *inode, struct page *page)
struct netfs_cache_resources cres;
struct fscache_cookie *cookie = cifs_inode_cookie(inode);
struct iov_iter iter;
- struct bio_vec bvec[1];
+ struct bio_vec bvec;
int ret;
memset(&cres, 0, sizeof(cres));
- bvec[0].bv_page = page;
- bvec[0].bv_offset = 0;
- bvec[0].bv_len = PAGE_SIZE;
- iov_iter_bvec(&iter, ITER_DEST, bvec, ARRAY_SIZE(bvec), PAGE_SIZE);
+ bvec_set_page(&bvec, page, PAGE_SIZE, 0);
+ iov_iter_bvec(&iter, ITER_DEST, &bvec, 1, PAGE_SIZE);
ret = fscache_begin_read_operation(&cres, cookie);
if (ret < 0)
@@ -171,16 +169,14 @@ static int fscache_fallback_write_page(struct inode *inode, struct page *page,
struct netfs_cache_resources cres;
struct fscache_cookie *cookie = cifs_inode_cookie(inode);
struct iov_iter iter;
- struct bio_vec bvec[1];
+ struct bio_vec bvec;
loff_t start = page_offset(page);
size_t len = PAGE_SIZE;
int ret;
memset(&cres, 0, sizeof(cres));
- bvec[0].bv_page = page;
- bvec[0].bv_offset = 0;
- bvec[0].bv_len = PAGE_SIZE;
- iov_iter_bvec(&iter, ITER_SOURCE, bvec, ARRAY_SIZE(bvec), PAGE_SIZE);
+ bvec_set_page(&bvec, page, PAGE_SIZE, 0);
+ iov_iter_bvec(&iter, ITER_SOURCE, &bvec, 1, PAGE_SIZE);
ret = fscache_begin_write_operation(&cres, cookie);
if (ret < 0)
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index 2a19c7987c5bd8..95cc4d7dd806d7 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -1054,9 +1054,8 @@ setup_aio_ctx_iter(struct cifs_aio_ctx *ctx, struct iov_iter *iter, int rw)
for (i = 0; i < cur_npages; i++) {
len = rc > PAGE_SIZE ? PAGE_SIZE : rc;
- bv[npages + i].bv_page = pages[i];
- bv[npages + i].bv_offset = start;
- bv[npages + i].bv_len = len - start;
+ bvec_set_page(&bv[npages + i], pages[i], len - start,
+ start);
rc -= len;
start = 0;
}
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index e6bcd2baf446a9..cb2deac6b2d70e 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -4598,9 +4598,9 @@ init_read_bvec(struct page **pages, unsigned int npages, unsigned int data_size,
return -ENOMEM;
for (i = 0; i < npages; i++) {
- bvec[i].bv_page = pages[i];
- bvec[i].bv_offset = (i == 0) ? cur_off : 0;
- bvec[i].bv_len = min_t(unsigned int, PAGE_SIZE, data_size);
+ bvec_set_page(&bvec[i], pages[i],
+ min_t(unsigned int, PAGE_SIZE, data_size),
+ i == 0 ? cur_off : 0);
data_size -= bvec[i].bv_len;
}
--
2.39.0
next prev parent reply other threads:[~2023-02-03 15:08 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-03 15:06 add bvec initialization helpers v2 Christoph Hellwig
2023-02-03 15:06 ` [PATCH 01/23] block: factor out a bvec_set_page helper Christoph Hellwig
2023-02-03 15:06 ` [PATCH 02/23] block: add a bvec_set_folio helper Christoph Hellwig
2023-02-03 15:06 ` [PATCH 03/23] block: add a bvec_set_virt helper Christoph Hellwig
2023-02-03 15:06 ` [PATCH 04/23] sd: factor out a sd_set_special_bvec helper Christoph Hellwig
2023-02-03 15:06 ` [PATCH 05/23] target: use bvec_set_page to initialize bvecs Christoph Hellwig
2023-02-03 15:06 ` [PATCH 06/23] nvmet: " Christoph Hellwig
2023-02-03 15:06 ` [PATCH 07/23] nvme: use bvec_set_virt to initialize special_vec Christoph Hellwig
2023-02-03 15:06 ` [PATCH 08/23] rbd: use bvec_set_page to initialize the copy up bvec Christoph Hellwig
2023-02-03 15:06 ` [PATCH 09/23] virtio_blk: use bvec_set_virt to initialize special_vec Christoph Hellwig
2023-02-03 15:06 ` [PATCH 10/23] zram: use bvec_set_page to initialize bvecs Christoph Hellwig
2023-02-03 15:06 ` [PATCH 11/23] afs: use bvec_set_folio to initialize a bvec Christoph Hellwig
2023-02-03 15:06 ` [PATCH 12/23] ceph: use bvec_set_page " Christoph Hellwig
2023-02-03 17:14 ` Ilya Dryomov
2023-02-03 15:06 ` Christoph Hellwig [this message]
2023-02-03 15:06 ` [PATCH 14/23] coredump: " Christoph Hellwig
2023-02-03 15:06 ` [PATCH 15/23] nfs: use bvec_set_page to initialize bvecs Christoph Hellwig
2023-02-03 15:06 ` [PATCH 16/23] orangefs: use bvec_set_{page,folio} " Christoph Hellwig
2023-02-03 15:06 ` [PATCH 17/23] splice: use bvec_set_page to initialize a bvec Christoph Hellwig
2023-02-03 15:06 ` [PATCH 18/23] io_uring: " Christoph Hellwig
2023-02-03 15:06 ` [PATCH 19/23] swap: use bvec_set_page to initialize bvecs Christoph Hellwig
2023-02-03 15:06 ` [PATCH 20/23] rxrpc: use bvec_set_page to initialize a bvec Christoph Hellwig
2023-02-03 15:06 ` [PATCH 21/23] sunrpc: use bvec_set_page to initialize bvecs Christoph Hellwig
2023-02-03 15:06 ` [PATCH 22/23] vringh: use bvec_set_page to initialize a bvec Christoph Hellwig
2023-02-03 15:06 ` [PATCH 23/23] libceph: use bvec_set_page to initialize bvecs Christoph Hellwig
2023-02-03 17:18 ` add bvec initialization helpers v2 Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2023-01-30 9:21 add bvec initialization helpers Christoph Hellwig
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
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=20230203150634.3199647-14-hch@lst.de \
--to=hch@lst.de \
--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=hubcap@omnibond.com \
--cc=idryomov@gmail.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=pc@cjr.nz \
--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;
as well as URLs for NNTP newsgroup(s).