qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 1/2] block: add the support to drain throttled requests
@ 2012-03-12  6:29 zwu.kernel
  2012-03-12  7:27 ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: zwu.kernel @ 2012-03-12  6:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, pbonzini, Zhi Yong Wu, zwu.kernel, stefanha

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 block.c     |   21 +++++++++++++++++++++
 block_int.h |    1 +
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/block.c b/block.c
index 52ffe14..0825168 100644
--- a/block.c
+++ b/block.c
@@ -853,6 +853,21 @@ void bdrv_close_all(void)
     }
 }
 
+/**
+ * Complete all pending requests for a block device
+ */
+void bdrv_drain(BlockDriverState *bs)
+{
+    do {
+        qemu_co_queue_restart_all(&bs->throttled_reqs);
+    } while (!qemu_co_queue_empty(&bs->throttled_reqs));
+
+    qemu_aio_flush();
+
+    assert(QLIST_EMPTY(&bs->tracked_requests));
+    assert(qemu_co_queue_empty(&bs->throttled_reqs));
+}
+
 /*
  * Wait for pending requests to complete across all BlockDriverStates
  *
@@ -863,6 +878,12 @@ void bdrv_drain_all(void)
 {
     BlockDriverState *bs;
 
+    QTAILQ_FOREACH(bs, &bdrv_states, list) {
+        do {
+            qemu_co_queue_restart_all(&bs->throttled_reqs);
+        } while (!qemu_co_queue_empty(&bs->throttled_reqs));
+    }
+
     qemu_aio_flush();
 
     /* If requests are still pending there is a bug somewhere */
diff --git a/block_int.h b/block_int.h
index b460c36..c624399 100644
--- a/block_int.h
+++ b/block_int.h
@@ -318,6 +318,7 @@ void qemu_aio_release(void *p);
 
 void bdrv_set_io_limits(BlockDriverState *bs,
                         BlockIOLimit *io_limits);
+void bdrv_drain(BlockDriverState *bs);
 
 #ifdef _WIN32
 int is_windows_drive(const char *filename);
-- 
1.7.6

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

* Re: [Qemu-devel] [PATCH v2 1/2] block: add the support to drain throttled requests
  2012-03-12  6:29 [Qemu-devel] [PATCH v2 1/2] block: add the support to drain throttled requests zwu.kernel
@ 2012-03-12  7:27 ` Paolo Bonzini
  2012-03-12  8:42   ` Zhi Yong Wu
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2012-03-12  7:27 UTC (permalink / raw)
  To: qemu-devel

Il 12/03/2012 07:29, zwu.kernel@gmail.com ha scritto:
> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> 
> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> ---
>  block.c     |   21 +++++++++++++++++++++
>  block_int.h |    1 +
>  2 files changed, 22 insertions(+), 0 deletions(-)
> 
> diff --git a/block.c b/block.c
> index 52ffe14..0825168 100644
> --- a/block.c
> +++ b/block.c
> @@ -853,6 +853,21 @@ void bdrv_close_all(void)
>      }
>  }
>  
> +/**
> + * Complete all pending requests for a block device
> + */
> +void bdrv_drain(BlockDriverState *bs)
> +{
> +    do {
> +        qemu_co_queue_restart_all(&bs->throttled_reqs);
> +    } while (!qemu_co_queue_empty(&bs->throttled_reqs));
> +
> +    qemu_aio_flush();

This doesn't work, qemu_aio_flush can start new I/O.

Paolo

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

* Re: [Qemu-devel] [PATCH v2 1/2] block: add the support to drain throttled requests
  2012-03-12  7:27 ` Paolo Bonzini
@ 2012-03-12  8:42   ` Zhi Yong Wu
  2012-03-12  8:48     ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Zhi Yong Wu @ 2012-03-12  8:42 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

On Mon, Mar 12, 2012 at 3:27 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> Il 12/03/2012 07:29, zwu.kernel@gmail.com ha scritto:
>> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>>
>> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>> ---
>>  block.c     |   21 +++++++++++++++++++++
>>  block_int.h |    1 +
>>  2 files changed, 22 insertions(+), 0 deletions(-)
>>
>> diff --git a/block.c b/block.c
>> index 52ffe14..0825168 100644
>> --- a/block.c
>> +++ b/block.c
>> @@ -853,6 +853,21 @@ void bdrv_close_all(void)
>>      }
>>  }
>>
>> +/**
>> + * Complete all pending requests for a block device
>> + */
>> +void bdrv_drain(BlockDriverState *bs)
>> +{
>> +    do {
>> +        qemu_co_queue_restart_all(&bs->throttled_reqs);
>> +    } while (!qemu_co_queue_empty(&bs->throttled_reqs));
>> +
>> +    qemu_aio_flush();
>
> This doesn't work, qemu_aio_flush can start new I/O.
Do you mean that it will start next I/O via the current request's cb?
if no, where will it start new I/O?
>
> Paolo
>
>



-- 
Regards,

Zhi Yong Wu

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

* Re: [Qemu-devel] [PATCH v2 1/2] block: add the support to drain throttled requests
  2012-03-12  8:42   ` Zhi Yong Wu
@ 2012-03-12  8:48     ` Paolo Bonzini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2012-03-12  8:48 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: qemu-devel

Il 12/03/2012 09:42, Zhi Yong Wu ha scritto:
>> >
>> > This doesn't work, qemu_aio_flush can start new I/O.
> Do you mean that it will start next I/O via the current request's cb?

Yes.

Paolo

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

end of thread, other threads:[~2012-03-12  8:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-12  6:29 [Qemu-devel] [PATCH v2 1/2] block: add the support to drain throttled requests zwu.kernel
2012-03-12  7:27 ` Paolo Bonzini
2012-03-12  8:42   ` Zhi Yong Wu
2012-03-12  8:48     ` Paolo Bonzini

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).