From: Fam Zheng Date: Thu, 26 Sep 2013 11:55:33 +0000 (+0800) Subject: block: use DIV_ROUND_UP in bdrv_co_do_readv X-Git-Tag: v1.7.0-rc0~84^2~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d055a1fec37ec84fd3e87d48a0e766a9ff8369c4;p=thirdparty%2Fqemu.git block: use DIV_ROUND_UP in bdrv_co_do_readv Signed-off-by: Fam Zheng Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- diff --git a/block.c b/block.c index 4833b37ab80..93e113ad7c0 100644 --- a/block.c +++ b/block.c @@ -2653,7 +2653,7 @@ static int coroutine_fn bdrv_co_do_readv(BlockDriverState *bs, goto out; } - total_sectors = (len + BDRV_SECTOR_SIZE - 1) >> BDRV_SECTOR_BITS; + total_sectors = DIV_ROUND_UP(len, BDRV_SECTOR_SIZE); max_nb_sectors = MAX(0, total_sectors - sector_num); if (max_nb_sectors > 0) { ret = drv->bdrv_co_readv(bs, sector_num,