qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/1] block-backend: simplify blk_get_aio_context
@ 2018-03-27 13:08 Daniel Henrique Barboza
  2018-03-27 13:24 ` Darren Kenny
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Daniel Henrique Barboza @ 2018-03-27 13:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, mreitz, Daniel Henrique Barboza

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>
---
 block/block-backend.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index 681b240b12..89f47b00ea 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -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)
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] block-backend: simplify blk_get_aio_context
  2018-03-27 13:08 [Qemu-devel] [PATCH 1/1] block-backend: simplify blk_get_aio_context Daniel Henrique Barboza
@ 2018-03-27 13:24 ` Darren Kenny
  2018-04-04 19:54 ` Daniel Henrique Barboza
  2018-04-09 10:27 ` Kevin Wolf
  2 siblings, 0 replies; 4+ messages in thread
From: Darren Kenny @ 2018-03-27 13:24 UTC (permalink / raw)
  To: Daniel Henrique Barboza; +Cc: qemu-devel, kwolf, mreitz

On Tue, Mar 27, 2018 at 10:08:46AM -0300, Daniel Henrique Barboza wrote:
>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>

Seems to make sense.

Reviewed-by: Darren Kenny <darren.kenny@oracle.com>

>---
> block/block-backend.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
>diff --git a/block/block-backend.c b/block/block-backend.c
>index 681b240b12..89f47b00ea 100644
>--- a/block/block-backend.c
>+++ b/block/block-backend.c
>@@ -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)
>-- 
>2.14.3
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] block-backend: simplify blk_get_aio_context
  2018-03-27 13:08 [Qemu-devel] [PATCH 1/1] block-backend: simplify blk_get_aio_context Daniel Henrique Barboza
  2018-03-27 13:24 ` Darren Kenny
@ 2018-04-04 19:54 ` Daniel Henrique Barboza
  2018-04-09 10:27 ` Kevin Wolf
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Henrique Barboza @ 2018-04-04 19:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, mreitz

Ping

On 03/27/2018 10:08 AM, Daniel Henrique Barboza wrote:
> 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>
> ---
>   block/block-backend.c | 8 +-------
>   1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/block/block-backend.c b/block/block-backend.c
> index 681b240b12..89f47b00ea 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -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)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] block-backend: simplify blk_get_aio_context
  2018-03-27 13:08 [Qemu-devel] [PATCH 1/1] block-backend: simplify blk_get_aio_context Daniel Henrique Barboza
  2018-03-27 13:24 ` Darren Kenny
  2018-04-04 19:54 ` Daniel Henrique Barboza
@ 2018-04-09 10:27 ` Kevin Wolf
  2 siblings, 0 replies; 4+ messages in thread
From: Kevin Wolf @ 2018-04-09 10:27 UTC (permalink / raw)
  To: Daniel Henrique Barboza; +Cc: qemu-devel, mreitz

Am 27.03.2018 um 15:08 hat Daniel Henrique Barboza geschrieben:
> 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>

Thanks, applied to the block-next branch.

Kevin

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-09 10:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-27 13:08 [Qemu-devel] [PATCH 1/1] block-backend: simplify blk_get_aio_context Daniel Henrique Barboza
2018-03-27 13:24 ` Darren Kenny
2018-04-04 19:54 ` Daniel Henrique Barboza
2018-04-09 10:27 ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).