]> git.proxmox.com Git - mirror_qemu.git/commitdiff
block-backend: simplify blk_get_aio_context
authorDaniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Tue, 27 Mar 2018 13:08:46 +0000 (10:08 -0300)
committerKevin Wolf <kwolf@redhat.com>
Tue, 15 May 2018 14:11:41 +0000 (16:11 +0200)
blk_get_aio_context verifies if BlockDriverState bs is not NULL,
return bdrv_get_aio_context(bs) if true or qemu_get_aio_context()
otherwise. However, bdrv_get_aio_context from block.c already does
this verification itself, also returning qemu_get_aio_context()
if bs is NULL:

AioContext *bdrv_get_aio_context(BlockDriverState *bs)
{
    return bs ? bs->aio_context : qemu_get_aio_context();
}

This patch simplifies blk_get_aio_context to simply call
bdrv_get_aio_context instead of replicating the same logic.

Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/block-backend.c

index 681b240b1268fcfaa3543fe19990d1d27e805e2d..89f47b00ea24b7542375bc061c105f7da5bbf44c 100644 (file)
@@ -1865,13 +1865,7 @@ void blk_op_unblock_all(BlockBackend *blk, Error *reason)
 
 AioContext *blk_get_aio_context(BlockBackend *blk)
 {
-    BlockDriverState *bs = blk_bs(blk);
-
-    if (bs) {
-        return bdrv_get_aio_context(bs);
-    } else {
-        return qemu_get_aio_context();
-    }
+    return bdrv_get_aio_context(blk_bs(blk));
 }
 
 static AioContext *blk_aiocb_get_aio_context(BlockAIOCB *acb)