[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230203150634.3199647-4-hch@lst.de>
Date: Fri, 3 Feb 2023 16:06:14 +0100
From: Christoph Hellwig <hch@....de>
To: Jens Axboe <axboe@...nel.dk>
Cc: Ilya Dryomov <idryomov@...il.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>,
Minchan Kim <minchan@...nel.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Keith Busch <kbusch@...nel.org>,
Sagi Grimberg <sagi@...mberg.me>,
Chaitanya Kulkarni <kch@...dia.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
David Howells <dhowells@...hat.com>,
Marc Dionne <marc.dionne@...istor.com>,
Xiubo Li <xiubli@...hat.com>, Steve French <sfrench@...ba.org>,
Trond Myklebust <trond.myklebust@...merspace.com>,
Anna Schumaker <anna@...nel.org>,
Mike Marshall <hubcap@...ibond.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Chuck Lever <chuck.lever@...cle.com>,
linux-block@...r.kernel.org, ceph-devel@...r.kernel.org,
virtualization@...ts.linux-foundation.org,
linux-nvme@...ts.infradead.org, linux-scsi@...r.kernel.org,
target-devel@...r.kernel.org, kvm@...r.kernel.org,
netdev@...r.kernel.org, linux-afs@...ts.infradead.org,
linux-cifs@...r.kernel.org, samba-technical@...ts.samba.org,
linux-fsdevel@...r.kernel.org, linux-nfs@...r.kernel.org,
devel@...ts.orangefs.org, io-uring@...r.kernel.org,
linux-mm@...ck.org, Johannes Thumshirn <johannes.thumshirn@....com>
Subject: [PATCH 03/23] block: add a bvec_set_virt helper
A small wrapper around bvec_set_page for callers that have a virtual
address.
Signed-off-by: Christoph Hellwig <hch@....de>
Reviewed-by: Chaitanya Kulkarni <kch@...dia.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@....com>
---
include/linux/bvec.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index 2bae1134499e7f..f2d22931f3030a 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -63,6 +63,18 @@ static inline void bvec_set_folio(struct bio_vec *bv, struct folio *folio,
bvec_set_page(bv, &folio->page, len, offset);
}
+/**
+ * bvec_set_virt - initialize a bvec based on a virtual address
+ * @bv: bvec to initialize
+ * @vaddr: virtual address to set the bvec to
+ * @len: length of the bvec
+ */
+static inline void bvec_set_virt(struct bio_vec *bv, void *vaddr,
+ unsigned int len)
+{
+ bvec_set_page(bv, virt_to_page(vaddr), len, offset_in_page(vaddr));
+}
+
struct bvec_iter {
sector_t bi_sector; /* device address in 512 byte
sectors */
--
2.39.0
Powered by blists - more mailing lists