diff mbox

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

Message ID 1464609599-7495-1-git-send-email-pl@kamp.de (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Lieven May 30, 2016, 11:59 a.m. UTC
at least bdrv_co_preadv/pwritev expect this.

Signed-off-by: Peter Lieven <pl@kamp.de>
---
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Blake May 31, 2016, 6:28 p.m. UTC | #1
On 05/30/2016 05:59 AM, Peter Lieven wrote:
> at least bdrv_co_preadv/pwritev expect this.
> 
> Signed-off-by: Peter Lieven <pl@kamp.de>
> ---
>  block.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

And my work on converting write_zeroes to a byte interface will also
exploit it.
Kevin Wolf June 2, 2016, 2:47 p.m. UTC | #2
Am 30.05.2016 um 13:59 hat Peter Lieven geschrieben:
> at least bdrv_co_preadv/pwritev expect this.
> 
> Signed-off-by: Peter Lieven <pl@kamp.de>

Thanks, applied to the block branch.

Kevin
diff mbox

Patch

diff --git a/block.c b/block.c
index 736432f..f54bc25 100644
--- a/block.c
+++ b/block.c
@@ -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;