aio_queue_work(ctx);
static ssize_t aio_run_iocb(struct kiocb *iocb){	struct kioctx	*ctx = iocb->ki_ctx;	ssize_t (*retry)(struct kiocb *);	ssize_t ret;	if (iocb->ki_retried++ > 1024*1024) {		printk("Maximal retry count.  Bytes done %Zd\n",			iocb->ki_nbytes - iocb->ki_left);		return -EAGAIN;	}	if (!(iocb->ki_retried & 0xff)) {		pr_debug("%ld retry: %d of %d\n", iocb->ki_retried,			iocb->ki_nbytes - iocb->ki_left, iocb->ki_nbytes);	}	if (!(retry = iocb->ki_retry)) {		printk("aio_run_iocb: iocb->ki_retry = NULL\n");		return 0;	}	/*	 * We don't want the next retry iteration for this	 * operation to start until this one has returned and	 * updated the iocb state. However, wait_queue functions	 * can trigger a kick_iocb from interrupt context in the	 * meantime, indicating that data is available for the next	 * iteration. We want to remember that and enable the	 * next retry iteration _after_ we are through with	 * this one.	 *	 * So, in order to be able to register a "kick", but	 * prevent it from being queued now, we clear the kick	 * flag, but make the kick code *think* that the iocb is	 * still on the run list until we are actually done.	 * When we are done with this iteration, we check if	 * the iocb was kicked in the meantime and if so, queue	 * it up afresh.	 */	kiocbClearKicked(iocb);	/*	 * This is so that aio_complete knows it doesn't need to	 * pull the iocb off the run list (We can't just call	 * INIT_LIST_HEAD because we don't want a kick_iocb to	 * queue this on the run list yet)	 */	iocb->ki_run_list.next = iocb->ki_run_list.prev = NULL;	spin_unlock_irq(&ctx->ctx_lock);	/* Quit retrying if the i/o has been cancelled */	if (kiocbIsCancelled(iocb)) {		ret = -EINTR;		aio_complete(iocb, ret, 0);		/* must not access the iocb after this */		goto out;	}	/*	 * Now we are all set to call the retry method in async	 * context. By setting this thread's io_wait context	 * to point to the wait queue entry inside the currently	 * running iocb for the duration of the retry, we ensure	 * that async notification wakeups are queued by the	 * operation instead of blocking waits, and when notified,	 * cause the iocb to be kicked for continuation (through	 * the aio_wake_function callback).	 */	BUG_ON(current->io_wait != NULL);	current->io_wait = &iocb->ki_wait;	ret = retry(iocb);	current->io_wait = NULL;	if (-EIOCBRETRY != ret) { 		if (-EIOCBQUEUED != ret) {			BUG_ON(!list_empty(&iocb->ki_wait.task_list));			aio_complete(iocb, ret, 0);			/* must not access the iocb after this */		}	} else {		/*		 * Issue an additional retry to avoid waiting forever if		 * no waits were queued (e.g. in case of a short read).		 */		if (list_empty(&iocb->ki_wait.task_list))			kiocbSetKicked(iocb);	}out:	spin_lock_irq(&ctx->ctx_lock);	if (-EIOCBRETRY == ret) {		/*		 * OK, now that we are done with this iteration		 * and know that there is more left to go,		 * this is where we let go so that a subsequent		 * "kick" can start the next iteration		 */		/* will make __queue_kicked_iocb succeed from here on */		INIT_LIST_HEAD(&iocb->ki_run_list);		/* we must queue the next iteration ourselves, if it		 * has already been kicked */		if (kiocbIsKicked(iocb)) {			__queue_kicked_iocb(iocb);		}	}	return ret;}