diff options
author | Tang Junhui <tang.junhui.linux@gmail.com> | 2018-10-08 20:41:12 +0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-10-08 08:19:45 -0600 |
commit | 2e17a262a2371d38d2ec03614a2675a32cef9912 (patch) | |
tree | c2f24d6514474fabf05c17855cc263e7653fbfbb | |
parent | 4516da427fcf214af7d826273ab275f1d6e56ef0 (diff) | |
download | linux-2e17a262a2371d38d2ec03614a2675a32cef9912.tar.bz2 |
bcache: correct dirty data statistics
When bcache device is clean, dirty keys may still exist after
journal replay, so we need to count these dirty keys even
device in clean status, otherwise after writeback, the amount
of dirty data would be incorrect.
Signed-off-by: Tang Junhui <tang.junhui.linux@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | drivers/md/bcache/super.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 9de6695195bf..c116b6e0d85a 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1153,11 +1153,12 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c, } if (BDEV_STATE(&dc->sb) == BDEV_STATE_DIRTY) { - bch_sectors_dirty_init(&dc->disk); atomic_set(&dc->has_dirty, 1); bch_writeback_queue(dc); } + bch_sectors_dirty_init(&dc->disk); + bch_cached_dev_run(dc); bcache_device_link(&dc->disk, c, "bdev"); atomic_inc(&c->attached_dev_nr); |