Skip to content

Commit

Permalink
block: introduce mp_bvec_for_each_page() for iterating over page
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Ming Lei authored and axboe committed Feb 28, 2019
1 parent bbcbbd5 commit 594b9a8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/linux/bvec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit 594b9a8

Please sign in to comment.