]> git.proxmox.com Git - qemu.git/commitdiff
raw-posix: report unwritten extents as zero
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 4 Sep 2013 17:00:36 +0000 (19:00 +0200)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 6 Sep 2013 13:25:09 +0000 (15:25 +0200)
These are created for example with XFS_IOC_ZERO_RANGE.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/raw-posix.c

index d011cfdab6747b69708d5fbfdf46d640df374cd7..1b41ea335695ff5f89d57f2f15bbfc602c3602de 100644 (file)
@@ -1128,6 +1128,9 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs,
     } else {
         data = f.fe.fe_logical;
         hole = f.fe.fe_logical + f.fe.fe_length;
+        if (f.fe.fe_flags & FIEMAP_EXTENT_UNWRITTEN) {
+            ret |= BDRV_BLOCK_ZERO;
+        }
     }
 
 #elif defined SEEK_HOLE && defined SEEK_DATA