diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2015-05-14 12:35:02 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2015-05-22 09:37:33 +0100 |
commit | a53f1a95f9605f300fbafbc8b60b8a8c67e9c4b4 (patch) | |
tree | afe27076736dd4f812701052227080572dabcf4e /block/io.c | |
parent | ab53c44718305d3fde3d9d2251889f1cab694be2 (diff) | |
download | qemu-a53f1a95f9605f300fbafbc8b60b8a8c67e9c4b4.zip qemu-a53f1a95f9605f300fbafbc8b60b8a8c67e9c4b4.tar.gz qemu-a53f1a95f9605f300fbafbc8b60b8a8c67e9c4b4.tar.bz2 |
block: get_block_status: use "else" when testing the opposite condition
A bit of Boolean algebra (and common sense) tells us that the
second "if" here is looking for blocks that are not allocated.
This is the opposite of the "if" that sets BDRV_BLOCK_ALLOCATED,
and thus it can use an "else".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 1431599702-10431-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/io.c')
-rw-r--r-- | block/io.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -1521,9 +1521,7 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs, if (ret & (BDRV_BLOCK_DATA | BDRV_BLOCK_ZERO)) { ret |= BDRV_BLOCK_ALLOCATED; - } - - if (!(ret & BDRV_BLOCK_DATA) && !(ret & BDRV_BLOCK_ZERO)) { + } else { if (bdrv_unallocated_blocks_are_zero(bs)) { ret |= BDRV_BLOCK_ZERO; } else if (bs->backing_hd) { |