mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 21:51:05 +00:00
block: introduce bio_for_each_bvec() and rq_for_each_bvec()
bio_for_each_bvec() is used for iterating over multi-page bvec for bio split & merge code. rq_for_each_bvec() can be used for drivers which may handle the multi-page bvec directly, so far loop is one perfect use case. Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Omar Sandoval <osandov@fb.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
3d75ca0ade
commit
d18d91740a
2 changed files with 14 additions and 0 deletions
|
@ -156,6 +156,16 @@ static inline void bio_advance_iter(struct bio *bio, struct bvec_iter *iter,
|
|||
#define bio_for_each_segment(bvl, bio, iter) \
|
||||
__bio_for_each_segment(bvl, bio, iter, (bio)->bi_iter)
|
||||
|
||||
#define __bio_for_each_bvec(bvl, bio, iter, start) \
|
||||
for (iter = (start); \
|
||||
(iter).bi_size && \
|
||||
((bvl = mp_bvec_iter_bvec((bio)->bi_io_vec, (iter))), 1); \
|
||||
bio_advance_iter((bio), &(iter), (bvl).bv_len))
|
||||
|
||||
/* iterate over multi-page bvec */
|
||||
#define bio_for_each_bvec(bvl, bio, iter) \
|
||||
__bio_for_each_bvec(bvl, bio, iter, (bio)->bi_iter)
|
||||
|
||||
#define bio_iter_last(bvec, iter) ((iter).bi_size == (bvec).bv_len)
|
||||
|
||||
static inline unsigned bio_segments(struct bio *bio)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue