]> git.baikalelectronics.ru Git - kernel.git/commitdiff
dm writecache: fix performance degradation in ssd mode
authorMikulas Patocka <mpatocka@redhat.com>
Sat, 23 Jan 2021 14:19:56 +0000 (09:19 -0500)
committerMike Snitzer <snitzer@redhat.com>
Wed, 3 Feb 2021 15:10:05 +0000 (10:10 -0500)
Fix a thinko in ssd_commit_superblock. region.count is in sectors, not
bytes. This bug doesn't corrupt data, but it causes performance
degradation.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: 1eae940b9d6f ("dm writecache: optimize superblock write")
Cc: stable@vger.kernel.org # v5.7+
Reported-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-writecache.c

index d5223a0e5cc51e309c93ab035b2f54fd7ce7d69c..1769653c3d6b4fdd2f368e477b916629ccd7c70c 100644 (file)
@@ -523,7 +523,7 @@ static void ssd_commit_superblock(struct dm_writecache *wc)
 
        region.bdev = wc->ssd_dev->bdev;
        region.sector = 0;
-       region.count = PAGE_SIZE;
+       region.count = PAGE_SIZE >> SECTOR_SHIFT;
 
        if (unlikely(region.sector + region.count > wc->metadata_sectors))
                region.count = wc->metadata_sectors - region.sector;