From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50444) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPAAa-0006MH-W7 for qemu-devel@nongnu.org; Thu, 26 Sep 2013 07:55:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VPAAU-0000QV-NP for qemu-devel@nongnu.org; Thu, 26 Sep 2013 07:55:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48817) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPAAU-0000QO-Ax for qemu-devel@nongnu.org; Thu, 26 Sep 2013 07:55:38 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8QBtb2u011027 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 26 Sep 2013 07:55:37 -0400 From: Fam Zheng Date: Thu, 26 Sep 2013 19:55:33 +0800 Message-Id: <1380196533-18525-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH] block: use DIV_ROUND_UP in bdrv_co_do_readv List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com Signed-off-by: Fam Zheng --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.c b/block.c index ea4956d..fe7b060 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_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, -- 1.8.3.1