]> git.baikalelectronics.ru Git - kernel.git/commitdiff
dm writecache: count number of blocks read, not number of read bios
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 11 Jul 2022 20:30:52 +0000 (16:30 -0400)
committerMike Snitzer <snitzer@kernel.org>
Thu, 14 Jul 2022 19:52:32 +0000 (15:52 -0400)
Change dm-writecache, so that it counts the number of blocks read
instead of the number of read bios. Bios can be split and requeued
using the dm_accept_partial_bio function, so counting bios caused
inaccurate results.

Fixes: 2f3825b88d33 ("dm writecache: add event counters")
Reported-by: Yu Kuai <yukuai1@huaweicloud.com>
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 2104812f028129f55b6c6d6a5768adae20e3d4a4..1fab82408ef15929745e9539e79a38a99daf3fa6 100644 (file)
@@ -80,8 +80,8 @@ Status:
 2. the number of blocks
 3. the number of free blocks
 4. the number of blocks under writeback
-5. the number of read requests
-6. the number of read requests that hit the cache
+5. the number of read blocks
+6. the number of read blocks that hit the cache
 7. the number of write requests
 8. the number of write requests that hit uncommitted block
 9. the number of write requests that hit committed block
index 9e14717c46a987632b72d9baeaf41074e22b3d5e..a551be5f9b4b5dafaba6a4e320c2007290a74a94 100644 (file)
@@ -1365,6 +1365,7 @@ read_next_block:
                }
        } else {
                writecache_map_remap_origin(wc, bio, e);
+               wc->stats.reads += (bio->bi_iter.bi_size - wc->block_size) >> wc->block_size_bits;
                map_op = WC_MAP_REMAP_ORIGIN;
        }