aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/file.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2009-04-28 10:56:36 -0400
committerMiklos Szeredi <mszeredi@suse.cz>2009-04-28 10:56:36 -0400
commit2d698b070382442f817813b9dd0103034e5bca81 (patch)
treec3ae1688eacce081bcd815f8991cba5d03d2292e /fs/fuse/file.c
parentb0be46ebf72ca7478c1c4bd0153c42f90e768a03 (diff)
fuse: clean up fuse_write_fill()
Move out code from fuse_write_fill() which is not common to all callers. Remove two function arguments which become unnecessary. Also remove unnecessary memset(), the request is already initialized to zero. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs/fuse/file.c')
-rw-r--r--fs/fuse/file.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 3c8fa93524b0..823f84a69733 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -613,20 +613,16 @@ static ssize_t fuse_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
613 return generic_file_aio_read(iocb, iov, nr_segs, pos); 613 return generic_file_aio_read(iocb, iov, nr_segs, pos);
614} 614}
615 615
616static void fuse_write_fill(struct fuse_req *req, struct file *file, 616static void fuse_write_fill(struct fuse_req *req, struct fuse_file *ff,
617 struct fuse_file *ff, struct inode *inode, 617 struct inode *inode, loff_t pos, size_t count)
618 loff_t pos, size_t count, int writepage)
619{ 618{
620 struct fuse_conn *fc = get_fuse_conn(inode); 619 struct fuse_conn *fc = get_fuse_conn(inode);
621 struct fuse_write_in *inarg = &req->misc.write.in; 620 struct fuse_write_in *inarg = &req->misc.write.in;
622 struct fuse_write_out *outarg = &req->misc.write.out; 621 struct fuse_write_out *outarg = &req->misc.write.out;
623 622
624 memset(inarg, 0, sizeof(struct fuse_write_in));
625 inarg->fh = ff->fh; 623 inarg->fh = ff->fh;
626 inarg->offset = pos; 624 inarg->offset = pos;
627 inarg->size = count; 625 inarg->size = count;
628 inarg->write_flags = writepage ? FUSE_WRITE_CACHE : 0;
629 inarg->flags = file ? file->f_flags : 0;
630 req->in.h.opcode = FUSE_WRITE; 626 req->in.h.opcode = FUSE_WRITE;
631 req->in.h.nodeid = get_node_id(inode); 627 req->in.h.nodeid = get_node_id(inode);
632 req->in.numargs = 2; 628 req->in.numargs = 2;
@@ -646,9 +642,11 @@ static size_t fuse_send_write(struct fuse_req *req, struct file *file,
646 fl_owner_t owner) 642 fl_owner_t owner)
647{ 643{
648 struct fuse_conn *fc = get_fuse_conn(inode); 644 struct fuse_conn *fc = get_fuse_conn(inode);
649 fuse_write_fill(req, file, file->private_data, inode, pos, count, 0); 645 struct fuse_write_in *inarg = &req->misc.write.in;
646
647 fuse_write_fill(req, file->private_data, inode, pos, count);
648 inarg->flags = file->f_flags;
650 if (owner != NULL) { 649 if (owner != NULL) {
651 struct fuse_write_in *inarg = &req->misc.write.in;
652 inarg->write_flags |= FUSE_WRITE_LOCKOWNER; 650 inarg->write_flags |= FUSE_WRITE_LOCKOWNER;
653 inarg->lock_owner = fuse_lock_owner_id(fc, owner); 651 inarg->lock_owner = fuse_lock_owner_id(fc, owner);
654 } 652 }
@@ -1183,9 +1181,10 @@ static int fuse_writepage_locked(struct page *page)
1183 req->ff = fuse_file_get(ff); 1181 req->ff = fuse_file_get(ff);
1184 spin_unlock(&fc->lock); 1182 spin_unlock(&fc->lock);
1185 1183
1186 fuse_write_fill(req, NULL, ff, inode, page_offset(page), 0, 1); 1184 fuse_write_fill(req, ff, inode, page_offset(page), 0);
1187 1185
1188 copy_highpage(tmp_page, page); 1186 copy_highpage(tmp_page, page);
1187 req->misc.write.in.write_flags |= FUSE_WRITE_CACHE;
1189 req->in.argpages = 1; 1188 req->in.argpages = 1;
1190 req->num_pages = 1; 1189 req->num_pages = 1;
1191 req->pages[0] = tmp_page; 1190 req->pages[0] = tmp_page;