提交 f93a181a 编写于 作者: C Christoph Hellwig 提交者: Jens Axboe

bvec: add memcpy_{from,to}_bvec and memzero_bvec helper

Add helpers to perform common memory operation on a bvec.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: NMartin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: NIra Weiny <ira.weiny@intel.com>
Link: https://lore.kernel.org/r/20210727055646.118787-5-hch@lst.deSigned-off-by: NJens Axboe <axboe@kernel.dk>
上级 e6e74717
......@@ -196,4 +196,37 @@ static inline void *bvec_kmap_local(struct bio_vec *bvec)
return kmap_local_page(bvec->bv_page) + bvec->bv_offset;
}
/**
* memcpy_from_bvec - copy data from a bvec
* @bvec: bvec to copy from
*
* Must be called on single-page bvecs only.
*/
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);
}
/**
* memcpy_to_bvec - copy data to a bvec
* @bvec: bvec to copy to
*
* Must be called on single-page bvecs only.
*/
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);
}
/**
* memzero_bvec - zero all data in a bvec
* @bvec: bvec to zero
*
* Must be called on single-page bvecs only.
*/
static inline void memzero_bvec(struct bio_vec *bvec)
{
memzero_page(bvec->bv_page, bvec->bv_offset, bvec->bv_len);
}
#endif /* __LINUX_BVEC_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册