[PATCH] bcache: correct dirty data statistics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From fb4bdec3fce8016e813b4b8da6e705fb65d910f2 Mon Sep 17 00:00:00 2001
From: Tang Junhui <tang.junhui.linux@xxxxxxxxx>
Date: Sun, 2 Sep 2018 01:22:22 +0800
Subject: [PATCH] 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@xxxxxxxxx>
---
 drivers/md/bcache/super.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 55a3764..c5f0f65 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1139,11 +1139,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);
-- 
1.8.3.1



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux