kernels/linux-2.4.0/fs/nfs/write.c
/*
 * Wait for a request to complete.
 *
 * Interruptible by signals only if mounted with intr flag.
 */
Wait for a request to complete.
Interruptible by signals only if mounted with intr flag.
Wait for a request to complete . Interruptible by signals only if mounted with intr flag .
static int
nfs_wait_on_requests(struct inode *inode, struct file *file, unsigned long idx_start, unsigned int npages)
{
	struct list_head	*p, *head;
	unsigned long		idx_end;
	unsigned int		res = 0;
	int			error;
	if (npages == 0)
		idx_end = ~0;
	else
		idx_end = idx_start + npages - 1;
	spin_lock(&nfs_wreq_lock);
	head = &inode->u.nfs_i.writeback;
	p = head->next;
	while (p != head) {
		unsigned long pg_idx;
		struct nfs_page *req = nfs_inode_wb_entry(p);
		p = p->next;
		if (file && req->wb_file != file)
			continue;
		pg_idx = page_index(req->wb_page);
		if (pg_idx < idx_start || pg_idx > idx_end)
			continue;
		if (!NFS_WBACK_BUSY(req))
			continue;
		req->wb_count++;
		spin_unlock(&nfs_wreq_lock);
		error = nfs_wait_on_request(req);
		nfs_release_request(req);
		if (error < 0)
			return error;
		spin_lock(&nfs_wreq_lock);
		p = head->next;
		res++;
	}
	spin_unlock(&nfs_wreq_lock);
	return res;
}
static int nfs_wait_on_requests ( struct inode * inode , struct file * file , unsigned long idx_start , unsigned int npages ) { struct list_head * p , * head ; unsigned long idx_end ; unsigned int res = 0 ; int error ; if ( npages == 0 ) idx_end = ~ 0 ; else idx_end = idx_start + npages - 1 ; spin_lock ( & nfs_wreq_lock ) ; head = & inode -> u . nfs_i . writeback ; p = head -> next ; while ( p != head ) { unsigned long pg_idx ; struct nfs_page * req = nfs_inode_wb_entry ( p ) ; p = p -> next ; if ( file && req -> wb_file != file ) continue ; pg_idx = page_index ( req -> wb_page ) ; if ( pg_idx < idx_start || pg_idx > idx_end ) continue ; if ( ! NFS_WBACK_BUSY ( req ) ) continue ; req -> wb_count ++ ; spin_unlock ( & nfs_wreq_lock ) ; error = nfs_wait_on_request ( req ) ; nfs_release_request ( req ) ; if ( error < 0 ) return error ; spin_lock ( & nfs_wreq_lock ) ; p = head -> next ; res ++ ; } spin_unlock ( & nfs_wreq_lock ) ; return res ; }
Wait for a request to complete.
Wait for a request to complete .