From 8b61c4a845a2af15fcb27e9b8ef6c69ee1036359 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Fri, 21 May 2021 08:35:03 +0200 Subject: [PATCH] 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: Christoph Hellwig --- include/linux/bvec.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/bvec.h b/include/linux/bvec.h index ac835fa01ee3..93361fd7dcbd 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -189,6 +189,11 @@ static inline void *bvec_kmap_local(struct bio_vec *bvec) return kmap_local_page(bvec->bv_page) + bvec->bv_offset; } +static inline void *bvec_virt(struct bio_vec *bvec) +{ + return page_address(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); -- 2.50.1