patch-2.3.48 linux/fs/nfs/write.c
Next file: linux/fs/nfsd/nfsfh.c
Previous file: linux/fs/nfs/symlink.c
Back to the patch index
Back to the overall index
- Lines: 27
- Date:
Mon Feb 21 11:27:23 2000
- Orig file:
v2.3.47/linux/fs/nfs/write.c
- Orig date:
Thu Feb 10 17:11:18 2000
diff -u --recursive --new-file v2.3.47/linux/fs/nfs/write.c linux/fs/nfs/write.c
@@ -416,9 +416,23 @@
int
nfs_writepage(struct dentry * dentry, struct page *page)
{
- int result = nfs_writepage_sync(dentry, dentry->d_inode, page, 0, PAGE_SIZE);
- if ( result == PAGE_SIZE) return 0;
- return result;
+ struct inode *inode = dentry->d_inode;
+ unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT;
+ unsigned offset = PAGE_CACHE_SIZE;
+ int err;
+
+ /* easy case */
+ if (page->index < end_index)
+ goto do_it;
+ /* things got complicated... */
+ offset = inode->i_size & (PAGE_CACHE_SIZE-1);
+ /* OK, are we completely out? */
+ if (page->index >= end_index+1 || !offset)
+ return -EIO;
+do_it:
+ err = nfs_writepage_sync(dentry, inode, page, 0, offset);
+ if ( err == offset) return 0;
+ return err;
}
/*
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)