int ret;  
BUG_ON(iocb->ki_users != 1); 
int fastcall aio_complete(struct kiocb *iocb, long res, long res2){	struct kioctx	*ctx = iocb->ki_ctx;	struct aio_ring_info	*info;	struct aio_ring	*ring;	struct io_event	*event;	unsigned long	flags;	unsigned long	tail;	int		ret;	/* Special case handling for sync iocbs: events go directly	 * into the iocb for fast handling.  Note that this will not 	 * work if we allow sync kiocbs to be cancelled. in which	 * case the usage count checks will have to move under ctx_lock	 * for all cases.	 */	if (is_sync_kiocb(iocb)) {		int ret;		iocb->ki_user_data = res;		if (iocb->ki_users == 1) {			iocb->ki_users = 0;			ret = 1;		} else {			spin_lock_irq(&ctx->ctx_lock);			iocb->ki_users--;			ret = (0 == iocb->ki_users);			spin_unlock_irq(&ctx->ctx_lock);		}		/* sync iocbs put the task here for us */		wake_up_process(iocb->ki_obj.tsk);		return ret;	}	info = &ctx->ring_info;	/* add a completion event to the ring buffer.	 * must be done holding ctx->ctx_lock to prevent	 * other code from messing with the tail	 * pointer since we might be called from irq	 * context.	 */	spin_lock_irqsave(&ctx->ctx_lock, flags);	if (iocb->ki_run_list.prev && !list_empty(&iocb->ki_run_list))		list_del_init(&iocb->ki_run_list);	/*	 * cancelled requests don't get events, userland was given one	 * when the event got cancelled.	 */	if (kiocbIsCancelled(iocb))		goto put_rq;	ring = kmap_atomic(info->ring_pages[0], KM_IRQ1);	tail = info->tail;	event = aio_ring_event(info, tail, KM_IRQ0);	if (++tail >= info->nr)		tail = 0;	event->obj = (u64)(unsigned long)iocb->ki_obj.user;	event->data = iocb->ki_user_data;	event->res = res;	event->res2 = res2;	dprintk("aio_complete: %p[%lu]: %p: %p %Lx %lx %lx\n",		ctx, tail, iocb, iocb->ki_obj.user, iocb->ki_user_data,		res, res2);	/* after flagging the request as done, we	 * must never even look at it again	 */	smp_wmb();	/* make event visible before updating tail */	info->tail = tail;	ring->tail = tail;	put_aio_ring_event(event, KM_IRQ0);	kunmap_atomic(ring, KM_IRQ1);	pr_debug("added to ring %p at [%lu]\n", iocb, tail);	pr_debug("%ld retries: %d of %d\n", iocb->ki_retried,		iocb->ki_nbytes - iocb->ki_left, iocb->ki_nbytes);put_rq:	/* everything turned out well, dispose of the aiocb. */	ret = __aio_put_req(ctx, iocb);	spin_unlock_irqrestore(&ctx->ctx_lock, flags);	if (waitqueue_active(&ctx->wait))		wake_up(&ctx->wait);	if (ret)		put_ioctx(ctx);	return ret;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/20dcae32439384b6863c626bb3b2a09bed65b33e/aio.c/buggy/fs/aio.c