All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block: Simplify BDRV_BLOCK_RAW recursion
@ 2017-05-04 17:37 Eric Blake
  2017-05-05 19:32 ` Max Reitz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Blake @ 2017-05-04 17:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, kwolf, Stefan Hajnoczi, Fam Zheng, Max Reitz

Since we are already in coroutine context during the body of
bdrv_co_get_block_status(), we can shave off a few layers of
wrappers when recursing to query the protocol when a format driver
returned BDRV_BLOCK_RAW.

Note that we are already using the correct recursion later on in
the same function, when probing whether the protocol layer is sparse
in order to find out if we can add BDRV_BLOCK_ZERO to an existing
BDRV_BLOCK_DATA|BDRV_BLOCK_OFFSET_VALID.

Signed-off-by: Eric Blake <eblake@redhat.com>
---
 block/io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/io.c b/block/io.c
index 40bd94f..fdd7485 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1784,8 +1784,8 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs,

     if (ret & BDRV_BLOCK_RAW) {
         assert(ret & BDRV_BLOCK_OFFSET_VALID);
-        ret = bdrv_get_block_status(*file, ret >> BDRV_SECTOR_BITS,
-                                    *pnum, pnum, file);
+        ret = bdrv_co_get_block_status(*file, ret >> BDRV_SECTOR_BITS,
+                                       *pnum, pnum, file);
         goto out;
     }

-- 
2.9.3

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

* Re: [Qemu-devel] [PATCH] block: Simplify BDRV_BLOCK_RAW recursion
  2017-05-04 17:37 [Qemu-devel] [PATCH] block: Simplify BDRV_BLOCK_RAW recursion Eric Blake
@ 2017-05-05 19:32 ` Max Reitz
  2017-05-09  8:14 ` Fam Zheng
  2017-05-09 14:40 ` Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Max Reitz @ 2017-05-05 19:32 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: qemu-block, kwolf, Stefan Hajnoczi, Fam Zheng

[-- Attachment #1: Type: text/plain, Size: 707 bytes --]

On 04.05.2017 19:37, Eric Blake wrote:
> Since we are already in coroutine context during the body of
> bdrv_co_get_block_status(), we can shave off a few layers of
> wrappers when recursing to query the protocol when a format driver
> returned BDRV_BLOCK_RAW.
> 
> Note that we are already using the correct recursion later on in
> the same function, when probing whether the protocol layer is sparse
> in order to find out if we can add BDRV_BLOCK_ZERO to an existing
> BDRV_BLOCK_DATA|BDRV_BLOCK_OFFSET_VALID.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>  block/io.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

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

* Re: [Qemu-devel] [PATCH] block: Simplify BDRV_BLOCK_RAW recursion
  2017-05-04 17:37 [Qemu-devel] [PATCH] block: Simplify BDRV_BLOCK_RAW recursion Eric Blake
  2017-05-05 19:32 ` Max Reitz
@ 2017-05-09  8:14 ` Fam Zheng
  2017-05-09 14:40 ` Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Fam Zheng @ 2017-05-09  8:14 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel, kwolf, Stefan Hajnoczi, qemu-block, Max Reitz

On Thu, 05/04 12:37, Eric Blake wrote:
> Since we are already in coroutine context during the body of
> bdrv_co_get_block_status(), we can shave off a few layers of
> wrappers when recursing to query the protocol when a format driver
> returned BDRV_BLOCK_RAW.
> 
> Note that we are already using the correct recursion later on in
> the same function, when probing whether the protocol layer is sparse
> in order to find out if we can add BDRV_BLOCK_ZERO to an existing
> BDRV_BLOCK_DATA|BDRV_BLOCK_OFFSET_VALID.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>  block/io.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/block/io.c b/block/io.c
> index 40bd94f..fdd7485 100644
> --- a/block/io.c
> +++ b/block/io.c
> @@ -1784,8 +1784,8 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs,
> 
>      if (ret & BDRV_BLOCK_RAW) {
>          assert(ret & BDRV_BLOCK_OFFSET_VALID);
> -        ret = bdrv_get_block_status(*file, ret >> BDRV_SECTOR_BITS,
> -                                    *pnum, pnum, file);
> +        ret = bdrv_co_get_block_status(*file, ret >> BDRV_SECTOR_BITS,
> +                                       *pnum, pnum, file);
>          goto out;
>      }
> 
> -- 
> 2.9.3
> 
> 

Reviewed-by: Fam Zheng <famz@redhat.com>

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

* Re: [Qemu-devel] [PATCH] block: Simplify BDRV_BLOCK_RAW recursion
  2017-05-04 17:37 [Qemu-devel] [PATCH] block: Simplify BDRV_BLOCK_RAW recursion Eric Blake
  2017-05-05 19:32 ` Max Reitz
  2017-05-09  8:14 ` Fam Zheng
@ 2017-05-09 14:40 ` Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2017-05-09 14:40 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel, qemu-block, kwolf, Fam Zheng, Max Reitz

[-- Attachment #1: Type: text/plain, Size: 775 bytes --]

On Thu, May 04, 2017 at 12:37:45PM -0500, Eric Blake wrote:
> Since we are already in coroutine context during the body of
> bdrv_co_get_block_status(), we can shave off a few layers of
> wrappers when recursing to query the protocol when a format driver
> returned BDRV_BLOCK_RAW.
> 
> Note that we are already using the correct recursion later on in
> the same function, when probing whether the protocol layer is sparse
> in order to find out if we can add BDRV_BLOCK_ZERO to an existing
> BDRV_BLOCK_DATA|BDRV_BLOCK_OFFSET_VALID.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>  block/io.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

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

end of thread, other threads:[~2017-05-09 14:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-04 17:37 [Qemu-devel] [PATCH] block: Simplify BDRV_BLOCK_RAW recursion Eric Blake
2017-05-05 19:32 ` Max Reitz
2017-05-09  8:14 ` Fam Zheng
2017-05-09 14:40 ` Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.