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

bvec: add a bvec_virt helper

Add a helper to get the virtual address for a bvec.  This avoids that
all callers need to know about the page + offset representation.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NChaitanya Kulkarni <kch@kernel.org>
Reviewed-by: NMartin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20210804095634.460779-2-hch@lst.deSigned-off-by: NJens Axboe <axboe@kernel.dk>
上级 889c05cc
......@@ -229,4 +229,16 @@ static inline void memzero_bvec(struct bio_vec *bvec)
memzero_page(bvec->bv_page, bvec->bv_offset, bvec->bv_len);
}
/**
* bvec_virt - return the virtual address for a bvec
* @bvec: bvec to return the virtual address for
*
* Note: the caller must ensure that @bvec->bv_page is not a highmem page.
*/
static inline void *bvec_virt(struct bio_vec *bvec)
{
WARN_ON_ONCE(PageHighMem(bvec->bv_page));
return page_address(bvec->bv_page) + bvec->bv_offset;
}
#endif /* __LINUX_BVEC_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册