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>2017-01-18 21:40:36 -0900
commite6ac24ff645a2a88c47ad1177ba90bfc2400f346 (patch)
treef96603e5c81f5911d95819f67de2bf7308f5b93e
parent75f0e89aa60c46a5f31c3bf83ebbdb54952c4549 (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 6577fa8473f5..ef9288686a74 100644
--- a/drivers/md/bcache/move.c
+++ b/drivers/md/bcache/move.c
@@ -562,18 +562,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;
@@ -605,8 +599,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;