From ae51f287770eb254ec26ff7473dd644c88e0c858 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Mon, 10 Oct 2016 01:16:58 -0800 Subject: bcache: move ratelimit accounting to more sensible location --- drivers/md/bcache/move.c | 12 ++++++------ 1 file 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; -- cgit v1.2.3