diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-09-25 15:23:29 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2019-09-25 15:23:50 -0400 |
commit | db39aa3e1b528db3b9d731c3b054f27411e1e1a9 (patch) | |
tree | 1fad2b9a5f66cd9d7b7096c53604de691c47f26c /include/linux/bio.h | |
parent | ceee9244dedcca3df57b76fafb772207cdfbd6ee (diff) |
Update bcachefs sources to 5a3a4087af bcachefs: Convert a BUG_ON() to a warning
Diffstat (limited to 'include/linux/bio.h')
-rw-r--r-- | include/linux/bio.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index e93341e6..cdbbcb39 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -113,13 +113,17 @@ static inline void *bio_data(struct bio *bio) #define __bio_kunmap_atomic(addr) kunmap_atomic(addr) -struct bvec_iter_all { - unsigned done; -}; +static inline struct bio_vec *bio_next_segment(const struct bio *bio, + struct bvec_iter_all *iter) +{ + if (iter->idx >= bio->bi_vcnt) + return NULL; + + return &bio->bi_io_vec[iter->idx]; +} -#define bio_for_each_segment_all(bvl, bio, i, iter) \ - for (i = 0, bvl = (bio)->bi_io_vec, iter = (struct bvec_iter_all) { 0 }; \ - i < (bio)->bi_vcnt; i++, bvl++) +#define bio_for_each_segment_all(bvl, bio, iter) \ + for ((iter).idx = 0; (bvl = bio_next_segment((bio), &(iter))); (iter).idx++) static inline void bio_advance_iter(struct bio *bio, struct bvec_iter *iter, unsigned bytes) |