if (EP_IS_LINKED(&epi->rdllink)) EP_LIST_DEL(&epi->rdllink); 
if (ep_is_linked(&epi->rdllink)) ep_list_del(&epi->rdllink); 
static int ep_insert(struct eventpoll *ep, struct epoll_event *event,		     struct file *tfile, int fd){	int error, revents, pwake = 0;	unsigned long flags;	struct epitem *epi;	struct ep_pqueue epq;	error = -ENOMEM;	if (!(epi = EPI_MEM_ALLOC()))		goto eexit_1;	/* Item initialization follow here ... */	EP_RB_INITNODE(&epi->rbn);	INIT_LIST_HEAD(&epi->rdllink);	INIT_LIST_HEAD(&epi->fllink);	INIT_LIST_HEAD(&epi->txlink);	INIT_LIST_HEAD(&epi->pwqlist);	epi->ep = ep;	EP_SET_FFD(&epi->ffd, tfile, fd);	epi->event = *event;	atomic_set(&epi->usecnt, 1);	epi->nwait = 0;	/* Initialize the poll table using the queue callback */	epq.epi = epi;	init_poll_funcptr(&epq.pt, ep_ptable_queue_proc);	/*	 * Attach the item to the poll hooks and get current event bits.	 * We can safely use the file* here because its usage count has	 * been increased by the caller of this function.	 */	revents = tfile->f_op->poll(tfile, &epq.pt);	/*	 * We have to check if something went wrong during the poll wait queue	 * install process. Namely an allocation for a wait queue failed due	 * high memory pressure.	 */	if (epi->nwait < 0)		goto eexit_2;	/* Add the current item to the list of active epoll hook for this file */	spin_lock(&tfile->f_ep_lock);	list_add_tail(&epi->fllink, &tfile->f_ep_links);	spin_unlock(&tfile->f_ep_lock);	/* We have to drop the new item inside our item list to keep track of it */	write_lock_irqsave(&ep->lock, flags);	/* Add the current item to the rb-tree */	ep_rbtree_insert(ep, epi);	/* If the file is already "ready" we drop it inside the ready list */	if ((revents & event->events) && !EP_IS_LINKED(&epi->rdllink)) {		list_add_tail(&epi->rdllink, &ep->rdllist);		/* Notify waiting tasks that events are available */		if (waitqueue_active(&ep->wq))			wake_up(&ep->wq);		if (waitqueue_active(&ep->poll_wait))			pwake++;	}	write_unlock_irqrestore(&ep->lock, flags);	/* We have to call this outside the lock */	if (pwake)		ep_poll_safewake(&psw, &ep->poll_wait);	DNPRINTK(3, (KERN_INFO "[%p] eventpoll: ep_insert(%p, %p, %d)\n",		     current, ep, tfile, fd));	return 0;eexit_2:	ep_unregister_pollwait(ep, epi);	/*	 * We need to do this because an event could have been arrived on some	 * allocated wait queue.	 */	write_lock_irqsave(&ep->lock, flags);	if (EP_IS_LINKED(&epi->rdllink))		EP_LIST_DEL(&epi->rdllink);	write_unlock_irqrestore(&ep->lock, flags);	EPI_MEM_FREE(epi);eexit_1:	return error;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/b030a4dd609e167da7f73c2d1fa5af864a0aea17/eventpoll.c/clean/fs/eventpoll.c