Skip to contentSkip to conversation

block: assert that bs->request_alignment is a power of 2

PATCH Applied Peter Lieven 3 participants 3 messages May 30, 2016 – Jun 2, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: assert that bs->request_alignment is a power of 2

at least bdrv_co_preadv/pwritev expect this.

---
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block.c +1 -1
index 736432f..f54bc25 100644
@@ -1018,7 +1018,7 @@ static int bdrv_open_common(BlockDriverState *bs, BdrvChild *file,
 
     assert(bdrv_opt_mem_align(bs) != 0);
     assert(bdrv_min_mem_align(bs) != 0);
-    assert((bs->request_alignment != 0) || bdrv_is_sg(bs));
+    assert(is_power_of_2(bs->request_alignment) || bdrv_is_sg(bs));
 
     qemu_opts_del(opts);
     return 0;
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Peter Lieven

at least bdrv_co_preadv/pwritev expect this.

---
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

And my work on converting write_zeroes to a byte interface will also exploit it.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org