aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/file.c33
-rw-r--r--fs/fuse/fuse_i.h4
2 files changed, 24 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,
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 5657cca0d0cb..8b64a630e758 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -219,6 +219,10 @@ struct fuse_req {
219 struct fuse_init_in init_in; 219 struct fuse_init_in init_in;
220 struct fuse_init_out init_out; 220 struct fuse_init_out init_out;
221 struct fuse_read_in read_in; 221 struct fuse_read_in read_in;
222 struct {
223 struct fuse_write_in in;
224 struct fuse_write_out out;
225 } write;
222 struct fuse_lk_in lk_in; 226 struct fuse_lk_in lk_in;
223 } misc; 227 } misc;
224 228