Blame SOURCES/kvm-block-don-t-lose-data-from-last-incomplete-sector.patch

218e99
From f0623f334b23dc9334ac9d227cc467c266b8b2c6 Mon Sep 17 00:00:00 2001
218e99
From: Fam Zheng <famz@redhat.com>
218e99
Date: Wed, 9 Oct 2013 09:50:21 +0200
218e99
Subject: [PATCH 09/11] block: don't lose data from last incomplete sector
218e99
218e99
RH-Author: Fam Zheng <famz@redhat.com>
218e99
Message-id: <1381312223-7074-2-git-send-email-famz@redhat.com>
218e99
Patchwork-id: 54793
218e99
O-Subject: [RHEL-7 qemu-kvm PATCH 1/3] block: don't lose data from last incomplete sector
218e99
Bugzilla: 1017049
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
218e99
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
218e99
To read the last sector that is not aligned to sector boundary, current
218e99
code for growable backends, since commit 893a8f6 "block: Produce zeros
218e99
when protocols reading beyond end of file", drops the data and directly
218e99
returns zeroes. That is incorrect.
218e99
218e99
Signed-off-by: Fam Zheng <famz@redhat.com>
218e99
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
218e99
(cherry picked from commit bcb9d66e8590151967e1dbe3724eec7ec71392e0)
218e99
Signed-off-by: Fam Zheng <famz@redhat.com>
218e99
---
218e99
 block.c | 2 +-
218e99
 1 file changed, 1 insertion(+), 1 deletion(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 block.c |    2 +-
218e99
 1 files changed, 1 insertions(+), 1 deletions(-)
218e99
218e99
diff --git a/block.c b/block.c
218e99
index a3bc800..bd52c13 100644
218e99
--- a/block.c
218e99
+++ b/block.c
218e99
@@ -2567,7 +2567,7 @@ static int coroutine_fn bdrv_co_do_readv(BlockDriverState *bs,
218e99
             goto out;
218e99
         }
218e99
 
218e99
-        total_sectors = len >> BDRV_SECTOR_BITS;
218e99
+        total_sectors = (len + BDRV_SECTOR_SIZE - 1) >> BDRV_SECTOR_BITS;
218e99
         max_nb_sectors = MAX(0, total_sectors - sector_num);
218e99
         if (max_nb_sectors > 0) {
218e99
             ret = drv->bdrv_co_readv(bs, sector_num,
218e99
-- 
218e99
1.7.1
218e99