kernels/linux-2.4.0/fs/nfs/write.c
/*
 * Write an mmapped page to the server.
 */
Write an mmapped page to the server.
Write an mmapped page to the server .
int
nfs_writepage(struct page *page)
{
	struct inode *inode;
	unsigned long end_index;
	unsigned offset = PAGE_CACHE_SIZE;
	int err;
	struct address_space *mapping = page->mapping;
	if (!mapping)
		BUG();
	inode = mapping->host;
	if (!inode)
		BUG();
	end_index = inode->i_size >> PAGE_CACHE_SHIFT;
	nfs_wb_page(inode,page);
	if (page->index < end_index)
		goto do_it;
	offset = inode->i_size & (PAGE_CACHE_SIZE-1);
	err = -EIO;
	if (page->index >= end_index+1 || !offset)
		goto out;
do_it:
	if (!PageError(page) && NFS_SERVER(inode)->rsize >= PAGE_CACHE_SIZE) {
		err = nfs_writepage_async(NULL, inode, page, 0, offset);
		if (err >= 0)
			goto out_ok;
	}
	err = nfs_writepage_sync(NULL, inode, page, 0, offset); 
	if ( err == offset) {
out_ok:
		err = 0;
	}
out:
	UnlockPage(page);
	return err; 
}
int nfs_writepage ( struct page * page ) { struct inode * inode ; unsigned long end_index ; unsigned offset = PAGE_CACHE_SIZE ; int err ; struct address_space * mapping = page -> mapping ; if ( ! mapping ) BUG ( ) ; inode = mapping -> host ; if ( ! inode ) BUG ( ) ; end_index = inode -> i_size >> PAGE_CACHE_SHIFT ; nfs_wb_page ( inode , page ) ; if ( page -> index < end_index ) goto do_it ; offset = inode -> i_size & ( PAGE_CACHE_SIZE - 1 ) ; err = - EIO ; if ( page -> index >= end_index + 1 || ! offset ) goto out ; do_it : if ( ! PageError ( page ) && NFS_SERVER ( inode ) -> rsize >= PAGE_CACHE_SIZE ) { err = nfs_writepage_async ( NULL , inode , page , 0 , offset ) ; if ( err >= 0 ) goto out_ok ; } err = nfs_writepage_sync ( NULL , inode , page , 0 , offset ) ; if ( err == offset ) { out_ok : err = 0 ; } out : UnlockPage ( page ) ; return err ; }
Write an mmapped page to the server.
Write an mmapped page to the server .
/* Ensure we've flushed out any previous writes */ /* easy case */ /* things got complicated... */ /* OK, are we completely out? */