Received: from eggs.gnu.org ([2001:4830:134:3::10]:40116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erKyA-0006Ji-K4 for qemu-devel@nongnu.org; Thu, 01 Mar 2018 04:57:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erKy5-0005L8-Oq for qemu-devel@nongnu.org; Thu, 01 Mar 2018 04:57:46 -0500 References: <20180213202701.15858-1-eblake@redhat.com> <20180213202701.15858-10-eblake@redhat.com> <20180214120525.GB4766@localhost.localdomain> <20180223170525.GF3470@localhost.localdomain> <010d7d4e-c6d1-f8fb-8c4c-7aa0b19a94b7@redhat.com> <20180226140518.GA5106@localhost.localdomain> <1724b4e9-ff78-9725-286e-6886704f7f13@virtuozzo.com> <20180301094808.GA4862@localhost.localdomain> From: Vladimir Sementsov-Ogievskiy Message-ID: Date: Thu, 1 Mar 2018 12:57:23 +0300 MIME-Version: 1.0 In-Reply-To: <20180301094808.GA4862@localhost.localdomain> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [Qemu-devel] [PATCH v8 09/21] null: Switch to .bdrv_co_block_status() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Eric Blake , qemu-devel@nongnu.org, famz@redhat.com, qemu-block@nongnu.org, Max Reitz 01.03.2018 12:48, Kevin Wolf wrote: > Am 01.03.2018 um 08:25 hat Vladimir Sementsov-Ogievskiy geschrieben: >> 26.02.2018 17:05, Kevin Wolf wrote: >>> Essentially, assuming a simple backing chain 'base <- overlay', we got >>> these combinations to represent in NBD (with my suggestion of the flags >>> to use): >>> >>> 1. Cluster allocated in overlay >>> a. non-zero data 0 >>> b. explicit zeroes 0 or ZERO >>> 2. Cluster marked zero in overlay HOLE | ZERO >>> 3. Cluster preallocated/zero in overlay ZERO >>> 4. Cluster unallocated in overlay >>> a. Cluster allocated in base (non-zero) HOLE >>> b. Cluster allocated in base (zero) HOLE or HOLE | ZERO >>> c. Cluster marked zero in base HOLE | ZERO >>> d. Cluster preallocated/zero in base HOLE | ZERO >>> e. Cluster unallocated in base HOLE | ZERO >>> >>> Instead of 'base' you can read 'anywhere in the backing chain' and the >>> flags should stay the same. >> I think only "anywhere in the backing chain" is valid here. Otherwise, >> semantics of bdrv_is_allocated would differ for NBD and for not-NBD. > This was meant as a mapping from cases to flags, not the other way > round, so really doesn't say anything about the cases where the block is > allocated further down the chain. > > But yes, it shouldn't make a difference where in the backing chain a > block is allocated, so these cases are the same as 4. > >> I think, if bdrv_is_allocated returns false, it means that we can skip >> this region in copying process, am I right? > -ENOCONTEXT? Which copying process? > > There are cases where you want to copy such regions, and other cases > where you want to skip them. It depends on the use case. For example, > 'qemu-img convert' skips them with -B (because the backing file is > reused), but not without -B (which creates a full copy). > > Kevin Hm, I thought that bdrv_is_allocated loops through backings, but it doesn't, sorry. -- Best regards, Vladimir