diff options
Diffstat (limited to 'include/linux/aio.h')
| -rw-r--r-- | include/linux/aio.h | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/include/linux/aio.h b/include/linux/aio.h index a4d5af907f90..0decf66117c1 100644 --- a/include/linux/aio.h +++ b/include/linux/aio.h | |||
| @@ -24,7 +24,12 @@ struct kioctx; | |||
| 24 | #define KIOCB_SYNC_KEY (~0U) | 24 | #define KIOCB_SYNC_KEY (~0U) |
| 25 | 25 | ||
| 26 | /* ki_flags bits */ | 26 | /* ki_flags bits */ |
| 27 | #define KIF_LOCKED 0 | 27 | /* |
| 28 | * This may be used for cancel/retry serialization in the future, but | ||
| 29 | * for now it's unused and we probably don't want modules to even | ||
| 30 | * think they can use it. | ||
| 31 | */ | ||
| 32 | /* #define KIF_LOCKED 0 */ | ||
| 28 | #define KIF_KICKED 1 | 33 | #define KIF_KICKED 1 |
| 29 | #define KIF_CANCELLED 2 | 34 | #define KIF_CANCELLED 2 |
| 30 | 35 | ||
| @@ -43,6 +48,40 @@ struct kioctx; | |||
| 43 | #define kiocbIsKicked(iocb) test_bit(KIF_KICKED, &(iocb)->ki_flags) | 48 | #define kiocbIsKicked(iocb) test_bit(KIF_KICKED, &(iocb)->ki_flags) |
| 44 | #define kiocbIsCancelled(iocb) test_bit(KIF_CANCELLED, &(iocb)->ki_flags) | 49 | #define kiocbIsCancelled(iocb) test_bit(KIF_CANCELLED, &(iocb)->ki_flags) |
| 45 | 50 | ||
| 51 | /* is there a better place to document function pointer methods? */ | ||
| 52 | /** | ||
| 53 | * ki_retry - iocb forward progress callback | ||
| 54 | * @kiocb: The kiocb struct to advance by performing an operation. | ||
| 55 | * | ||
| 56 | * This callback is called when the AIO core wants a given AIO operation | ||
| 57 | * to make forward progress. The kiocb argument describes the operation | ||
| 58 | * that is to be performed. As the operation proceeds, perhaps partially, | ||
| 59 | * ki_retry is expected to update the kiocb with progress made. Typically | ||
| 60 | * ki_retry is set in the AIO core and it itself calls file_operations | ||
| 61 | * helpers. | ||
| 62 | * | ||
| 63 | * ki_retry's return value determines when the AIO operation is completed | ||
| 64 | * and an event is generated in the AIO event ring. Except the special | ||
| 65 | * return values described below, the value that is returned from ki_retry | ||
| 66 | * is transferred directly into the completion ring as the operation's | ||
| 67 | * resulting status. Once this has happened ki_retry *MUST NOT* reference | ||
| 68 | * the kiocb pointer again. | ||
| 69 | * | ||
| 70 | * If ki_retry returns -EIOCBQUEUED it has made a promise that aio_complete() | ||
| 71 | * will be called on the kiocb pointer in the future. The AIO core will | ||
| 72 | * not ask the method again -- ki_retry must ensure forward progress. | ||
| 73 | * aio_complete() must be called once and only once in the future, multiple | ||
| 74 | * calls may result in undefined behaviour. | ||
| 75 | * | ||
| 76 | * If ki_retry returns -EIOCBRETRY it has made a promise that kick_iocb() | ||
| 77 | * will be called on the kiocb pointer in the future. This may happen | ||
| 78 | * through generic helpers that associate kiocb->ki_wait with a wait | ||
| 79 | * queue head that ki_retry uses via current->io_wait. It can also happen | ||
| 80 | * with custom tracking and manual calls to kick_iocb(), though that is | ||
| 81 | * discouraged. In either case, kick_iocb() must be called once and only | ||
| 82 | * once. ki_retry must ensure forward progress, the AIO core will wait | ||
| 83 | * indefinitely for kick_iocb() to be called. | ||
| 84 | */ | ||
| 46 | struct kiocb { | 85 | struct kiocb { |
| 47 | struct list_head ki_run_list; | 86 | struct list_head ki_run_list; |
| 48 | long ki_flags; | 87 | long ki_flags; |
