[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210608160603.1535935-6-hch@lst.de>
Date: Tue, 8 Jun 2021 18:05:52 +0200
From: Christoph Hellwig <hch@....de>
To: Jens Axboe <axboe@...nel.dk>
Cc: Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Geoff Levand <geoff@...radead.org>,
Ilya Dryomov <idryomov@...il.com>,
Dongsheng Yang <dongsheng.yang@...ystack.cn>,
Mike Snitzer <snitzer@...hat.com>,
Ira Weiny <ira.weiny@...el.com>, dm-devel@...hat.com,
linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-block@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
ceph-devel@...r.kernel.org
Subject: [PATCH 05/16] bvec: add memcpy_{from,to}_bvec and memzero_bvec helper
Add helpers to perform common memory operation on a bvec.
Signed-off-by: Christoph Hellwig <hch@....de>
---
include/linux/bvec.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index d64d6c0ceb77..ac835fa01ee3 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -189,4 +189,19 @@ static inline void *bvec_kmap_local(struct bio_vec *bvec)
return kmap_local_page(bvec->bv_page) + bvec->bv_offset;
}
+static inline void memcpy_from_bvec(char *to, struct bio_vec *bvec)
+{
+ memcpy_from_page(to, bvec->bv_page, bvec->bv_offset, bvec->bv_len);
+}
+
+static inline void memcpy_to_bvec(struct bio_vec *bvec, const char *from)
+{
+ memcpy_to_page(bvec->bv_page, bvec->bv_offset, from, bvec->bv_len);
+}
+
+static inline void memzero_bvec(struct bio_vec *bvec)
+{
+ memzero_page(bvec->bv_page, bvec->bv_offset, bvec->bv_len);
+}
+
#endif /* __LINUX_BVEC_H */
--
2.30.2
Powered by blists - more mailing lists