Re: Block alignment of qcow2 compress driver

2022-02-01 Thread Vladimir Sementsov-Ogievskiy
28.01.2022 14:07, Richard W.M. Jones wrote: The commands below set up a sparse RAM disk, with an allocated block at offset 32K and another one at offset 1M-32K. Then it tries to copy this to a compressed qcow2 file using qemu-nbd + the qemu compress filter: $ qemu-img create -f qcow2 output.

Re: Block alignment of qcow2 compress driver

2022-01-28 Thread Eric Blake
Adding libnbd list (libguestfs) in cc On Fri, Jan 28, 2022 at 11:56:19AM +, Richard W.M. Jones wrote: > > I hacked nbdcopy to ignore block alignment (the error actually comes > from libnbd refusing to send the unaligned request, not from > qemu-nbd), and indeed qemu-nbd accepts the unaligned

Re: Block alignment of qcow2 compress driver

2022-01-28 Thread Eric Blake
On Fri, Jan 28, 2022 at 01:30:53PM +, Richard W.M. Jones wrote: > > > > In qcow2, only the whole cluster can be compressed, so writing > > compressed data means having to write the whole cluster.  qcow2 > > could implement the padding by itself, but we decided to just leave > > the burden of o

Re: Block alignment of qcow2 compress driver

2022-01-28 Thread Richard W.M. Jones
On Fri, Jan 28, 2022 at 01:30:43PM +0100, Hanna Reitz wrote: > On 28.01.22 13:18, Richard W.M. Jones wrote: > >On Fri, Jan 28, 2022 at 12:57:47PM +0100, Hanna Reitz wrote: > >>On 28.01.22 12:48, Richard W.M. Jones wrote: > >>>On Fri, Jan 28, 2022 at 12:39:11PM +0100, Hanna Reitz wrote: > So I

Re: Block alignment of qcow2 compress driver

2022-01-28 Thread Richard W.M. Jones
On Fri, Jan 28, 2022 at 01:30:53PM +, Richard W.M. Jones wrote: > I feel like this may be a bug in what qemu-nbd advertises. Currently > it is: Ignore this email, see other reply. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and

Re: Block alignment of qcow2 compress driver

2022-01-28 Thread Richard W.M. Jones
On Fri, Jan 28, 2022 at 02:19:44PM +0100, Kevin Wolf wrote: > Am 28.01.2022 um 13:30 hat Hanna Reitz geschrieben: > > > > I just changed that line of code [2], as shown in [4].  I suppose > > > > the better thing to do would be to have an option for the NBD server > > > > to force-change the announ

Re: Block alignment of qcow2 compress driver

2022-01-28 Thread Kevin Wolf
Am 28.01.2022 um 13:30 hat Hanna Reitz geschrieben: > > > I just changed that line of code [2], as shown in [4].  I suppose > > > the better thing to do would be to have an option for the NBD server > > > to force-change the announced request alignment, because it can > > > expect the qemu block la

Re: Block alignment of qcow2 compress driver

2022-01-28 Thread Hanna Reitz
On 28.01.22 13:18, Richard W.M. Jones wrote: On Fri, Jan 28, 2022 at 12:57:47PM +0100, Hanna Reitz wrote: On 28.01.22 12:48, Richard W.M. Jones wrote: On Fri, Jan 28, 2022 at 12:39:11PM +0100, Hanna Reitz wrote: So I actually don’t know why it works for you.  OTOH, I don’t understand why the b

Re: Block alignment of qcow2 compress driver

2022-01-28 Thread Hanna Reitz
On 28.01.22 12:48, Richard W.M. Jones wrote: On Fri, Jan 28, 2022 at 12:39:11PM +0100, Hanna Reitz wrote: So I actually don’t know why it works for you.  OTOH, I don’t understand why the block size affects you over NBD, because I would have expected qemu to internally auto-align requests when th

Re: Block alignment of qcow2 compress driver

2022-01-28 Thread Richard W.M. Jones
On Fri, Jan 28, 2022 at 12:57:47PM +0100, Hanna Reitz wrote: > On 28.01.22 12:48, Richard W.M. Jones wrote: > >On Fri, Jan 28, 2022 at 12:39:11PM +0100, Hanna Reitz wrote: > >>So I actually don’t know why it works for you.  OTOH, I don’t > >>understand why the block size affects you over NBD, becau

Re: Block alignment of qcow2 compress driver

2022-01-28 Thread Richard W.M. Jones
I hacked nbdcopy to ignore block alignment (the error actually comes from libnbd refusing to send the unaligned request, not from qemu-nbd), and indeed qemu-nbd accepts the unaligned request without complaint. Eric - maybe having some flag for nbdcopy to ignore unaligned requests when we know th

Re: Block alignment of qcow2 compress driver

2022-01-28 Thread Richard W.M. Jones
On Fri, Jan 28, 2022 at 12:39:11PM +0100, Hanna Reitz wrote: > So I actually don’t know why it works for you.  OTOH, I don’t > understand why the block size affects you over NBD, because I would > have expected qemu to internally auto-align requests when they are > not aligned (in bdrv_co_pwritev_p

Re: Block alignment of qcow2 compress driver

2022-01-28 Thread Hanna Reitz
On 28.01.22 12:07, Richard W.M. Jones wrote: The commands below set up a sparse RAM disk, with an allocated block at offset 32K and another one at offset 1M-32K. Then it tries to copy this to a compressed qcow2 file using qemu-nbd + the qemu compress filter: $ qemu-img create -f qcow2 output

Block alignment of qcow2 compress driver

2022-01-28 Thread Richard W.M. Jones
The commands below set up a sparse RAM disk, with an allocated block at offset 32K and another one at offset 1M-32K. Then it tries to copy this to a compressed qcow2 file using qemu-nbd + the qemu compress filter: $ qemu-img create -f qcow2 output.qcow2 1M $ qemu-nbd -t --image-opts driver=c