Performs block I/O completion processing.
#include <sys/types.h> #include <sys/errno.h> #include <sys/buf.h>
void iodone (bp) struct buf *bp;
bp | Specifies the address of the buf structure for the buffer whose I/O has completed. |
A device driver calls the iodone kernel service when a block I/O request is complete. The device driver must not reference or alter the buffer header or buffer after calling the iodone service.
The iodone service takes one of two actions, depending on the current interrupt level. Either it invokes the caller's individual iodone routine directly, or it schedules I/O completion processing for the buffer to be performed off-level, at the INTIODONE interrupt level. The interrupt handler for this level then calls the iodone routine for the individual device driver. In either case, the individual iodone routine is defined by the b_iodone buffer header field in the buffer header. This iodone routine is set up by the caller of the device's strategy routine.
For example, the file I/O system calls set up a routine that performs buffered I/O completion processing. The uphysio service sets up a routine that performs raw I/O completion processing. Similarly, the pager sets up a routine that performs page-fault completion processing.
Under certain circumstances, a device driver can set up an iodone routine. For example, the logical volume device driver can follow this procedure:
Here, the caller of the logical volume strategy routine has set up an iodone routine that is started when the logical volume request is complete. The logical volume strategy routine in turn sets up an iodone routine that is invoked when the physical volume request is complete.
The key point of this example is that only the caller of a strategy routine can set up an iodone routine and even then, this can only be done while setting up the request in the buffer header.
The interface for the iodone routine is identical to the interface to the iodone service.
The iodone kernel service can be called from either the process or interrupt environment.
The iodone service has no return values.
The iodone kernel service is part of Base Operating System (BOS) Runtime.
The iowait kernel service.
The buf structure.
Understanding Interrupts and I/O Kernel Services in AIX Kernel Extensions and Device Support Programming Concepts.