CEPH filesystem development
 help / color / mirror / Atom feed
* Correct usage of rbd_aio_release
@ 2013-08-12 13:36 Sylvain Munaut
  2013-08-12 21:58 ` Josh Durgin
  0 siblings, 1 reply; 2+ messages in thread
From: Sylvain Munaut @ 2013-08-12 13:36 UTC (permalink / raw)
  To: ceph-devel

Hi,


When should / can rbd_aio_release be called exactly ?

For example if I create a rbd_aio_create_completion then do a
rbd_aio_XXX that fails, should I call rbd_aio_release ?
I would think yes, but when looking at the qemu rbd code, it doesn't
and I'm not sure if it's by design.

Cheers,

    Sylvain

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

* Re: Correct usage of rbd_aio_release
  2013-08-12 13:36 Correct usage of rbd_aio_release Sylvain Munaut
@ 2013-08-12 21:58 ` Josh Durgin
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Durgin @ 2013-08-12 21:58 UTC (permalink / raw)
  To: Sylvain Munaut; +Cc: ceph-devel

On 08/12/2013 06:36 AM, Sylvain Munaut wrote:
> Hi,
>
>
> When should / can rbd_aio_release be called exactly ?

It should be called whenever you're certain you won't be using the
rbd_completion_t anymore (and an rbd_completion_t should not be reused
after rbd_aio_{read,write,discard,flush} is called on it).
rbd_aio_release() could be in the callback, after the callback is
called, or like you suggest below, when there's an error submitting the
I/O in the first place. If you don't supply a callback when creating the
rbd_completion_t, you can release it after scheduling I/O with
rbd_aio_xxx, but you won't be able to do any error handling.

> For example if I create a rbd_aio_create_completion then do a
> rbd_aio_XXX that fails, should I call rbd_aio_release ?
> I would think yes, but when looking at the qemu rbd code, it doesn't
> and I'm not sure if it's by design.

Yes, you should call rbd_aio_release() then. It's a bug in the qemu rbd
driver that it doesn't, but the rbd_aio_xxx functions only fail for
some kind of bad request (i.e. trying to write to a snapshot, or
starting past the end of the image), so it's not really a problem in
practice. Errors like ENOSPC will not be triggered until after the
request is submitted, and will need to be handled by the callback.

Josh

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

end of thread, other threads:[~2013-08-12 22:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-12 13:36 Correct usage of rbd_aio_release Sylvain Munaut
2013-08-12 21:58 ` Josh Durgin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox