[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [Qemu-block] [PATCH v2 0/3] block: Warn about usage of

From: Paolo Bonzini
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v2 0/3] block: Warn about usage of growing formats over non-growable protocols
Date: Thu, 07 May 2015 16:16:34 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

On 07/05/2015 16:07, Kevin Wolf wrote:
> This is not right for two reasons: The first is that this is
> BlockBackend code

I think it would take effect for the qemu-nbd case though.

> and it wouldn't even take effect for the qcow2 case
> where we're writing past EOF only on the protocol layer. The second is
> that -ENOSPC is only for writes and not for reads.

This is right.

Reads in the kernel return 0, but in QEMU we do not want that.  The code
currently returns -EIO, but perhaps -EINVAL is a better match.  It also
happens to be what Linux returns for discards.


> For the protocol level, bdrv_aligned_preadv() has code to handle reads
> past EOF if bs->zero_beyond_eof is set. This is always the case, except
> for qcow2, which has the snapshot VM state after EOF, so the driver is
> called for that.
> For writes, the driver is always called. The expectiation is that beyond
> EOF it resizes the image file if it can, and returns -ENOSPC if it can't.
> We could change this to have a check directly in bdrv_aligned_pwrite()
> and then drivers would have to advertise whether they can extend a file
> beyond EOF or not so we know whether to apply the check or not
> (essentially the growable flag that Max wants to add), but I'm not sure
> what we would win with that.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]