qemu-block
[Top][All Lists]
Advanced

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

Reporting absent extents in qcow2 image


From: Nir Soffer
Subject: Reporting absent extents in qcow2 image
Date: Tue, 15 Jun 2021 01:29:58 +0300

oVirt started to use now qemu:allocation-depth meta context.
In the past, we use base:allocation and reported NBD_STATE_HOLE
as a hole, and this broke in qemu 6.0.0.

Now we have NBD_STATE_HOLE from base:allocation, and flags == 0
from qemu:allocation-depth.

We map flags == 0 to  EXTENT_BACKING (1<<3), and merge with the
flags from base:allocation.

EXTENT_BACKING is internal bit not exposed to users. It matches the
backing=true proposed for "qemu-img map", and the BACKING_FILE
bit used qemu-img convert.

We report a hole if:

    flags & NBD_STATE_HOLE and flags & EXTENT_BACKING

But is it really needed to consider NBD_STATE_HOLE?

Looking in nbd/server.c, when depth is reported as 0, we always
get NBD_STATE_HOLE:

        flags = (ret & BDRV_BLOCK_DATA ? 0 : NBD_STATE_HOLE) |
                (ret & BDRV_BLOCK_ZERO ? NBD_STATE_ZERO : 0);

Looks like we should use only qemu:allocation-depth to report holes,
and ignore NBD_STATE_HOLE. Maybe later we can use NBD_STATE_HOLE
to report sparseness (e.g. "allocated": True).

What do you think?

Nir




reply via email to

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