Skip to content

Commit 22551da

Browse files
LenovoOpenLabSasha Levin
authored andcommitted
dm writecache: correct uncommitted_block when discarding uncommitted entry
commit 39495b1 upstream. When uncommitted entry has been discarded, correct wc->uncommitted_block for getting the exact number. Fixes: 48debaf ("dm: add writecache target") Cc: [email protected] Signed-off-by: Huaisheng Ye <[email protected]> Acked-by: Mikulas Patocka <[email protected]> Signed-off-by: Mike Snitzer <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 301cca2 commit 22551da

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/md/dm-writecache.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,8 @@ static void writecache_discard(struct dm_writecache *wc, sector_t start, sector_
857857
writecache_wait_for_ios(wc, WRITE);
858858
discarded_something = true;
859859
}
860+
if (!writecache_entry_is_committed(wc, e))
861+
wc->uncommitted_blocks--;
860862
writecache_free_entry(wc, e);
861863
}
862864

0 commit comments

Comments
 (0)