Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95269
b: refs/heads/master
c: 854512e
h: refs/heads/master
i:
  95267: 0be220f
v: v3
  • Loading branch information
Miklos Szeredi authored and Linus Torvalds committed Apr 30, 2008
1 parent 1c3716a commit 7fb6719
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 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: 3be5a52b30aa5cf9d795b7634f728f612197b1c4
refs/heads/master: 854512ec358f291bcadd7daea10d6bf3704933de
28 changes: 15 additions & 13 deletions trunk/fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,13 +610,24 @@ static int fuse_write_begin(struct file *file, struct address_space *mapping,
return 0;
}

static void fuse_write_update_size(struct inode *inode, loff_t pos)
{
struct fuse_conn *fc = get_fuse_conn(inode);
struct fuse_inode *fi = get_fuse_inode(inode);

spin_lock(&fc->lock);
fi->attr_version = ++fc->attr_version;
if (pos > inode->i_size)
i_size_write(inode, pos);
spin_unlock(&fc->lock);
}

static int fuse_buffered_write(struct file *file, struct inode *inode,
loff_t pos, unsigned count, struct page *page)
{
int err;
size_t nres;
struct fuse_conn *fc = get_fuse_conn(inode);
struct fuse_inode *fi = get_fuse_inode(inode);
unsigned offset = pos & (PAGE_CACHE_SIZE - 1);
struct fuse_req *req;

Expand All @@ -643,12 +654,7 @@ static int fuse_buffered_write(struct file *file, struct inode *inode,
err = -EIO;
if (!err) {
pos += nres;
spin_lock(&fc->lock);
fi->attr_version = ++fc->attr_version;
if (pos > inode->i_size)
i_size_write(inode, pos);
spin_unlock(&fc->lock);

fuse_write_update_size(inode, pos);
if (count == PAGE_CACHE_SIZE)
SetPageUptodate(page);
}
Expand Down Expand Up @@ -766,12 +772,8 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf,
}
fuse_put_request(fc, req);
if (res > 0) {
if (write) {
spin_lock(&fc->lock);
if (pos > inode->i_size)
i_size_write(inode, pos);
spin_unlock(&fc->lock);
}
if (write)
fuse_write_update_size(inode, pos);
*ppos = pos;
}
fuse_invalidate_attr(inode);
Expand Down

0 comments on commit 7fb6719

Please sign in to comment.