Commit 0fd7263e authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: kill bio_for_each_contig_segment()

With multipage bvecs it's not needed anymore
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 885678f6
...@@ -200,7 +200,7 @@ static struct bch_csum __bch2_checksum_bio(struct bch_fs *c, unsigned type, ...@@ -200,7 +200,7 @@ static struct bch_csum __bch2_checksum_bio(struct bch_fs *c, unsigned type,
kunmap_atomic(p); kunmap_atomic(p);
} }
#else #else
__bio_for_each_contig_segment(bv, bio, *iter, *iter) __bio_for_each_bvec(bv, bio, *iter, *iter)
crc = bch2_checksum_update(type, crc, crc = bch2_checksum_update(type, crc,
page_address(bv.bv_page) + bv.bv_offset, page_address(bv.bv_page) + bv.bv_offset,
bv.bv_len); bv.bv_len);
...@@ -225,7 +225,7 @@ static struct bch_csum __bch2_checksum_bio(struct bch_fs *c, unsigned type, ...@@ -225,7 +225,7 @@ static struct bch_csum __bch2_checksum_bio(struct bch_fs *c, unsigned type,
kunmap_atomic(p); kunmap_atomic(p);
} }
#else #else
__bio_for_each_contig_segment(bv, bio, *iter, *iter) __bio_for_each_bvec(bv, bio, *iter, *iter)
crypto_shash_update(desc, crypto_shash_update(desc,
page_address(bv.bv_page) + bv.bv_offset, page_address(bv.bv_page) + bv.bv_offset,
bv.bv_len); bv.bv_len);
......
...@@ -66,7 +66,7 @@ static struct bbuf __bio_map_or_bounce(struct bch_fs *c, struct bio *bio, ...@@ -66,7 +66,7 @@ static struct bbuf __bio_map_or_bounce(struct bch_fs *c, struct bio *bio,
BUG_ON(bvec_iter_sectors(start) > c->sb.encoded_extent_max); BUG_ON(bvec_iter_sectors(start) > c->sb.encoded_extent_max);
#ifndef CONFIG_HIGHMEM #ifndef CONFIG_HIGHMEM
__bio_for_each_contig_segment(bv, bio, iter, start) { __bio_for_each_bvec(bv, bio, iter, start) {
if (bv.bv_len == start.bi_size) if (bv.bv_len == start.bi_size)
return (struct bbuf) { return (struct bbuf) {
.b = page_address(bv.bv_page) + bv.bv_offset, .b = page_address(bv.bv_page) + bv.bv_offset,
......
...@@ -630,35 +630,6 @@ static inline void memmove_u64s(void *dst, const void *src, ...@@ -630,35 +630,6 @@ static inline void memmove_u64s(void *dst, const void *src,
__memmove_u64s_up(dst, src, u64s); __memmove_u64s_up(dst, src, u64s);
} }
static inline struct bio_vec next_contig_bvec(struct bio *bio,
struct bvec_iter *iter)
{
struct bio_vec bv = bio_iter_iovec(bio, *iter);
bio_advance_iter(bio, iter, bv.bv_len);
#ifndef CONFIG_HIGHMEM
while (iter->bi_size) {
struct bio_vec next = bio_iter_iovec(bio, *iter);
if (page_address(bv.bv_page) + bv.bv_offset + bv.bv_len !=
page_address(next.bv_page) + next.bv_offset)
break;
bv.bv_len += next.bv_len;
bio_advance_iter(bio, iter, next.bv_len);
}
#endif
return bv;
}
#define __bio_for_each_contig_segment(bv, bio, iter, start) \
for (iter = (start); \
(iter).bi_size && \
((bv = next_contig_bvec((bio), &(iter))), 1);)
#define bio_for_each_contig_segment(bv, bio, iter) \
__bio_for_each_contig_segment(bv, bio, iter, (bio)->bi_iter)
void sort_cmp_size(void *base, size_t num, size_t size, void sort_cmp_size(void *base, size_t num, size_t size,
int (*cmp_func)(const void *, const void *, size_t), int (*cmp_func)(const void *, const void *, size_t),
void (*swap_func)(void *, void *, size_t)); void (*swap_func)(void *, void *, size_t));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment