Skip to contentSkip to conversation

dm writecache: commit just one block, not a full page

PATCH New Mikulas Patocka 1 participant 2 messages Jun 21, 2021 Device mapper

lore
Share & tools
lore

Mikulas Patocka

author maintainer
#0 lore raw

cover dm writecache: commit just one block, not a full page

Hi Mike

I suggest to remove the patch 991bd8d7bc78966b4dc427b53a144f276bffcd52 ("dm writecache: commit just one block, not a full page") from your repository and replace it with this patch.

Sub-4k writes have poor performance with most SSDs, so we should make sure that we write at least 4k.

Mikulas

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

author maintainer
#1 lore raw

PATCH 1/1 dm writecache: commit just one block, not a full page

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.

Writes smaller than 4k are slow on most SSDs (because the SSD performs read-modify-write internally), so make sure that we write at least 4k.

drivers/md/dm-writecache.c +1 -1
Index: linux-2.6/drivers/md/dm-writecache.c
===================================================================
@@ -532,7 +532,7 @@ static void ssd_commit_superblock(struct
 
 	region.bdev = wc->ssd_dev->bdev;
 	region.sector = 0;
-	region.count = PAGE_SIZE >> SECTOR_SHIFT;
+	region.count = max(4096U, wc->block_size) >> SECTOR_SHIFT;
 
 	if (unlikely(region.sector + region.count > wc->metadata_sectors))
 		region.count = wc->metadata_sectors - region.sector;

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel