[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 07/26] block: add the support to drain throttled
From: |
Zhi Yong Wu |
Subject: |
Re: [Qemu-devel] [PATCH 07/26] block: add the support to drain throttled requests |
Date: |
Fri, 13 Apr 2012 15:51:51 +0800 |
On Fri, Apr 13, 2012 at 3:18 PM, Paolo Bonzini <address@hidden> wrote:
> Il 13/04/2012 03:55, Zhi Yong Wu ha scritto:
>> On Thu, Apr 12, 2012 at 8:00 PM, Paolo Bonzini <address@hidden> wrote:
>>> From: Zhi Yong Wu <address@hidden>
>>>
>>> Signed-off-by: Zhi Yong Wu <address@hidden>
>>> [ Iterate until all block devices have processed all requests,
>>> add comments. - Paolo ]
>>> Signed-off-by: Paolo Bonzini <address@hidden>
>>> ---
>>> block.c | 21 ++++++++++++++++++++-
>>> 1 file changed, 20 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/block.c b/block.c
>>> index 4b96654..33efa95 100644
>>> --- a/block.c
>>> +++ b/block.c
>>> @@ -863,12 +863,31 @@ void bdrv_close_all(void)
>>> *
>>> * This function does not flush data to disk, use bdrv_flush_all() for that
>>> * after calling this function.
>>> + *
>>> + * Note that completion of an asynchronous I/O operation can trigger any
>>> + * number of other I/O operations on other devices---for example a
>>> coroutine
>>> + * can be arbitrarily complex and a constant flow of I/O can come until the
>>> + * coroutine is complete. Because of this, it is not possible to have a
>>> + * function to drain a single device's I/O queue.
>>> */
>>> void bdrv_drain_all(void)
>>> {
>>> BlockDriverState *bs;
>>> + bool busy;
>>>
>>> - qemu_aio_flush();
>>> + do {
>>> + busy = qemu_aio_wait();
>> When bdrv_drain_all is invoked, if bs->tracked_requests has some
>> pending I/O requests, only qemu_aio_wait is called here, not
>> qemu_aio_flush() to restart them in bs->tracked_requests. It will
>> cause assert about bs->tracked_requests.
>
> qemu_aio_flush does not do that. Instead, the code just below does it:
Sorry, i hadn't check the code. thanks for pointing out this. In the
past, i tested this patch, and found it will assert about
bs->tracked_requests. Do you think that only qemu_aio_wait can make
sure that bs->tracked_requests is empty here?
>
>>> +
>>> + /* FIXME: We do not have timer support here, so this is effectively
>>> + * a busy wait.
>>> + */
>>> + QTAILQ_FOREACH(bs, &bdrv_states, list) {
>>> + if (!qemu_co_queue_empty(&bs->throttled_reqs)) {
>>> + qemu_co_queue_restart_all(&bs->throttled_reqs);
>>> + busy = true;
>>> + }
>>> + }
>>> + } while (busy);
>>>
>>> /* If requests are still pending there is a bug somewhere */
>>> QTAILQ_FOREACH(bs, &bdrv_states, list) {
>>> --
>>> 1.7.9.3
>>>
>>>
>>>
>>
>>
>>
>
>
>
--
Regards,
Zhi Yong Wu
- [Qemu-devel] [PATCH 00/26] My block patches queue for 1.1, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 01/26] qemu-io: use main_loop_wait, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 02/26] qemu-tool: map vm_clock to rt_clock, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 03/26] posix-aio: merge posix_aio_process_queue and posix_aio_read, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 05/26] aio: return "AIO in progress" state from qemu_aio_wait, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 04/26] aio: remove process_queue callback and qemu_aio_process_queue, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 07/26] block: add the support to drain throttled requests, Paolo Bonzini, 2012/04/12
- Re: [Qemu-devel] [PATCH 07/26] block: add the support to drain throttled requests, Zhi Yong Wu, 2012/04/12
- Re: [Qemu-devel] [PATCH 07/26] block: add the support to drain throttled requests, Paolo Bonzini, 2012/04/13
- Re: [Qemu-devel] [PATCH 07/26] block: add the support to drain throttled requests,
Zhi Yong Wu <=
- Re: [Qemu-devel] [PATCH 07/26] block: add the support to drain throttled requests, Paolo Bonzini, 2012/04/13
- Re: [Qemu-devel] [PATCH 07/26] block: add the support to drain throttled requests, Zhi Yong Wu, 2012/04/13
- Re: [Qemu-devel] [PATCH 07/26] block: add the support to drain throttled requests, Paolo Bonzini, 2012/04/13
- Re: [Qemu-devel] [PATCH 07/26] block: add the support to drain throttled requests, Zhi Yong Wu, 2012/04/13
- Re: [Qemu-devel] [PATCH 07/26] block: add the support to drain throttled requests, Zhi Yong Wu, 2012/04/13
[Qemu-devel] [PATCH 08/26] block: add mode argument to blockdev-snapshot-sync, Paolo Bonzini, 2012/04/12
[Qemu-devel] [PATCH 06/26] aio: simplify qemu_aio_wait, Paolo Bonzini, 2012/04/12
[Qemu-devel] [PATCH 09/26] block: fail live snapshot if disk has no medium, Paolo Bonzini, 2012/04/12
[Qemu-devel] [PATCH 10/26] block: fix snapshot on QED, Paolo Bonzini, 2012/04/12
[Qemu-devel] [PATCH 14/26] block: fix allocation size for dirty bitmap, Paolo Bonzini, 2012/04/12