]> www.infradead.org Git - users/hch/block.git/commitdiff
bvec: add a bvec_kmap_local helper
authorChristoph Hellwig <hch@lst.de>
Thu, 20 May 2021 11:57:56 +0000 (13:57 +0200)
committerChristoph Hellwig <hch@lst.de>
Thu, 20 May 2021 12:44:41 +0000 (14:44 +0200)
Add a helper to call kmap_local_page on a bvec.  There is no need for
an unmap helper given that kunmap_local accept any address in the mapped
page.

Signed-off-by: Christoph Hellwig <hch@lst.de>
include/linux/bvec.h

index 883faf5f15234e6d8cfa1919ccb25e8d5b560e2a..5048df1b432ca2699a5bf6c5a604fe99868628f0 100644 (file)
@@ -7,6 +7,7 @@
 #ifndef __LINUX_BVEC_H
 #define __LINUX_BVEC_H
 
+#include <linux/highmem.h>
 #include <linux/bug.h>
 #include <linux/errno.h>
 #include <linux/limits.h>
@@ -183,4 +184,9 @@ static inline void bvec_advance(const struct bio_vec *bvec,
        }
 }
 
+static inline char *bvec_kmap_local(struct bio_vec *bvec)
+{
+       return kmap_local_page(bvec->bv_page) + bvec->bv_offset;
+}
+
 #endif /* __LINUX_BVEC_H */