From f2a1497b2c53d4e64f77b4a1f7b98c93d96d357d Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Tue, 7 Feb 2012 18:12:19 -0500 Subject: [PATCH 03/12] dm thin metadata: fix dm_thin_remove_block() to decrement the mapped_blocks counter This fixes the accounting for the number of blocks that are mapped by a thin device. The mapped_blocks are used to calculate the number of mapped sectors -- which are displayed in the thin device's status. Signed-off-by: Joe Thornber Acked-by: Mike Snitzer --- drivers/md/dm-thin-metadata.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c index b23d27d..0bc3033 100644 --- a/drivers/md/dm-thin-metadata.c +++ b/drivers/md/dm-thin-metadata.c @@ -1226,6 +1226,8 @@ static int __remove(struct dm_thin_device *td, dm_block_t block) if (r) return r; + td->mapped_blocks--; + td->changed = 1; pmd->need_commit = 1; return 0; -- 1.7.4.4