Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 116251
b: refs/heads/master
c: dfb0ec2
h: refs/heads/master
i:
  116249: da1f38d
  116247: 5367e65
v: v3
  • Loading branch information
Eric Van Hensbergen committed Oct 17, 2008
1 parent 1de3b28 commit 3817cda
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fbedadc16e5c888e4df9df3b1757de4993508d35
refs/heads/master: dfb0ec2e13a906ff19a0bbfa9208caab50cfc2e3
36 changes: 29 additions & 7 deletions trunk/fs/9p/vfs_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,27 +205,49 @@ static ssize_t
v9fs_file_write(struct file *filp, const char __user * data,
size_t count, loff_t * offset)
{
int ret;
int n, rsize, total = 0;
struct p9_fid *fid;
struct p9_client *clnt;
struct inode *inode = filp->f_path.dentry->d_inode;
int origin = *offset;

P9_DPRINTK(P9_DEBUG_VFS, "data %p count %d offset %x\n", data,
(int)count, (int)*offset);

fid = filp->private_data;
ret = p9_client_write(fid, NULL, data, *offset, count);
if (ret > 0) {
invalidate_inode_pages2_range(inode->i_mapping, *offset,
*offset+ret);
*offset += ret;
clnt = fid->clnt;

rsize = fid->iounit;
if (!rsize || rsize > clnt->msize-P9_IOHDRSZ)
rsize = clnt->msize - P9_IOHDRSZ;

do {
if (count < rsize)
rsize = count;

n = p9_client_write(fid, NULL, data+total, *offset+total,
rsize);
if (n <= 0)
break;
count -= n;
total += n;
} while (count > 0);

if (total > 0) {
invalidate_inode_pages2_range(inode->i_mapping, origin,
origin+total);
*offset += total;
}

if (*offset > inode->i_size) {
inode->i_size = *offset;
inode->i_blocks = (inode->i_size + 512 - 1) >> 9;
}

return ret;
if (n < 0)
return n;

return total;
}

static const struct file_operations v9fs_cached_file_operations = {
Expand Down

0 comments on commit 3817cda

Please sign in to comment.