Skip to content

Commit 2c6e755

Browse files
Mikulas PatockaMike Snitzer
authored andcommitted
dm writecache: count number of blocks read, not number of read bios
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: e3a35d0 ("dm writecache: add event counters") Reported-by: Yu Kuai <[email protected]> Signed-off-by: Mikulas Patocka <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent 9bc0c92 commit 2c6e755

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Documentation/admin-guide/device-mapper/writecache.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ Status:
8080
2. the number of blocks
8181
3. the number of free blocks
8282
4. the number of blocks under writeback
83-
5. the number of read requests
84-
6. the number of read requests that hit the cache
83+
5. the number of read blocks
84+
6. the number of read blocks that hit the cache
8585
7. the number of write requests
8686
8. the number of write requests that hit uncommitted block
8787
9. the number of write requests that hit committed block

drivers/md/dm-writecache.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,6 +1365,7 @@ static enum wc_map_op writecache_map_read(struct dm_writecache *wc, struct bio *
13651365
}
13661366
} else {
13671367
writecache_map_remap_origin(wc, bio, e);
1368+
wc->stats.reads += (bio->bi_iter.bi_size - wc->block_size) >> wc->block_size_bits;
13681369
map_op = WC_MAP_REMAP_ORIGIN;
13691370
}
13701371

0 commit comments

Comments
 (0)