From: Mikulas Patocka <mpatocka@redhat.com>
To: Mike Snitzer <msnitzer@redhat.com>, Alasdair Kergon <agk@redhat.com>
Cc: dm-devel@redhat.com
Subject: [dm-devel] [PATCH] dm-writecache: write at least 4k when committing
Date: Mon, 21 Jun 2021 14:48:29 -0400 (EDT) [thread overview]
Message-ID: <alpine.LRH.2.02.2106211447120.27222@file01.intranet.prod.int.rdu2.redhat.com> (raw)
SSDs perform badly with sub-4k writes (because they perfrorm
read-modify-write internally), so make sure that we write at least 4k when
committing.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: 991bd8d7bc78 ("dm writecache: commit just one block, not a full page")
Index: linux/drivers/md/dm-writecache.c
===================================================================
--- linux.orig/drivers/md/dm-writecache.c
+++ linux/drivers/md/dm-writecache.c
@@ -533,7 +533,11 @@ static void ssd_commit_superblock(struct
region.bdev = wc->ssd_dev->bdev;
region.sector = 0;
- region.count = wc->block_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;
+
region.sector += wc->start_sector;
req.bi_op = REQ_OP_WRITE;
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
reply other threads:[~2021-06-21 18:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LRH.2.02.2106211447120.27222@file01.intranet.prod.int.rdu2.redhat.com \
--to=mpatocka@redhat.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=msnitzer@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.