Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dm writecache: count number of blocks discarded, not number of discard bios

Change dm-writecache, so that it counts the number of blocks discarded
instead of the number of discard bios. Make it consistent with the
read and write statistics counters that were changed to count the
number of blocks instead of bios.

Fixes: e3a35d03407c ("dm writecache: add event counters")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>

authored by

Mikulas Patocka and committed by
Mike Snitzer
2ee73ef6 b2676e14

+2 -2
+1 -1
Documentation/admin-guide/device-mapper/writecache.rst
··· 89 89 11. the number of write blocks that are allocated in the cache 90 90 12. the number of write requests that are blocked on the freelist 91 91 13. the number of flush requests 92 - 14. the number of discard requests 92 + 14. the number of discarded blocks 93 93 94 94 Messages: 95 95 flush
+1 -1
drivers/md/dm-writecache.c
··· 1514 1514 1515 1515 static enum wc_map_op writecache_map_discard(struct dm_writecache *wc, struct bio *bio) 1516 1516 { 1517 - wc->stats.discards++; 1517 + wc->stats.discards += bio->bi_iter.bi_size >> wc->block_size_bits; 1518 1518 1519 1519 if (writecache_has_error(wc)) 1520 1520 return WC_MAP_ERROR;