[GEDI] [PATCH v2.5 01/11] block: Expand block status mode from bool to flags
Stefan Hajnoczi
stefanha at redhat.com
Tue Apr 22 14:43:19 UTC 2025
On Fri, Apr 18, 2025 at 04:52:46PM -0500, Eric Blake wrote:
> This patch is purely mechanical, changing bool want_zero into an
> unsigned int for bitwise-or of flags. As of this patch, all
> implementations are unchanged (the old want_zero==true is now
> mode==BDRV_WANT_PRECISE which is a superset of BDRV_WANT_ZERO); but
> the callers in io.c that used to pass want_zero==false are now
> prepared for future driver changes that can now distinguish bewteen
> BDRV_WANT_ZERO vs. BDRV_WANT_ALLOCATED. The next patch will actually
> change the file-posix driver along those lines, now that we have
> more-specific hints.
>
> As for the background why this patch is useful: right now, the
> file-posix driver recognizes that if allocation is being queried, the
> entire image can be reported as allocated (there is no backing file to
> refer to) - but this throws away information on whether the entire
> image reads as zero (trivially true if lseek(SEEK_HOLE) at offset 0
> returns -ENXIO, a bit more complicated to prove if the raw file was
> created with 'qemu-img create' since we intentionally allocate a small
> chunk of all-zero data to help with alignment probing). Later patches
> will add a generic algorithm for seeing if an entire file reads as
> zeroes.
>
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>
> In response to Stefan's ask for what it would look like as a bitmask
> of flags instead of an enum. Only the first two patches of the series
> change.
>
> block/coroutines.h | 4 +--
> include/block/block-common.h | 11 +++++++
> include/block/block_int-common.h | 27 +++++++++--------
> include/block/block_int-io.h | 4 +--
> block/io.c | 51 ++++++++++++++++----------------
> block/blkdebug.c | 6 ++--
> block/copy-before-write.c | 4 +--
> block/file-posix.c | 4 +--
> block/gluster.c | 4 +--
> block/iscsi.c | 6 ++--
> block/nbd.c | 4 +--
> block/null.c | 6 ++--
> block/parallels.c | 6 ++--
> block/qcow.c | 2 +-
> block/qcow2.c | 6 ++--
> block/qed.c | 6 ++--
> block/quorum.c | 4 +--
> block/raw-format.c | 4 +--
> block/rbd.c | 6 ++--
> block/snapshot-access.c | 4 +--
> block/vdi.c | 4 +--
> block/vmdk.c | 2 +-
> block/vpc.c | 2 +-
> block/vvfat.c | 6 ++--
> tests/unit/test-block-iothread.c | 2 +-
> 25 files changed, 99 insertions(+), 86 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 484 bytes
Desc: not available
URL: <http://lists.gluster.org/pipermail/integration/attachments/20250422/6b328b94/attachment.sig>
More information about the integration
mailing list