]> git.baikalelectronics.ru Git - kernel.git/commitdiff
dm writecache: count number of blocks discarded, not number of discard bios
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 11 Jul 2022 20:31:52 +0000 (16:31 -0400)
committerMike Snitzer <snitzer@kernel.org>
Thu, 14 Jul 2022 19:54:46 +0000 (15:54 -0400)
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: 2f3825b88d33 ("dm writecache: add event counters")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Documentation/admin-guide/device-mapper/writecache.rst
drivers/md/dm-writecache.c

index 0772d2160f9c722c59f658c8b38ac6555e0c6d10..60c16b7fd5ac0c1552653739d614d2d98216cb13 100644 (file)
@@ -89,7 +89,7 @@ Status:
 11. the number of write blocks that are allocated in the cache
 12. the number of write requests that are blocked on the freelist
 13. the number of flush requests
-14. the number of discard requests
+14. the number of discarded blocks
 
 Messages:
        flush
index 6282c77abe7b402f8814c9d416f12b915d299362..ead008ea38f2fc52c53b82685056a5e66302cb55 100644 (file)
@@ -1514,7 +1514,7 @@ static enum wc_map_op writecache_map_flush(struct dm_writecache *wc, struct bio
 
 static enum wc_map_op writecache_map_discard(struct dm_writecache *wc, struct bio *bio)
 {
-       wc->stats.discards++;
+       wc->stats.discards += bio->bi_iter.bi_size >> wc->block_size_bits;
 
        if (writecache_has_error(wc))
                return WC_MAP_ERROR;