[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 2/4] block: add the block queue support
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v5 2/4] block: add the block queue support |
Date: |
Fri, 12 Aug 2011 09:42:15 +0100 |
On Fri, Aug 12, 2011 at 9:10 AM, Zhi Yong Wu <address@hidden> wrote:
> On Tue, Aug 9, 2011 at 8:49 PM, Stefan Hajnoczi <address@hidden> wrote:
>> On Tue, Aug 9, 2011 at 5:17 AM, Zhi Yong Wu <address@hidden> wrote:
>>> +/* The APIs for block request queue on qemu block layer.
>>> + */
>>> +
>>> +static void qemu_block_queue_cancel(BlockDriverAIOCB *acb)
>>> +{
>>> + qemu_aio_release(acb);
>>> +}
>>> +
>>> +static AIOPool block_queue_pool = {
>>> + .aiocb_size = sizeof(struct BlockDriverAIOCB),
>>> + .cancel = qemu_block_queue_cancel,
>>> +};
>>
>> The lifecycle of block_queue_pool acbs should be like this:
>>
>> When a request is queued we need a BlockQueue acb because we have no
>> real acb yet. So we get an acb from block_queue_pool.
>>
>> If the acb is cancelled before being dispatched we need to release the
>> acb and remove the request from the queue. (This patch does not
>> remove the request from the queue on cancel.)
>>
>> When the acb is dispatched we need to keep track of the real acb (e.g.
>> from qcow2). The caller will only ever see our acb because there is
>> no way to give them the pointer to the new acb after dispatch. That
>> means we need to keep the our acb alive for the entire lifetime of the
>> request. (This patch currently releases our acb when the request is
>> dispatched.)
>>
>> If the acb is cancelled after being dispatched we need to first cancel
>> the real acb and then release our acb.
>>
>> When the acb is dispatched we need to pass qemu_block_queue_callback
>> as the cb function to handler. Inside qemu_block_queue_callback we
> When one block request have been reenqueued multiple times, it will be
> difficult to store original cb function.
The challenge is that blkqueue creates an acb and returns it to the
user when a request is enqueued. Because the user now has the acb we
must keep this acb around for the lifetime of the request.
The current code will create a new acb if the request is enqueued
again. We should avoid this.
The code needs to be structured so that a queued acb can be dispatched
directly - without creating a new BlockQueueAIOCB.
Stefan
- Re: [Qemu-devel] [PATCH v5 2/4] block: add the block queue support, (continued)
- Re: [Qemu-devel] [PATCH v5 2/4] block: add the block queue support, Ram Pai, 2011/08/09
- Re: [Qemu-devel] [PATCH v5 2/4] block: add the block queue support, Stefan Hajnoczi, 2011/08/09
- Re: [Qemu-devel] [PATCH v5 2/4] block: add the block queue support, Zhi Yong Wu, 2011/08/10
- Re: [Qemu-devel] [PATCH v5 2/4] block: add the block queue support, Stefan Hajnoczi, 2011/08/10
- Re: [Qemu-devel] [PATCH v5 2/4] block: add the block queue support, Zhi Yong Wu, 2011/08/11
- Re: [Qemu-devel] [PATCH v5 2/4] block: add the block queue support, Zhi Yong Wu, 2011/08/11
- Re: [Qemu-devel] [PATCH v5 2/4] block: add the block queue support, Zhi Yong Wu, 2011/08/12
- Re: [Qemu-devel] [PATCH v5 2/4] block: add the block queue support, Stefan Hajnoczi, 2011/08/12
- Re: [Qemu-devel] [PATCH v5 2/4] block: add the block queue support, Zhi Yong Wu, 2011/08/12
- Re: [Qemu-devel] [PATCH v5 2/4] block: add the block queue support,
Stefan Hajnoczi <=
- Re: [Qemu-devel] [PATCH v5 2/4] block: add the block queue support, Zhi Yong Wu, 2011/08/12
[Qemu-devel] [PATCH v5 3/4] block: add block timer and block throttling algorithm, Zhi Yong Wu, 2011/08/09
Re: [Qemu-devel] [PATCH v5 3/4] block: add block timer and block throttling algorithm, Stefan Hajnoczi, 2011/08/09