[dm-devel] [RFC] New interface for dm-io to handle timed requests
Stefan Bader
Stefan.Bader at de.ibm.com
Tue Mar 14 10:19:03 UTC 2006
Some days ago we proposed an extension to the device mapper that allows
to specify a timeout after which a given request should return as
successful, even if some of the target devices did not react by that
time. As we cannot return a request to the upper layers as long as some
io is still running and possibly modifying referenced pages, we also
need a way to handle those requests.
The ideal solution would be to have an interface in the block layer that
allows us to cancel any submitted requests. But since such a change will
take quite a lot discussions and work, we want to emulate such a
behavior in the dm core for now.
The rough idea is as follows:
- The dm core has to keep track of running ios, so each client has to
create a dm_io_client structure by calling dm_io_client_create
This is also required to have better scaling targets that use
dm-io since this allows to have memory pools private to each
target instance.
- Any io is submitted via dm_io. Details on timeouts, what callback
function to use, etc. are submitted via a struct dm_io_control.
- The notify function will be called multiple times, usually once for
each region. It's the job of the client to wait for all regions to
complete.
- The state of a region can be OK, TIMEOUT, CANCELED or ERROR. If The
state is TIMEOUT, the io is still running, and can complete later by
it self. In that case the callback is called again with the new
state.
If the client doesn't want to wait, it can call
dm_io_cancel_by_device or dm_io_cancel_by_handle to cancel the
outstanding io.
- Once all regions returned with a return code of OK, CANCELED or ERROR
the io request can be returned to the originator.
- Synchronous calls are done by setting the SYNC bit in the rw attribute
(only one function call instead of multiple ones). The call will wait
until all regions are done (but will call the notify function if
supplied). If no notify function is supplied the caller will only
know that any region has an error or all are done.
Without notify function but with timeout the regions will be cancelled
automatically.
Regards,
Stefan Bader
----------------------------------------------------------------------
Here comes the proposed new header:
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dm-io-v2.h
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20060314/c0c4d331/attachment.h>
More information about the dm-devel
mailing list