diff mbox series

[RFC,2/5] introduce BDRV_POLL_WHILE_UNLOCKED

Message ID 20220301142113.163174-3-eesposit@redhat.com (mailing list archive)
State New, archived
Headers show
Series Removal of AioContext lock, bs->parents and ->children: proof of concept | expand

Commit Message

Emanuele Giuseppe Esposito March 1, 2022, 2:21 p.m. UTC
Same as BDRV_POLL_WHILE, but uses AIO_WAIT_WHILE_UNLOCKED.
See doc comment for more info.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
 include/block/block.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Stefan Hajnoczi March 2, 2022, 4:22 p.m. UTC | #1
On Tue, Mar 01, 2022 at 09:21:10AM -0500, Emanuele Giuseppe Esposito wrote:
> Same as BDRV_POLL_WHILE, but uses AIO_WAIT_WHILE_UNLOCKED.
> See doc comment for more info.
> 
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
>  include/block/block.h | 5 +++++
>  1 file changed, 5 insertions(+)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Eric Blake March 9, 2022, 1:49 p.m. UTC | #2
On Tue, Mar 01, 2022 at 09:21:10AM -0500, Emanuele Giuseppe Esposito wrote:
> Same as BDRV_POLL_WHILE, but uses AIO_WAIT_WHILE_UNLOCKED.
> See doc comment for more info.

This sentence implies there is a doc comment...

> 
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
>  include/block/block.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/block/block.h b/include/block/block.h
> index e1713ee306..5a7a850c16 100644
> --- a/include/block/block.h
> +++ b/include/block/block.h
> @@ -512,6 +512,11 @@ void bdrv_drain_all(void);
>      AIO_WAIT_WHILE(bdrv_get_aio_context(bs_),              \
>                     cond); })
>  
> +#define BDRV_POLL_WHILE_UNLOCKED(bs, cond) ({              \
> +    BlockDriverState *bs_ = (bs);                          \
> +    AIO_WAIT_WHILE_UNLOCKED(bdrv_get_aio_context(bs_),     \
> +                            cond); })
> +

but none is added here.  I'm presuming that the comment is already in
the file (not shown in the limited context view here), but it may be
worth tweaking the commit message to mention that.

>  int generated_co_wrapper bdrv_pdiscard(BdrvChild *child, int64_t offset,
>                                         int64_t bytes);
>  int bdrv_co_pdiscard(BdrvChild *child, int64_t offset, int64_t bytes);
> -- 
> 2.31.1
> 
>
diff mbox series

Patch

diff --git a/include/block/block.h b/include/block/block.h
index e1713ee306..5a7a850c16 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -512,6 +512,11 @@  void bdrv_drain_all(void);
     AIO_WAIT_WHILE(bdrv_get_aio_context(bs_),              \
                    cond); })
 
+#define BDRV_POLL_WHILE_UNLOCKED(bs, cond) ({              \
+    BlockDriverState *bs_ = (bs);                          \
+    AIO_WAIT_WHILE_UNLOCKED(bdrv_get_aio_context(bs_),     \
+                            cond); })
+
 int generated_co_wrapper bdrv_pdiscard(BdrvChild *child, int64_t offset,
                                        int64_t bytes);
 int bdrv_co_pdiscard(BdrvChild *child, int64_t offset, int64_t bytes);