From: Benjamin Marzinski <bmarzins@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Uladzislau Rezki <urezki@gmail.com>,
Alasdair Kergon <agk@redhat.com>, DMML <dm-devel@lists.linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
Mike Snitzer <snitzer@redhat.com>, Christoph Hellwig <hch@lst.de>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RESEND PATCH] dm-ebs: Mark full buffer dirty even on partial write
Date: Tue, 18 Nov 2025 09:15:48 -0500 [thread overview]
Message-ID: <aRx_lCimJco5BPKA@redhat.com> (raw)
In-Reply-To: <73556fc8-5fbf-37cb-26b9-7cdb88f69720@redhat.com>
On Tue, Nov 18, 2025 at 01:00:36PM +0100, Mikulas Patocka wrote:
>
>
> On Tue, 18 Nov 2025, Uladzislau Rezki wrote:
>
> > Hello, Mikulas!
> >
> > > Hi
> > >
> > > What is the logical_block_size of the underlying nvme device? - i.e.
> > > what's the content of this file
> > > /sys/block/nvme0n1/queue/logical_block_size in the virtual machine?
> > >
> > It is 512. Whereas a physical is bigger, i.e. my device can not perform
> > I/O by 512 granularity.
>
> And what is physical block size? Is it 8192?
>
> > As for virtual machine, i just simulated the problem so people can set
> > it up and check. The commit message describes how it can be reproduced.
> >
> > The dm-ebs target which i setup does ebs to ubs conversion, so the NVME
> > driver gets BIOs are in size and aligned to ubs size. The ubs size
> > corresponds to the underlying physical device I/O size.
> >
> > So your patch does not work if logical < physical. Therefore it does
> > not help my project.
>
> Logical block size is the granularity at which the device can accept I/O.
> Physical block size is the block size on the medium.
>
> If logical < physical, then the device performs read-modify-write cycle
> when writing blocks that are not aligned at physical block size.
>
> So, your setup is broken, because it advertises logical block size 512,
> but it is not able to perform I/O at this granularity.
This emulated nvme device is broken, but the question still remains,
"should dm-ebs enfore writing at the alignment that was specified in its
table line?" If you don't specify a ubs in the table line, it defaults
to the logical block size. So, if you do specify a ubs, it stands to
reason that you want IO at that alignment, instead of the logical-block
size (perhaps because your device is broken, and advertises the wrong
logical block size).
So, I think that Uladzislau's patch makes sense, in addition to your
own.
-Ben
> There is this piece of code in include/linux/blkdev.h:
> #ifdef CONFIG_TRANSPARENT_HUGEPAGE
> /*
> * We should strive for 1 << (PAGE_SHIFT + MAX_PAGECACHE_ORDER)
> * however we constrain this to what we can validate and test.
> */
> #define BLK_MAX_BLOCK_SIZE SZ_64K
> #else
> #define BLK_MAX_BLOCK_SIZE PAGE_SIZE
> #endif
>
> /* blk_validate_limits() validates bsize, so drivers don't usually need to */
> static inline int blk_validate_block_size(unsigned long bsize)
> {
> if (bsize < 512 || bsize > BLK_MAX_BLOCK_SIZE || !is_power_of_2(bsize))
> return -EINVAL;
>
> return 0;
> }
>
> What happens when you define CONFIG_TRANSPARENT_HUGEPAGE in your .config?
> Does it fix the problem with small logical block size for you?
>
> Mikulas
>
> > --
> > Uladzislau Rezki
> >
>
next prev parent reply other threads:[~2025-11-18 14:15 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-17 10:59 [RESEND PATCH] dm-ebs: Mark full buffer dirty even on partial write Uladzislau Rezki (Sony)
2025-11-17 20:48 ` Mikulas Patocka
2025-11-18 11:39 ` Uladzislau Rezki
2025-11-18 12:00 ` Mikulas Patocka
2025-11-18 12:40 ` Uladzislau Rezki
2025-11-18 12:46 ` Christoph Hellwig
2025-11-18 14:15 ` Benjamin Marzinski [this message]
2025-11-18 17:21 ` Mikulas Patocka
2025-11-19 5:46 ` Christoph Hellwig
2025-11-19 8:43 ` Uladzislau Rezki
2025-11-19 8:53 ` Christoph Hellwig
2025-11-19 8:57 ` Uladzislau Rezki
2025-11-19 9:00 ` Christoph Hellwig
2025-11-19 9:01 ` Uladzislau Rezki
2025-11-19 9:05 ` Christoph Hellwig
2025-11-19 9:13 ` Uladzislau Rezki
2025-11-19 9:17 ` Christoph Hellwig
2025-11-19 17:26 ` Mikulas Patocka
2025-11-20 6:21 ` Christoph Hellwig
2025-11-20 12:08 ` Uladzislau Rezki
2025-11-20 12:40 ` Uladzislau Rezki
2025-11-21 7:25 ` Christoph Hellwig
2025-11-21 7:24 ` Christoph Hellwig
2025-11-21 13:21 ` Uladzislau Rezki
2025-11-21 16:48 ` Benjamin Marzinski
2025-11-24 10:43 ` Uladzislau Rezki
2025-11-24 14:30 ` Christoph Hellwig
2025-11-24 15:30 ` Uladzislau Rezki
2025-11-24 17:00 ` Christoph Hellwig
2025-11-24 18:05 ` Uladzislau Rezki
-- strict thread matches above, loose matches on Subject: below --
2025-10-14 14:47 Uladzislau Rezki (Sony)
2025-10-16 19:59 ` Andrew Morton
2025-10-17 15:55 ` Uladzislau Rezki
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=aRx_lCimJco5BPKA@redhat.com \
--to=bmarzins@redhat.com \
--cc=agk@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dm-devel@lists.linux.dev \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=snitzer@redhat.com \
--cc=urezki@gmail.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.