On Wed 10 Jun 2020 02:04:22 PM CEST, Vladimir Sementsov-Ogievskiy wrote: > + * The top layer deferred to this layer, and because this layer > is > + * short, any zeroes that we synthesize beyond EOF behave as if > they > + * were allocated at this layer > */ > + assert(ret & BDRV_BLOCK_EOF); > *pnum = bytes; > + if (file) { > + *file = p; > + } > + return BDRV_BLOCK_ZERO | BDRV_BLOCK_ALLOCATED;
You don't add BDRV_BLOCK_EOF to the return code here ? > + res = bdrv_block_status_above(bs, NULL, offset, bytes, &nr, NULL, > NULL); > + offset += nr; > + bytes -= nr; > + } while (res >= 0 && (res & BDRV_BLOCK_ZERO) && nr && bytes); About this last "... && nr && bytes", I think 'nr' already implies 'bytes', maybe you want to use an assertion instead? Berto