patch-1.3.72 linux/fs/nfs/file.c
Next file: linux/fs/nfs/inode.c
Previous file: linux/fs/nfs/dir.c
Back to the patch index
Back to the overall index
- Lines: 51
- Date:
Fri Mar 8 16:28:42 1996
- Orig file:
v1.3.71/linux/fs/nfs/file.c
- Orig date:
Wed Feb 28 11:50:10 1996
diff -u --recursive --new-file v1.3.71/linux/fs/nfs/file.c linux/fs/nfs/file.c
@@ -153,8 +153,9 @@
static int nfs_file_write(struct inode *inode, struct file *file, const char *buf,
int count)
{
- int result, hunk, i, n, pos;
+ int result, written, wsize;
struct nfs_fattr fattr;
+ unsigned long pos;
if (!inode) {
printk("nfs_file_write: inode = NULL\n");
@@ -171,24 +172,29 @@
pos = file->f_pos;
if (file->f_flags & O_APPEND)
pos = inode->i_size;
- n = NFS_SERVER(inode)->wsize;
- for (i = 0; i < count; i += n) {
- hunk = count - i;
- if (hunk >= n)
- hunk = n;
+ wsize = NFS_SERVER(inode)->wsize;
+ result = 0;
+ written = 0;
+ while (written < count) {
+ int hunk = count - written;
+ if (hunk >= wsize)
+ hunk = wsize;
result = nfs_proc_write(inode,
pos, hunk, buf, &fattr);
if (result < 0)
- return result;
+ break;
pos += hunk;
buf += hunk;
- if (hunk < n) {
- i += hunk;
+ written += hunk;
+ if (hunk < wsize)
break;
- }
}
+ if (!written)
+ return result;
file->f_pos = pos;
+ if (pos > inode->i_size)
+ inode->i_size = pos;
nfs_refresh_inode(inode, &fattr);
- return i;
+ return written;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this