[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 16/24] block: Make zero-after-EOF work with large
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH v2 16/24] block: Make zero-after-EOF work with larger alignment |
Date: |
Fri, 13 Dec 2013 14:22:51 +0100 |
Odd file sizes could make bdrv_aligned_preadv() shorten the request in
non-aligned ways. Fix it by rounding to the required alignment instead
of 512 bytes.
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/block.c b/block.c
index b4f6ead..6dddb7c 100644
--- a/block.c
+++ b/block.c
@@ -2725,7 +2725,7 @@ err:
*/
static int coroutine_fn bdrv_aligned_preadv(BlockDriverState *bs,
BdrvTrackedRequest *req, int64_t offset, unsigned int bytes,
- QEMUIOVector *qiov, int flags)
+ int64_t align, QEMUIOVector *qiov, int flags)
{
BlockDriver *drv = bs->drv;
int ret;
@@ -2773,7 +2773,7 @@ static int coroutine_fn
bdrv_aligned_preadv(BlockDriverState *bs,
}
total_sectors = DIV_ROUND_UP(len, BDRV_SECTOR_SIZE);
- max_nb_sectors = MAX(0, total_sectors - sector_num);
+ max_nb_sectors = MAX(0, ROUND_UP(total_sectors - sector_num, align));
if (max_nb_sectors > 0) {
ret = drv->bdrv_co_readv(bs, sector_num,
MIN(nb_sectors, max_nb_sectors), qiov);
@@ -2858,7 +2858,7 @@ static int coroutine_fn
bdrv_co_do_preadv(BlockDriverState *bs,
}
tracked_request_begin(&req, bs, offset, bytes, false);
- ret = bdrv_aligned_preadv(bs, &req, offset, bytes,
+ ret = bdrv_aligned_preadv(bs, &req, offset, bytes, align,
use_local_qiov ? &local_qiov : qiov,
flags);
tracked_request_end(&req);
--
1.8.1.4
- Re: [Qemu-devel] [PATCH v2 08/24] raw: Probe required direct I/O alignment, (continued)
- [Qemu-devel] [PATCH v2 05/24] block: Detect unaligned length in bdrv_qiov_is_aligned(), Kevin Wolf, 2013/12/13
- [Qemu-devel] [PATCH v2 09/24] block: Introduce bdrv_aligned_preadv(), Kevin Wolf, 2013/12/13
- [Qemu-devel] [PATCH v2 10/24] block: Introduce bdrv_co_do_preadv(), Kevin Wolf, 2013/12/13
- [Qemu-devel] [PATCH v2 11/24] block: Introduce bdrv_aligned_pwritev(), Kevin Wolf, 2013/12/13
- [Qemu-devel] [PATCH v2 12/24] block: write: Handle COR dependency after I/O throttling, Kevin Wolf, 2013/12/13
- [Qemu-devel] [PATCH v2 13/24] block: Introduce bdrv_co_do_pwritev(), Kevin Wolf, 2013/12/13
- [Qemu-devel] [PATCH v2 14/24] block: Switch BdrvTrackedRequest to byte granularity, Kevin Wolf, 2013/12/13
- [Qemu-devel] [PATCH v2 16/24] block: Make zero-after-EOF work with larger alignment,
Kevin Wolf <=
- [Qemu-devel] [PATCH v2 15/24] block: Allow waiting for overlapping requests between begin/end, Kevin Wolf, 2013/12/13
- [Qemu-devel] [PATCH v2 17/24] block: Generalise and optimise COR serialisation, Kevin Wolf, 2013/12/13
- [Qemu-devel] [PATCH v2 19/24] block: Allow wait_serialising_requests() at any point, Kevin Wolf, 2013/12/13
- [Qemu-devel] [PATCH v2 18/24] block: Make overlap range for serialisation dynamic, Kevin Wolf, 2013/12/13
- [Qemu-devel] [PATCH v2 20/24] block: Align requests in bdrv_co_do_pwritev(), Kevin Wolf, 2013/12/13
- [Qemu-devel] [PATCH v2 21/24] block: Change coroutine wrapper to byte granularity, Kevin Wolf, 2013/12/13
- [Qemu-devel] [PATCH v2 22/24] block: Make bdrv_pread() a bdrv_prwv_co() wrapper, Kevin Wolf, 2013/12/13
- [Qemu-devel] [PATCH v2 24/24] iscsi: Set bs->request_alignment, Kevin Wolf, 2013/12/13
- [Qemu-devel] [PATCH v2 23/24] block: Make bdrv_pwrite() a bdrv_prwv_co() wrapper, Kevin Wolf, 2013/12/13