From: Uladzislau Rezki <urezki@gmail.com>
To: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Uladzislau Rezki <urezki@gmail.com>,
Christoph Hellwig <hch@lst.de>,
Mikulas Patocka <mpatocka@redhat.com>,
Alasdair Kergon <agk@redhat.com>, DMML <dm-devel@lists.linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
Mike Snitzer <snitzer@redhat.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RESEND PATCH] dm-ebs: Mark full buffer dirty even on partial write
Date: Mon, 24 Nov 2025 11:43:46 +0100 [thread overview]
Message-ID: <aSQ24uN3A7PAo7VY@pc636> (raw)
In-Reply-To: <aSCX7MNcRBWwrD6g@redhat.com>
> On Fri, Nov 21, 2025 at 02:21:34PM +0100, Uladzislau Rezki wrote:
> > On Fri, Nov 21, 2025 at 08:24:21AM +0100, Christoph Hellwig wrote:
> > > On Thu, Nov 20, 2025 at 01:08:57PM +0100, Uladzislau Rezki wrote:
> > > > Could you please check below? Is the last one is correctly reported?
> > >
> > > The latter looks unexpected, but is is becase qemu is not passing through
> > > the qemu physical_block_size attribute to any of the nvme settings Linux
> > > interprets as such for NVMe (NVMe doesn't actually have the concept of
> > > a physical block size, unlike SCSI/ATA):
> > >
> > OK, understood and thank you for checking this.
> >
> > >
> > > root@testvm:~# nvme id-ns -H /dev/nvme0n1 | grep npw
> > > npwg : 0
> > > npwa : 0
> > > root@testvm:~# nvme id-ns -H /dev/nvme0n1 | grep naw
> > > nawun : 0
> > > nawupf : 0
> > > root@testvm:~# nvme id-ctrl -H /dev/nvme0 | grep awupf
> > > awupf : 0
> > >
> > > but as said multiple times, that should not really matter - the logical
> > > block size is the granularity of I/O, the physical block size is just
> > > a performance hint.
> > >
> > Right.
> >
> > As stated in commit message of the patch which is in question. 8K
> > emulated in qemu device with CONFIG_TRANSPARENT_HUGEPAGE=y:
> >
> > urezki@pc638:~$ sudo nvme list
> > Node Generic SN Model Namespace Usage Format FW Rev
> > --------------------- --------------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
> > /dev/nvme0n1 /dev/ng0n1 foo QEMU NVMe Ctrl 1 8.49 GB / 8.49 GB 8 KiB + 0 B 10.0.6
> > urezki@pc638:~$ cat bin/dmsetup.sh
> > #!/bin/bash
> >
> > lower=/dev/nvme0n1
> > len=$(blockdev --getsz "$lower")
> >
> > echo "0 $len ebs $lower 0 1 16" | dmsetup create nvme-8k
> > urezki@pc638:~$ sudo bin/dmsetup.sh
> > urezki@pc638:~$ sudo cat /sys/block/nvme0n1/queue/logical_block_size
> > 8192
> > urezki@pc638:~$ sudo cat /sys/block/nvme0n1/queue/physical_block_size
> > 8192
> > urezki@pc638:~$ sudo cat /sys/block/dm-0/queue/logical_block_size
> > 512
> > urezki@pc638:~$ sudo cat /sys/block/dm-0/queue/physical_block_size
> > 8192
> > urezki@pc638:~$ sudo mkfs.ext4 -F /dev/dm-0
> > mke2fs 1.47.0 (5-Feb-2023)
> > /dev/dm-0 contains a ext4 file system
> > last mounted on Fri Nov 21 12:22:55 2025
> > Discarding device blocks: done
> > Creating filesystem with 2072576 4k blocks and 518144 inodes
> > Filesystem UUID: f71adb05-c020-4406-bc0d-bdb9e5c29af7
> > Superblock backups stored on blocks:
> > 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
> >
> > Allocating group tables: done
> > Writing inode tables: done
> > Creating journal (16384 blocks): done
> > Writing superblocks and filesystem accounting information: mkfs.ext4: Input/output error while writing out and closing file system
> > urezki@pc638:~$ sudo dmesg | grep -i "i/o"
> > [ 71.813322] Buffer I/O error on dev dm-0, logical block 10, lost async page write
> > [ 71.813373] Buffer I/O error on dev dm-0, logical block 11, lost async page write
> > [ 71.813395] Buffer I/O error on dev dm-0, logical block 12, lost async page write
> > [ 71.813415] Buffer I/O error on dev dm-0, logical block 13, lost async page write
> > [ 71.813433] Buffer I/O error on dev dm-0, logical block 14, lost async page write
> > [ 71.813451] Buffer I/O error on dev dm-0, logical block 15, lost async page write
> > [ 71.813475] Buffer I/O error on dev dm-0, logical block 16, lost async page write
> > [ 71.813493] Buffer I/O error on dev dm-0, logical block 17, lost async page write
> > [ 71.813516] Buffer I/O error on dev dm-0, logical block 18, lost async page write
> > [ 71.813537] Buffer I/O error on dev dm-0, logical block 19, lost async page write
> > urezki@pc638:~$
> >
> > with the patch:
> >
> > urezki@pc638:~$ sudo nvme list
> > Node Generic SN Model Namespace Usage Format FW Rev
> > --------------------- --------------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
> > /dev/nvme0n1 /dev/ng0n1 foo QEMU NVMe Ctrl 1 8.49 GB / 8.49 GB 8 KiB + 0 B 10.0.6
> > urezki@pc638:~$ cat bin/dmsetup.sh
> > #!/bin/bash
> >
> > lower=/dev/nvme0n1
> > len=$(blockdev --getsz "$lower")
> >
> > echo "0 $len ebs $lower 0 1 16" | dmsetup create nvme-8k
> > urezki@pc638:~$ sudo bin/dmsetup.sh
> > urezki@pc638:~$ sudo cat /sys/block/nvme0n1/queue/logical_block_size
> > 8192
> > urezki@pc638:~$ sudo cat /sys/block/nvme0n1/queue/physical_block_size
> > 8192
> > urezki@pc638:~$ sudo cat /sys/block/dm-0/queue/logical_block_size
> > 512
> > urezki@pc638:~$ sudo cat /sys/block/dm-0/queue/physical_block_size
> > 8192
> > urezki@pc638:~$ sudo mkfs.ext4 -F /dev/dm-0
> > mke2fs 1.47.0 (5-Feb-2023)
> > Discarding device blocks: done
> > Creating filesystem with 2072576 4k blocks and 518144 inodes
> > Filesystem UUID: c7dff4c7-aa7e-4c94-98ee-f9ea2da92a06
> > Superblock backups stored on blocks:
> > 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
> >
> > Allocating group tables: done
> > Writing inode tables: done
> > Creating journal (16384 blocks): done
> > Writing superblocks and filesystem accounting information: done
> >
> > urezki@pc638:~$ sudo mount /dev/dm-0 /mnt/
> > urezki@pc638:~$ ls -al /mnt/
> > total 24
> > drwxr-xr-x 3 root root 4096 Nov 21 12:22 .
> > drwxr-xr-x 19 root root 4096 Jul 10 19:42 ..
> > drwx------ 2 root root 16384 Nov 21 12:22 lost+found
> > urezki@pc638:~$
> >
> > How do we solve this?
> >
> > Mikulas proposed to use below patch:
> >
> > <snip>
> > 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));
> > + offset &= -align;
> > + end += align - 1;
> > + end &= -align;
> > if (unlikely(end > b->c->block_size))
> > end = b->c->block_size;
> > <snip>
> >
> > and it fixes the setup which i described in the commit message, but i
> > have question.
> >
> > Why in dm-ebs we need to offload partial buffer < ubf size?
>
> Um, did you notice that Mikulas accepted your patch?
>
I saw, he mentioned that and i am glad that during this discussion
we came to one more extra patch. I got the feeling that there were
misunderstanding between us, so i decided to make it more clear
that is it.
Thank you.
--
Uladzislau Rezki
next prev parent reply other threads:[~2025-11-24 10:43 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
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 [this message]
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=aSQ24uN3A7PAo7VY@pc636 \
--to=urezki@gmail.com \
--cc=agk@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bmarzins@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=snitzer@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox