Skip to contentSkip to conversation

block: use DIV_ROUND_UP in bdrv_co_do_readv

PATCH Applied Fam Zheng 3 participants 3 messages Sep 26, 2013

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH 1/1 block: use DIV_ROUND_UP in bdrv_co_do_readv

---
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block.c +1 -1
index ea4956d..fe7b060 100644
@@ -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,
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Fam Zheng
---
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block.c +0 -0
index ea4956d..fe7b060 100644

block.c static int coroutine_fn bdrv_co_do_readv(BlockDriverState *bs, · line 2672

Quoted 5 lines
block.c +1 -1
@@ -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);
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Applied
#2 lore raw

Am 26.09.2013 um 14:05 hat Eric Blake geschrieben:

Quoted 14 lines · Fam Zheng
Quoted 13 lines
---
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block.c +0 -0
index ea4956d..fe7b060 100644
@@ -2669,7 +2669,7 @@ static int coroutine_fn bdrv_co_do_readv(BlockDriverState *bs,
             goto out;
         }
 
Quoted 4 lines

block.c static int coroutine_fn bdrv_co_do_readv(BlockDriverState *bs, · line 2672

Quoted 2 lines
block.c +1 -1
-        total_sectors = (len + BDRV_SECTOR_SIZE - 1) >> BDRV_SECTOR_BITS;
+        total_sectors = DIV_ROUND_UP(len, BDRV_SECTOR_SIZE);

Thanks, applied to the block branch.

Kevin