Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 263248
b: refs/heads/master
c: b40cdd5
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Weiner authored and Miklos Szeredi committed Aug 8, 2011
1 parent 6ca9b4a commit 30cf998
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 71 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: 37fb3a30b46237f23cfdf7ee09d49f9888dd13bf
refs/heads/master: b40cdd56dfa065c0832905e266b39f79419e6914
70 changes: 0 additions & 70 deletions trunk/fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,18 +749,6 @@ static size_t fuse_send_write(struct fuse_req *req, struct file *file,
return req->misc.write.out.size;
}

static int fuse_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, unsigned flags,
struct page **pagep, void **fsdata)
{
pgoff_t index = pos >> PAGE_CACHE_SHIFT;

*pagep = grab_cache_page_write_begin(mapping, index, flags);
if (!*pagep)
return -ENOMEM;
return 0;
}

void fuse_write_update_size(struct inode *inode, loff_t pos)
{
struct fuse_conn *fc = get_fuse_conn(inode);
Expand All @@ -773,62 +761,6 @@ void fuse_write_update_size(struct inode *inode, loff_t 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);
unsigned offset = pos & (PAGE_CACHE_SIZE - 1);
struct fuse_req *req;

if (is_bad_inode(inode))
return -EIO;

/*
* Make sure writepages on the same page are not mixed up with
* plain writes.
*/
fuse_wait_on_page_writeback(inode, page->index);

req = fuse_get_req(fc);
if (IS_ERR(req))
return PTR_ERR(req);

req->in.argpages = 1;
req->num_pages = 1;
req->pages[0] = page;
req->page_offset = offset;
nres = fuse_send_write(req, file, pos, count, NULL);
err = req->out.h.error;
fuse_put_request(fc, req);
if (!err && !nres)
err = -EIO;
if (!err) {
pos += nres;
fuse_write_update_size(inode, pos);
if (count == PAGE_CACHE_SIZE)
SetPageUptodate(page);
}
fuse_invalidate_attr(inode);
return err ? err : nres;
}

static int fuse_write_end(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, unsigned copied,
struct page *page, void *fsdata)
{
struct inode *inode = mapping->host;
int res = 0;

if (copied)
res = fuse_buffered_write(file, inode, pos, copied, page);

unlock_page(page);
page_cache_release(page);
return res;
}

static size_t fuse_send_write_pages(struct fuse_req *req, struct file *file,
struct inode *inode, loff_t pos,
size_t count)
Expand Down Expand Up @@ -2181,8 +2113,6 @@ static const struct address_space_operations fuse_file_aops = {
.readpage = fuse_readpage,
.writepage = fuse_writepage,
.launder_page = fuse_launder_page,
.write_begin = fuse_write_begin,
.write_end = fuse_write_end,
.readpages = fuse_readpages,
.set_page_dirty = __set_page_dirty_nobuffers,
.bmap = fuse_bmap,
Expand Down

0 comments on commit 30cf998

Please sign in to comment.