summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2016-10-10 01:16:58 -0800
committerKent Overstreet <kent.overstreet@gmail.com>2016-10-10 01:17:02 -0800
commitae51f287770eb254ec26ff7473dd644c88e0c858 (patch)
tree32e2ac62fd85417d31019bb5c9f917e378630161
parent600be0300fbb72662ef6fe2fac4b612279c9dc7f (diff)
bcache: move ratelimit accounting to more sensible location
-rw-r--r--drivers/md/bcache/move.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/md/bcache/move.c b/drivers/md/bcache/move.c
index 37091d458cb4..dbe48b7e309c 100644
--- a/drivers/md/bcache/move.c
+++ b/drivers/md/bcache/move.c
@@ -556,18 +556,12 @@ static void __bch_data_move(struct closure *cl)
struct moving_io *io = container_of(cl, struct moving_io, cl);
struct cache_set *c = io->write.op.c;
struct extent_pick_ptr pick;
- u64 size = io->write.key.k.size;
bch_extent_pick_ptr_avoiding(c, bkey_i_to_s_c(&io->write.key),
io->context->avoid, &pick);
if (IS_ERR_OR_NULL(pick.ca))
closure_return_with_destructor(cl, moving_io_destructor);
- io->context->keys_moved++;
- io->context->sectors_moved += size;
- if (io->context->rate)
- bch_ratelimit_increment(io->context->rate, size);
-
bio_set_op_attrs(&io->rbio.bio, REQ_OP_READ, 0);
io->rbio.bio.bi_iter.bi_sector = bkey_start_offset(&io->write.key.k);
io->rbio.bio.bi_end_io = read_moving_endio;
@@ -599,8 +593,14 @@ void bch_data_move(struct moving_queue *q,
struct moving_context *ctxt,
struct moving_io *io)
{
+ unsigned size = io->write.key.k.size;
bool stopped = false;
+ ctxt->keys_moved++;
+ ctxt->sectors_moved += size;
+ if (ctxt->rate)
+ bch_ratelimit_increment(ctxt->rate, size);
+
BUG_ON(q->wq == NULL);
io->q = q;
io->context = ctxt;