kernels/linux-2.4.0/fs/nfs/write.c
/*
 * Update and possibly write a cached page of an NFS file.
 *
 * XXX: Keep an eye on generic_file_read to make sure it doesn't do bad
 * things with a page scheduled for an RPC call (e.g. invalidate it).
 */
Update and possibly write a cached page of an NFS file.
XXX: Keep an eye on generic_file_read to make sure it doesn't do bad
things with a page scheduled for an RPC call .
Update and possibly write a cached page of an NFS file . XXX : Keep an eye on generic_file_read to make sure it doesn ' t do bad things with a page scheduled for an RPC call .
int
nfs_updatepage(struct file *file, struct page *page, unsigned int offset, unsigned int count)
{
	struct dentry	*dentry = file->f_dentry;
	struct inode	*inode = dentry->d_inode;
	struct nfs_page	*req;
	int		synchronous = file->f_flags & O_SYNC;
	int		status = 0;
	dprintk("NFS:      nfs_updatepage(%s/%s %d@%Ld)\n",
		dentry->d_parent->d_name.name, dentry->d_name.name,
		count, (long long)(page_offset(page) +offset));
	if (NFS_SERVER(inode)->wsize < PAGE_SIZE)
		return nfs_writepage_sync(file, inode, page, offset, count);
	do {
		req = nfs_update_request(file, inode, page, offset, count);
		status = (IS_ERR(req)) ? PTR_ERR(req) : 0;
		if (status != -EBUSY)
			break;
		status = nfs_wb_page(inode, page);
	} while (status >= 0);
	if (status < 0)
		goto done;
	if (req->wb_bytes == PAGE_CACHE_SIZE)
		SetPageUptodate(page);
	status = 0;
	if (synchronous) {
		int error;
		error = nfs_sync_file(inode, file, page_index(page), 1, FLUSH_SYNC|FLUSH_STABLE);
		if (error < 0 || (error = file->f_error) < 0)
			status = error;
		file->f_error = 0;
	} else {
		if (req->wb_offset == 0 && req->wb_bytes == PAGE_CACHE_SIZE)
			nfs_strategy(inode);
	}
	nfs_release_request(req);
done:
        dprintk("NFS:      nfs_updatepage returns %d (isize %Ld)\n",
                                                status, (long long)inode->i_size);
	if (status < 0)
		ClearPageUptodate(page);
	return status;
}
int nfs_updatepage ( struct file * file , struct page * page , unsigned int offset , unsigned int count ) { struct dentry * dentry = file -> f_dentry ; struct inode * inode = dentry -> d_inode ; struct nfs_page * req ; int synchronous = file -> f_flags & O_SYNC ; int status = 0 ; dprintk ( " \n " , dentry -> d_parent -> d_name . name , dentry -> d_name . name , count , ( long long ) ( page_offset ( page ) + offset ) ) ; if ( NFS_SERVER ( inode ) -> wsize < PAGE_SIZE ) return nfs_writepage_sync ( file , inode , page , offset , count ) ; do { req = nfs_update_request ( file , inode , page , offset , count ) ; status = ( IS_ERR ( req ) ) ? PTR_ERR ( req ) : 0 ; if ( status != - EBUSY ) break ; status = nfs_wb_page ( inode , page ) ; } while ( status >= 0 ) ; if ( status < 0 ) goto done ; if ( req -> wb_bytes == PAGE_CACHE_SIZE ) SetPageUptodate ( page ) ; status = 0 ; if ( synchronous ) { int error ; error = nfs_sync_file ( inode , file , page_index ( page ) , 1 , FLUSH_SYNC | FLUSH_STABLE ) ; if ( error < 0 || ( error = file -> f_error ) < 0 ) status = error ; file -> f_error = 0 ; } else { if ( req -> wb_offset == 0 && req -> wb_bytes == PAGE_CACHE_SIZE ) nfs_strategy ( inode ) ; } nfs_release_request ( req ) ; done : dprintk ( " \n " , status , ( long long ) inode -> i_size ) ; if ( status < 0 ) ClearPageUptodate ( page ) ; return status ; }
Update and possibly write a cached page of an NFS file.
Update and possibly write a cached page of an NFS file .
/*
	 * If wsize is smaller than page size, update and write
	 * page synchronously.
	 */ /*
	 * Try to find an NFS request corresponding to this page
	 * and update it.
	 * If the existing request cannot be updated, we must flush
	 * it out now.
	 */ /* Request could not be updated. Flush it out and try again */ /* If we wrote past the end of the page.
		 * Call the strategy routine so it can send out a bunch
		 * of requests.
		 */