[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/11] block: don't lose data from last incomplete se
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 09/11] block: don't lose data from last incomplete sector |
Date: |
Fri, 20 Sep 2013 19:42:09 +0200 |
From: Fam Zheng <address@hidden>
To read the last sector that is not aligned to sector boundary, current
code for growable backends, since commit 893a8f6 "block: Produce zeros
when protocols reading beyond end of file", drops the data and directly
returns zeroes. That is incorrect.
Signed-off-by: Fam Zheng <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block.c b/block.c
index e176c6f..ea4956d 100644
--- a/block.c
+++ b/block.c
@@ -2669,7 +2669,7 @@ static int coroutine_fn bdrv_co_do_readv(BlockDriverState
*bs,
goto out;
}
- total_sectors = len >> BDRV_SECTOR_BITS;
+ total_sectors = (len + BDRV_SECTOR_SIZE - 1) >> BDRV_SECTOR_BITS;
max_nb_sectors = MAX(0, total_sectors - sector_num);
if (max_nb_sectors > 0) {
ret = drv->bdrv_co_readv(bs, sector_num,
--
1.8.3.1
- [Qemu-devel] [PULL 00/11] Block patches, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 01/11] libcacard: link against qemu-error.o for error_report(), Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 02/11] osdep: warn if open(O_DIRECT) on fails with EINVAL, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 03/11] qemu-timer: drop outdated signal safety comments, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 04/11] qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 05/11] qemu-timer: do not take the lock in timer_pending, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 06/11] coroutine: add qemu_coroutine_yield benchmark, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 07/11] coroutine: fix /perf/nesting coroutine benchmark, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 08/11] qcow2: Correct snapshots size for overlap check, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 09/11] block: don't lose data from last incomplete sector,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 10/11] blockdev: do not default cache.no-flush to true, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 11/11] virtio-blk: do not relay a previous driver's WCE configuration to the current, Stefan Hajnoczi, 2013/09/20