Skip to content

Commit 2e17a26

Browse files
Tang Junhuiaxboe
authored andcommitted
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>
1 parent 4516da4 commit 2e17a26

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎drivers/md/bcache/super.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,11 +1153,12 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c,
11531153
}
11541154

11551155
if (BDEV_STATE(&dc->sb) == BDEV_STATE_DIRTY) {
1156-
bch_sectors_dirty_init(&dc->disk);
11571156
atomic_set(&dc->has_dirty, 1);
11581157
bch_writeback_queue(dc);
11591158
}
11601159

1160+
bch_sectors_dirty_init(&dc->disk);
1161+
11611162
bch_cached_dev_run(dc);
11621163
bcache_device_link(&dc->disk, c, "bdev");
11631164
atomic_inc(&c->attached_dev_nr);

0 commit comments

Comments
 (0)