[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 16/29] block: Make zero-after-EOF work with l
From: |
Benoît Canet |
Subject: |
Re: [Qemu-devel] [PATCH v3 16/29] block: Make zero-after-EOF work with larger alignment |
Date: |
Wed, 22 Jan 2014 20:50:21 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Le Friday 17 Jan 2014 à 15:15:06 (+0100), Kevin Wolf a écrit :
> 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 | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/block.c b/block.c
> index 18dcd43..d7156ce 100644
> --- a/block.c
> +++ b/block.c
> @@ -2730,7 +2730,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;
> @@ -2778,7 +2778,8 @@ 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 >> BDRV_SECTOR_BITS));
> if (max_nb_sectors > 0) {
> ret = drv->bdrv_co_readv(bs, sector_num,
> MIN(nb_sectors, max_nb_sectors), qiov);
> @@ -2864,7 +2865,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
>
>
Reviewed-by: Benoit Canet <address@hidden>
- Re: [Qemu-devel] [PATCH v3 07/29] block: rename buffer_alignment to guest_block_size, (continued)
- [Qemu-devel] [PATCH v3 11/29] block: Introduce bdrv_aligned_pwritev(), Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 12/29] block: write: Handle COR dependency after I/O throttling, Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 13/29] block: Introduce bdrv_co_do_pwritev(), Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 16/29] block: Make zero-after-EOF work with larger alignment, Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 14/29] block: Switch BdrvTrackedRequest to byte granularity, Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 15/29] block: Allow waiting for overlapping requests between begin/end, Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 17/29] block: Generalise and optimise COR serialisation, Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 18/29] block: Make overlap range for serialisation dynamic, Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 19/29] block: Allow wait_serialising_requests() at any point, Kevin Wolf, 2014/01/17