summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2019-02-27 13:40:13 +0100
committerJens Axboe <axboe@kernel.dk>2019-02-28 13:56:03 +0100
commit594b9a89af8e7629e95a4cd844d188361be32790 (patch)
tree3ecf8a9d37bd6b7a7810e7c8ce8f2032dd578cf8
parentblock: optimize blk_bio_segment_split for single-page bvec (diff)
downloadlinux-594b9a89af8e7629e95a4cd844d188361be32790.tar.xz
linux-594b9a89af8e7629e95a4cd844d188361be32790.zip
block: introduce mp_bvec_for_each_page() for iterating over page
mp_bvec_for_each_segment() is a bit big for the iteration, so introduce a light-weight helper for iterating over pages, then 32bytes stack space can be saved. Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--include/linux/bvec.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index 4376f683c08a..87e82e503a52 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -188,4 +188,9 @@ static inline void mp_bvec_last_segment(const struct bio_vec *bvec,
}
}
+#define mp_bvec_for_each_page(pg, bv, i) \
+ for (i = (bv)->bv_offset / PAGE_SIZE; \
+ (i <= (((bv)->bv_offset + (bv)->bv_len - 1) / PAGE_SIZE)) && \
+ (pg = bvec_nth_page((bv)->bv_page, i)); i += 1)
+
#endif /* __LINUX_BVEC_ITER_H */