summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/md/bcache/bcache.h6
-rw-r--r--drivers/md/bcache/btree.c2
-rw-r--r--drivers/md/bcache/io.c32
-rw-r--r--drivers/md/bcache/move.c2
-rw-r--r--drivers/md/bcache/request.c4
5 files changed, 19 insertions, 27 deletions
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h
index 5639c46c66bd..8fa4574b1705 100644
--- a/drivers/md/bcache/bcache.h
+++ b/drivers/md/bcache/bcache.h
@@ -1007,9 +1007,9 @@ struct bio *bch_bbio_alloc(struct cache_set *);
void bch_generic_make_request(struct bio *, struct cache_set *);
void bch_bio_submit_work(struct work_struct *);
-void __bch_bbio_prep(struct bbio *, struct cache_set *);
-void bch_submit_bbio(struct bbio *, struct cache_set *,
- struct bkey *, unsigned);
+void bch_bbio_prep(struct bbio *, struct cache_set *);
+void bch_submit_bbio(struct bbio *, struct cache_set *, struct bkey *,
+ unsigned, bool);
void bch_submit_bbio_replicas(struct bio *, struct cache_set *,
struct bkey *, unsigned long *, bool);
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
index 7aca747f5c09..2d94768da5f8 100644
--- a/drivers/md/bcache/btree.c
+++ b/drivers/md/bcache/btree.c
@@ -337,7 +337,7 @@ static void bch_btree_node_read(struct btree *b)
bch_bio_map(&bio->bio, b->keys.set[0].data);
- bch_submit_bbio(bio, b->c, &b->key, ptr);
+ bch_submit_bbio(bio, b->c, &b->key, ptr, true);
closure_sync(&cl);
diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c
index 954fb76858ca..9c2dd7d45d2e 100644
--- a/drivers/md/bcache/io.c
+++ b/drivers/md/bcache/io.c
@@ -63,25 +63,25 @@ struct bio *bch_bbio_alloc(struct cache_set *c)
return bio;
}
-void __bch_bbio_prep(struct bbio *b, struct cache_set *c)
+void bch_bbio_prep(struct bbio *b, struct cache_set *c)
{
b->bio.bi_iter.bi_sector = PTR_OFFSET(&b->key, 0);
b->bio.bi_bdev = PTR_CACHE(c, &b->key, 0)->bdev;
}
-static void bch_bbio_prep(struct bbio *b, struct cache_set *c,
- struct bkey *k, unsigned ptr)
+void bch_submit_bbio(struct bbio *b, struct cache_set *c,
+ struct bkey *k, unsigned ptr, bool punt)
{
+ struct bio *bio = &b->bio;
+
bch_bkey_copy_single_ptr(&b->key, k, ptr);
- __bch_bbio_prep(b, c);
+ bch_bbio_prep(b, c);
b->submit_time_us = local_clock_us();
-}
-void bch_submit_bbio(struct bbio *b, struct cache_set *c,
- struct bkey *k, unsigned ptr)
-{
- bch_bbio_prep(b, c, k, ptr);
- closure_bio_submit_punt(&b->bio, b->bio.bi_private, c);
+ if (punt)
+ closure_bio_submit_punt(bio, bio->bi_private, c);
+ else
+ closure_bio_submit(bio, bio->bi_private);
}
void bch_submit_bbio_replicas(struct bio *bio_src, struct cache_set *c,
@@ -100,18 +100,10 @@ void bch_submit_bbio_replicas(struct bio *bio_src, struct cache_set *c,
bio->bi_end_io = bio_src->bi_end_io;
bio->bi_private = bio_src->bi_private;
- bch_bbio_prep(to_bbio(bio), c, k, i);
- if (punt)
- closure_bio_submit_punt(bio, bio->bi_private, c);
- else
- closure_bio_submit(bio, bio->bi_private);
+ bch_submit_bbio(to_bbio(bio), c, k, i, punt);
}
- bch_bbio_prep(to_bbio(bio_src), c, k, first);
- if (punt)
- closure_bio_submit_punt(bio_src, bio_src->bi_private, c);
- else
- closure_bio_submit(bio_src, bio_src->bi_private);
+ bch_submit_bbio(to_bbio(bio_src), c, k, first, punt);
}
/* IO errors */
diff --git a/drivers/md/bcache/move.c b/drivers/md/bcache/move.c
index 61968bd6a2b7..9977514055d3 100644
--- a/drivers/md/bcache/move.c
+++ b/drivers/md/bcache/move.c
@@ -89,7 +89,7 @@ void bch_data_move(struct closure *cl)
bio_set_op_attrs(&io->bio.bio, REQ_OP_READ, 0);
io->bio.bio.bi_end_io = read_moving_endio;
- bch_submit_bbio(&io->bio, io->op.c, &io->w->key, ptr);
+ bch_submit_bbio(&io->bio, io->op.c, &io->w->key, ptr, false);
continue_at(cl, write_moving, io->op.c->wq);
}
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index 6889062bd7d3..76c4dd8f7cd1 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -822,7 +822,7 @@ static int bch_read_fn(struct btree_op *b_op, struct btree *b, struct bkey *k)
bch_cut_front(&KEY(op->inode, n->bi_iter.bi_sector, 0), &bbio->key);
bch_cut_back(&KEY(op->inode, bio_end_sector(n), 0), &bbio->key);
- __bch_bbio_prep(bbio, b->c);
+ bch_bbio_prep(bbio, b->c);
cache_promote(b->c, bbio, k, ptr);
@@ -942,7 +942,7 @@ static int cache_lookup_fn(struct btree_op *op, struct btree *b, struct bkey *k)
bch_cut_front(&KEY(s->inode, n->bi_iter.bi_sector, 0), &bbio->key);
bch_cut_back(&KEY(s->inode, bio_end_sector(n), 0), &bbio->key);
- __bch_bbio_prep(bbio, b->c);
+ bch_bbio_prep(bbio, b->c);
n->bi_end_io = bch_cache_read_endio;
n->bi_private = &s->cl;