From: Benjamin Marzinski <bmarzins@redhat.com>
To: Keith Busch <kbusch@meta.com>
Cc: dm-devel@lists.linux.dev, mpatocka@redhat.com,
snitzer@kernel.org, Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCH 1/3] dm-integrity: fix mismatched queue limits
Date: Fri, 27 Mar 2026 15:41:50 -0400 [thread overview]
Message-ID: <acbdfhN8AT7p4qrN@redhat.com> (raw)
In-Reply-To: <20260325193608.2827042-1-kbusch@meta.com>
On Wed, Mar 25, 2026 at 12:36:06PM -0700, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
>
> A user can integritysetup a device with a backing device using a 4k
> logical block size, but request the dm device use 1k or 2k. This
> mismatch creates an inconsistency such that the dm device would report
> limits for IO that it can't actually execute. Fix this by using the
> backing device's limits if they are larger.
>
> Signed-off-by: Keith Busch <kbusch@kernel.org>
> ---
> drivers/md/dm-integrity.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
> index 06e805902151c..8dfd498ed1ffd 100644
> --- a/drivers/md/dm-integrity.c
> +++ b/drivers/md/dm-integrity.c
> @@ -4047,9 +4047,15 @@ static void dm_integrity_io_hints(struct dm_target *ti, struct queue_limits *lim
> struct dm_integrity_c *ic = ti->private;
>
> if (ic->sectors_per_block > 1) {
> - limits->logical_block_size = ic->sectors_per_block << SECTOR_SHIFT;
> - limits->physical_block_size = ic->sectors_per_block << SECTOR_SHIFT;
> - limits->io_min = ic->sectors_per_block << SECTOR_SHIFT;
> + limits->logical_block_size =
> + max(limits->logical_block_size,
> + ic->sectors_per_block << SECTOR_SHIFT);
> + limits->physical_block_size =
> + max(limits->physical_block_size,
> + ic->sectors_per_block << SECTOR_SHIFT);
> + limits->io_min =
> + max(limits->io_min,
> + ic->sectors_per_block << SECTOR_SHIFT);
> limits->dma_alignment = limits->logical_block_size - 1;
> limits->discard_granularity = ic->sectors_per_block << SECTOR_SHIFT;
Shouldn't this also respect the underlying device's discard_granularity?
-Ben
> }
> --
> 2.52.0
>
next prev parent reply other threads:[~2026-03-27 19:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 19:36 [PATCH 1/3] dm-integrity: fix mismatched queue limits Keith Busch
2026-03-25 19:36 ` [PATCH 2/3] dm-integrity: always set the io hints Keith Busch
2026-03-25 19:36 ` [PATCH 3/3] dm: provide helper to set stacked limits Keith Busch
2026-03-27 19:41 ` Benjamin Marzinski [this message]
2026-03-27 20:36 ` [PATCH 1/3] dm-integrity: fix mismatched queue limits Keith Busch
2026-03-30 17:41 ` Benjamin Marzinski
2026-03-30 18:16 ` Keith Busch
2026-03-27 21:25 ` Mikulas Patocka
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=acbdfhN8AT7p4qrN@redhat.com \
--to=bmarzins@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=kbusch@kernel.org \
--cc=kbusch@meta.com \
--cc=mpatocka@redhat.com \
--cc=snitzer@kernel.org \
/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.