summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShenghui Wang <shhuiw@foxmail.com>2018-10-08 20:41:15 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-24 08:23:22 +0100
commit5750a2d4939d6f82bfd7edf1a77e3844898ac3cf (patch)
tree134619ed22d1896be60233dda509570090b1ae55
parent784505c2378a1d96a4c97d2ec055ececfdcf4914 (diff)
bcache: recal cached_dev_sectors on detach
[ Upstream commit 46010141da6677b81cc77f9b47f8ac62bd1cbfd3 ] Recal cached_dev_sectors on cached_dev detached, as recal done on cached_dev attached. Update the cached_dev_sectors before bcache_device_detach called as bcache_device_detach will set bcache_device->c to NULL. Signed-off-by: Shenghui Wang <shhuiw@foxmail.com> Signed-off-by: Coly Li <colyli@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/md/bcache/super.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 1a270e2262f5..690aeb09bbf5 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -905,6 +905,7 @@ static void cached_dev_detach_finish(struct work_struct *w)
bch_write_bdev_super(dc, &cl);
closure_sync(&cl);
+ calc_cached_dev_sectors(dc->disk.c);
bcache_device_detach(&dc->disk);
list_move(&dc->list, &uncached_devices);