Skip to content

Commit 594b9a8

Browse files
Ming Leiaxboe
authored andcommitted
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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent bbcbbd5 commit 594b9a8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

include/linux/bvec.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,9 @@ static inline void mp_bvec_last_segment(const struct bio_vec *bvec,
188188
}
189189
}
190190

191+
#define mp_bvec_for_each_page(pg, bv, i) \
192+
for (i = (bv)->bv_offset / PAGE_SIZE; \
193+
(i <= (((bv)->bv_offset + (bv)->bv_len - 1) / PAGE_SIZE)) && \
194+
(pg = bvec_nth_page((bv)->bv_page, i)); i += 1)
195+
191196
#endif /* __LINUX_BVEC_ITER_H */

0 commit comments

Comments
 (0)