Skip to content

Commit 9e9f19e

Browse files
Tang Junhuigregkh
authored andcommitted
bcache: correct dirty data statistics
commit 2e17a26 upstream. 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 <[email protected]> Cc: [email protected] Signed-off-by: Coly Li <[email protected]> Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 32870e2 commit 9e9f19e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/md/bcache/super.c

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

11501150
if (BDEV_STATE(&dc->sb) == BDEV_STATE_DIRTY) {
1151-
bch_sectors_dirty_init(&dc->disk);
11521151
atomic_set(&dc->has_dirty, 1);
11531152
bch_writeback_queue(dc);
11541153
}
11551154

1155+
bch_sectors_dirty_init(&dc->disk);
1156+
11561157
bch_cached_dev_run(dc);
11571158
bcache_device_link(&dc->disk, c, "bdev");
11581159
atomic_inc(&c->attached_dev_nr);

0 commit comments

Comments
 (0)