All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Ryan Harper <ryanh@us.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: Re: [Qemu-devel] Re: [PATCH 2/3] Move aio implementation out of raw block driver
Date: Tue, 23 Sep 2008 09:40:45 -0500	[thread overview]
Message-ID: <48D8FFED.6070702@us.ibm.com> (raw)
In-Reply-To: <20080923143909.GK31395@us.ibm.com>

Ryan Harper wrote:
> * Anthony Liguori <aliguori@us.ibm.com> [2008-09-22 21:52]:
>   
>> Ryan Harper wrote:
>>     
>
>   
> This was taken from block-raw-posix.c, DEBUG_BLOCK.  I'll change up the
> DEBUG_BLOCK_AIO, should I also submit a patch to rework DEBUG_BLOCK?
>   

Yes, please.

>>> +typedef struct AIODriver
>>> +{
>>> +    const char *name;
>>> +    RawAIOCB *(*submit)(BlockDriverState *bs, int fd,
>>> +                                    int64_t sector_num, uint8_t *buf,
>>> +                                    int sectors, int write,
>>> +                                    BlockDriverCompletionFunc *cb,
>>> +                                    void *opaque);
>>> +    void (*cancel)(BlockDriverAIOCB *aiocb);
>>> +    int (*flush)(void *opaque);
>>> +} AIODriver;
>>>  
>>>       
>> I think the AIODriver interface should just take an fd, a completion 
>> function, and an opaque pointer.  It should have to have knowledge of 
>> BDRVRawState or BlockDriverState.
>>     
>
> I assume you mean shouldn't have to have.  Looking at things like
> pa_read() in aio-posix.c , I'm not sure I see how I avoid that
> knowledge.
>   

I think the key is to change the way AIOCBs are allocated.

>>> *raw_aio_read(BlockDriverState *bs,
>>>     }
>>> #endif
>>>
>>> -    acb = raw_aio_setup(bs, sector_num, buf, nb_sectors, cb, opaque);
>>> -    if (!acb)
>>> +    if (fd_open(bs) < 0)
>>>         return NULL;
>>> -    if (aio_read(&acb->aiocb) < 0) {
>>> -        qemu_aio_release(acb);
>>> +
>>> +    /* submit read */
>>> +    acb = s->aio_dvr->submit(bs, s->fd, sector_num, buf, nb_sectors, 0, 
>>> cb,
>>> +                             opaque);
>>> +    if (!acb)
>>>         return NULL;
>>> -    }
>>>     return &acb->common;
>>> }
>>>  
>>>       
>> So what happens if !defined(CONFIG_AIO)?  By my reading of the code, 
>> aio_drv will be NULL and this will SEGV.
>>     
>
> raw_aio_read/write/cancel aren't included in the bdrv structure unless
> CONFIG_AIO is defined.  Rather in bdrv_register, the aio emulation
> functions are used instead.
>   

So these will give warnings then of unused statics?  Because they are no 
longer conditional on CONFIG_AIO?

Regards,

Anthony Liguori

>>> +    /* init aio driver for this block device */
>>> +    s->aio_dvr = posix_aio_init();
>>>  
>>>       
>> Doesn't this need to be conditional on CONFIG_AIO?
>>     
>
> Yep, in both raw_open and hdev_open().  
>
>
> Thanks for the review.
>
>   


  reply	other threads:[~2008-09-23 14:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-22 23:17 [PATCH 0/3] Refactor AIO to allow multiple AIO implementations Ryan Harper
2008-09-22 23:17 ` [PATCH 1/3] Only call aio flush handler if set Ryan Harper
2008-09-23  2:38   ` Anthony Liguori
2008-09-23 14:26     ` [Qemu-devel] " Ryan Harper
2008-09-23 14:34       ` Anthony Liguori
2008-09-23 14:41         ` Ryan Harper
2008-09-23 14:50           ` Anthony Liguori
2008-09-22 23:17 ` [PATCH 2/3] Move aio implementation out of raw block driver Ryan Harper
2008-09-23  1:16   ` Ryan Harper
2008-09-23  2:45   ` Anthony Liguori
2008-09-23 14:39     ` [Qemu-devel] " Ryan Harper
2008-09-23 14:40       ` Anthony Liguori [this message]
2008-09-23 14:53       ` Gerd Hoffmann
2008-09-23 16:06         ` Anthony Liguori
2008-09-23 18:04           ` Gerd Hoffmann
2008-09-23 18:28             ` Anthony Liguori
2008-09-24 22:31     ` Marcelo Tosatti
     [not found] ` <1222125454-21744-4-git-send-email-ryanh@us.ibm.com>
2008-09-23  1:22   ` [PATCH 3/3] Add linux aio implementation for raw block devices Ryan Harper
2008-09-23  3:32 ` [PATCH 0/3] Refactor AIO to allow multiple AIO implementations Anthony Liguori
2008-09-23 14:43   ` [Qemu-devel] " Ryan Harper
2008-09-23 14:47     ` Anthony Liguori
2008-09-23 16:09     ` Anthony Liguori
2008-09-23 10:27 ` [Qemu-devel] " Jamie Lokier
2008-10-02 22:41 ` john cooper
2008-10-03 13:33   ` Ryan Harper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48D8FFED.6070702@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=ryanh@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.