diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2015-05-18 16:16:57 -0700 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2016-10-07 12:34:14 -0800 |
commit | 5552ba76380e532f79c565bf0c3af828a2e00f6d (patch) | |
tree | 0a6af8ab9d4fc5a35b98c8ab7f0be6df259cfc74 | |
parent | f2a8cf015277413e55cbd88c16b1f049d3fbbae5 (diff) |
bcache: bch_bio_free_pages()
-rw-r--r-- | drivers/md/bcache/btree.c | 6 | ||||
-rw-r--r-- | drivers/md/bcache/debug.c | 6 | ||||
-rw-r--r-- | drivers/md/bcache/io.c | 6 | ||||
-rw-r--r-- | drivers/md/bcache/move.c | 9 | ||||
-rw-r--r-- | drivers/md/bcache/util.c | 10 | ||||
-rw-r--r-- | drivers/md/bcache/util.h | 1 |
6 files changed, 16 insertions, 22 deletions
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 2a02b4335db9..b047c7e5dc0e 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -637,12 +637,8 @@ static void __btree_node_write_done(struct closure *cl) static void btree_node_write_done(struct closure *cl) { struct btree *b = container_of(cl, struct btree, io); - struct bio_vec *bv; - int n; - - bio_for_each_segment_all(bv, b->bio, n) - __free_page(bv->bv_page); + bch_bio_free_pages(b->bio); __btree_node_write_done(cl); } diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c index 967420d7c078..e77c4206d6a5 100644 --- a/drivers/md/bcache/debug.c +++ b/drivers/md/bcache/debug.c @@ -148,9 +148,8 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio) { char name[BDEVNAME_SIZE]; struct bio *check; - struct bio_vec bv, *bv2; + struct bio_vec bv; struct bvec_iter iter; - int i; check = bio_clone(bio, GFP_NOIO); if (!check) @@ -177,8 +176,7 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio) kunmap_atomic(p1); } - bio_for_each_segment_all(bv2, check, i) - __free_page(bv2->bv_page); + bch_bio_free_pages(check); out_put: bio_put(check); } diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c index 4d176caf097a..5c501c27e573 100644 --- a/drivers/md/bcache/io.c +++ b/drivers/md/bcache/io.c @@ -778,17 +778,13 @@ static void cache_promote_done(struct closure *cl) struct cache_promote_op *op = container_of(cl, struct cache_promote_op, cl); struct cache_set *c = op->iop.c; - int i; - struct bio_vec *bv; if (op->iop.replace_collision) { trace_bcache_promote_collision(&op->iop.replace_info.key.k); atomic_inc(&c->accounting.collector.cache_miss_collisions); } - bio_for_each_segment_all(bv, op->iop.bio, i) - __free_page(bv->bv_page); - + bch_bio_free_pages(op->iop.bio); kfree(op); } diff --git a/drivers/md/bcache/move.c b/drivers/md/bcache/move.c index 18d4204c97eb..9d430b103c78 100644 --- a/drivers/md/bcache/move.c +++ b/drivers/md/bcache/move.c @@ -113,14 +113,7 @@ struct moving_io *moving_io_alloc(struct bkey_s_c k) void moving_io_free(struct moving_io *io) { - struct bio *bio = &io->bio.bio; - struct bio_vec *bv; - int i; - - bio_for_each_segment_all(bv, bio, i) - if (bv->bv_page) - __free_page(bv->bv_page); - + bch_bio_free_pages(&io->bio.bio); kfree(io); } diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c index b87dd213b88b..65de7f96d5b6 100644 --- a/drivers/md/bcache/util.c +++ b/drivers/md/bcache/util.c @@ -379,6 +379,16 @@ start: bv->bv_len = min_t(size_t, PAGE_SIZE - bv->bv_offset, } } +void bch_bio_free_pages(struct bio *bio) +{ + struct bio_vec *bv; + unsigned i; + + bio_for_each_segment_all(bv, bio, i) + if (bv->bv_page) + __free_page(bv->bv_page); +} + /* * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group (Any * use permitted, subject to terms of PostgreSQL license; see.) diff --git a/drivers/md/bcache/util.h b/drivers/md/bcache/util.h index 0704697e762e..fd2934692f05 100644 --- a/drivers/md/bcache/util.h +++ b/drivers/md/bcache/util.h @@ -564,6 +564,7 @@ static inline unsigned fract_exp_two(unsigned x, unsigned fract_bits) } void bch_bio_map(struct bio *bio, void *base); +void bch_bio_free_pages(struct bio *); static inline sector_t bdev_sectors(struct block_device *bdev) { |