[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aQDCmAPfpIGZiceo@milan>
Date: Tue, 28 Oct 2025 14:18:16 +0100
From: Uladzislau Rezki <urezki@...il.com>
To: Mikulas Patocka <mpatocka@...hat.com>
Cc: Mikulas Patocka <mpatocka@...hat.com>, Alasdair Kergon <agk@...hat.com>,
DMML <dm-devel@...ts.linux.dev>,
Andrew Morton <akpm@...ux-foundation.org>,
Mike Snitzer <snitzer@...hat.com>, Christoph Hellwig <hch@....de>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] dm-bufio: align write boundary on bdev_logical_block_size
On Tue, Oct 28, 2025 at 09:47:40AM +0100, Uladzislau Rezki wrote:
> Hello!
>
> Sorry i have missed you email for unknown reason to me. It is
> probably because you answered to email with different subject
> i sent initially.
>
> >
> > On Mon, 20 Oct 2025, Uladzislau Rezki (Sony) wrote:
> >
> > > When performing a read-modify-write(RMW) operation, any modification
> > > to a buffered block must cause the entire buffer to be marked dirty.
> > >
> > > Marking only a subrange as dirty is incorrect because the underlying
> > > device block size(ubs) defines the minimum read/write granularity. A
> > > lower device can perform I/O only on regions which are fully aligned
> > > and sized to ubs.
> >
> > Hi
> >
> > I think it would be better to fix this in dm-bufio, so that other dm-bufio
> > users would also benefit from the fix. Please try this patch - does it fix
> > it?
> >
> If it solves what i describe i do not mind :)
>
> >
> >
> > From: Mikulas Patocka <mpatocka@...hat.com>
> >
> > There may be devices with logical block size larger than 4k. Fix
> > dm-bufio, so that it will align I/O on logical block size. This commit
> > fixes I/O errors on the dm-ebs target on the top of emulated nvme device
> > with 8k logical block size created with qemu parameters:
> >
> > -device nvme,drive=drv0,serial=foo,logical_block_size=8192,physical_block_size=8192
> >
> > Signed-off-by: Mikulas Patocka <mpatocka@...hat.com>
> > Cc: stable@...r.kernel.org
> >
> > ---
> > drivers/md/dm-bufio.c | 9 +++++----
> > 1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > Index: linux-2.6/drivers/md/dm-bufio.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/md/dm-bufio.c 2025-10-13 21:42:47.000000000 +0200
> > +++ linux-2.6/drivers/md/dm-bufio.c 2025-10-20 14:40:32.000000000 +0200
> > @@ -1374,7 +1374,7 @@ static void submit_io(struct dm_buffer *
> > {
> > unsigned int n_sectors;
> > sector_t sector;
> > - unsigned int offset, end;
> > + unsigned int offset, end, align;
> >
> > b->end_io = end_io;
> >
> > @@ -1388,9 +1388,10 @@ static void submit_io(struct dm_buffer *
> > b->c->write_callback(b);
> > offset = b->write_start;
> > end = b->write_end;
> > - offset &= -DM_BUFIO_WRITE_ALIGN;
> > - end += DM_BUFIO_WRITE_ALIGN - 1;
> > - end &= -DM_BUFIO_WRITE_ALIGN;
> > + align = max(DM_BUFIO_WRITE_ALIGN, bdev_logical_block_size(b->c->bdev));
>
Should it be physical_block_size of device? It is a min_io the device
can perform. The point is, a user sets "ubs" size which should correspond
to the smallest I/O the device can write, i.e. physically.
--
Uladzislau Rezki
Powered by blists - more mailing lists