Re: [RESEND PATCH] dm-ebs: Mark full buffer dirty even on partial write

Uladzislau Rezki
2025-11-24T15:30:30Z

On Mon, Nov 24, 2025 at 03:30:44PM +0100, Christoph Hellwig wrote:
> On Fri, Nov 21, 2025 at 02:21:34PM +0100, Uladzislau Rezki wrote:
> > - 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.
>
> And this patch, using bdev_logical_block_size looks correct.
>
> >
> > Why in dm-ebs we need to offload partial buffer < ubf size?
>
> I don't understand this question. What is ubf? What does partial
> buffer mean in this context, and what does offload mean?
>
That was a typo :) i meant ubs - which is underlying block size or number
of sectors which define the logical block size of the device. In our case
it is 8K thus is 16 = 512 * 16 = 8K.

Partial buffer means, in context of dm-ebs, that within 8K buffer only
part of it can be modified. For example, since we emulate 512B to 8K
from upper layer to the device, a file system can write for example
just first 4K within 8K window buffer and only that part is marked as
dirty.

offloading or imposing the data to the lower layer. i.e. writing dirty
buffers to the device calling submit_io().

Is it better? It might be that i missed something, feel free to correct.

--
Uladzislau Rezki