thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
Blob Blame History Raw
From e58d84de9cb73fba1b98c57edc63e751b4171c4e Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Fri, 18 Oct 2013 08:14:45 +0200
Subject: [PATCH 20/81] raw-posix: report unwritten extents as zero

RH-Author: Paolo Bonzini <pbonzini@redhat.com>
Message-id: <1382084091-16636-21-git-send-email-pbonzini@redhat.com>
Patchwork-id: 55003
O-Subject: [RHEL 7.0 qemu-kvm PATCH 20/26] raw-posix: report unwritten extents as zero
Bugzilla: 989646
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Max Reitz <mreitz@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>

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>
(cherry picked from commit f5f7abcfd50bca38ae278a9c7a3ed60fba3d76dc)
---
 block/raw-posix.c | 3 +++
 1 file changed, 3 insertions(+)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 block/raw-posix.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/block/raw-posix.c b/block/raw-posix.c
index a829ce0..c7ab908 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -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
-- 
1.7.1