Skip to content

Commit

Permalink
dm writecache: commit just one block, not a full page
Browse files Browse the repository at this point in the history
Some architectures have pages larger than 4k and committing a full
page causes needless overhead.

Fix this by writing a single block when committing the superblock.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
  • Loading branch information
Mikulas Patocka authored and Mike Snitzer committed Jun 14, 2021
1 parent 620cbe4 commit 991bd8d
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions drivers/md/dm-writecache.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,11 +532,7 @@ static void ssd_commit_superblock(struct dm_writecache *wc)

region.bdev = wc->ssd_dev->bdev;
region.sector = 0;
region.count = PAGE_SIZE >> SECTOR_SHIFT;

if (unlikely(region.sector + region.count > wc->metadata_sectors))
region.count = wc->metadata_sectors - region.sector;

region.count = wc->block_size >> SECTOR_SHIFT;
region.sector += wc->start_sector;

req.bi_op = REQ_OP_WRITE;
Expand Down

0 comments on commit 991bd8d

Please sign in to comment.