On 2022/09/13 15:36, Keith Busch wrote: > On Tue, Sep 13, 2022 at 03:20:23PM +0100, Damien Le Moal wrote: >> On 2022/09/13 15:12, Keith Busch wrote: >>> On Thu, Sep 08, 2022 at 09:45:26AM -0700, Keith Busch wrote: >>>> From: Keith Busch <kbu...@kernel.org> >>>> >>>> An iov length needs to be aligned to the logical block size, which may >>>> be larger than the memory alignment. >>> >>> [cc'ing some other interested folks] >>> >>> Any thoughts on this patch? It is fixing an observed IO error when running >>> virtio-blk with the default 512b logical block size backed by a drive >>> formatted >>> with 4k logical block. >> >> The patch look OK to me, but having virtio expose a 512B LBA size for a >> backing >> device that has 4K LBAs will break all IOs if caching is turned off (direct >> IOs >> case), even if this patch is applied. No ? > > Yeah, it's just the default. I don't think anyone would do that on purpose > since it's so sub-optimal from a performance stand-point. As a follow up > patch, > perhaps if the logical_block_size parameter is not provided, we should default > to the backing device's block size?
That sound like a reasonable approach to me. Note that I was not talking about the sub-optimal read-modify-write pattern for IOs not aligned on the backend device sector boundaries, but rather thinking about no IOs working at all if QEMU is started without caching (cache.direct=on option) -- Damien Le Moal Western Digital Research