aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fuse/file.c')
-rw-r--r--fs/fuse/file.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index c4c59c7d0038..2b589de044e8 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -443,30 +443,37 @@ out:
443 return err; 443 return err;
444} 444}
445 445
446static size_t fuse_send_write(struct fuse_req *req, struct file *file, 446static void fuse_write_fill(struct fuse_req *req, struct fuse_file *ff,
447 struct inode *inode, loff_t pos, size_t count) 447 struct inode *inode, loff_t pos, size_t count,
448 int writepage)
448{ 449{
449 struct fuse_conn *fc = get_fuse_conn(inode); 450 struct fuse_write_in *inarg = &req->misc.write.in;
450 struct fuse_file *ff = file->private_data; 451 struct fuse_write_out *outarg = &req->misc.write.out;
451 struct fuse_write_in inarg;
452 struct fuse_write_out outarg;
453 452
454 memset(&inarg, 0, sizeof(struct fuse_write_in)); 453 memset(inarg, 0, sizeof(struct fuse_write_in));
455 inarg.fh = ff->fh; 454 inarg->fh = ff->fh;
456 inarg.offset = pos; 455 inarg->offset = pos;
457 inarg.size = count; 456 inarg->size = count;
457 inarg->write_flags = writepage ? FUSE_WRITE_CACHE : 0;
458 req->in.h.opcode = FUSE_WRITE; 458 req->in.h.opcode = FUSE_WRITE;
459 req->in.h.nodeid = get_node_id(inode); 459 req->in.h.nodeid = get_node_id(inode);
460 req->in.argpages = 1; 460 req->in.argpages = 1;
461 req->in.numargs = 2; 461 req->in.numargs = 2;
462 req->in.args[0].size = sizeof(struct fuse_write_in); 462 req->in.args[0].size = sizeof(struct fuse_write_in);
463 req->in.args[0].value = &inarg; 463 req->in.args[0].value = inarg;
464 req->in.args[1].size = count; 464 req->in.args[1].size = count;
465 req->out.numargs = 1; 465 req->out.numargs = 1;
466 req->out.args[0].size = sizeof(struct fuse_write_out); 466 req->out.args[0].size = sizeof(struct fuse_write_out);
467 req->out.args[0].value = &outarg; 467 req->out.args[0].value = outarg;
468}
469
470static size_t fuse_send_write(struct fuse_req *req, struct file *file,
471 struct inode *inode, loff_t pos, size_t count)
472{
473 struct fuse_conn *fc = get_fuse_conn(inode);
474 fuse_write_fill(req, file->private_data, inode, pos, count, 0);
468 request_send(fc, req); 475 request_send(fc, req);
469 return outarg.size; 476 return req->misc.write.out.size;
470} 477}
471 478
472static int fuse_write_begin(struct file *file, struct address_space *mapping, 479static int fuse_write_begin(struct file *file, struct address_space *mapping,