diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fuse/dir.c | 10 | ||||
-rw-r--r-- | fs/fuse/file.c | 24 | ||||
-rw-r--r-- | fs/fuse/fuse_i.h | 8 |
3 files changed, 18 insertions, 24 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index e47fa3a2b4af..21fd59c7bc24 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -762,12 +762,6 @@ static int parse_dirfile(char *buf, size_t nbytes, struct file *file, | |||
762 | return 0; | 762 | return 0; |
763 | } | 763 | } |
764 | 764 | ||
765 | static size_t fuse_send_readdir(struct fuse_req *req, struct file *file, | ||
766 | struct inode *inode, loff_t pos, size_t count) | ||
767 | { | ||
768 | return fuse_send_read_common(req, file, inode, pos, count, 1); | ||
769 | } | ||
770 | |||
771 | static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir) | 765 | static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir) |
772 | { | 766 | { |
773 | int err; | 767 | int err; |
@@ -791,7 +785,9 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir) | |||
791 | } | 785 | } |
792 | req->num_pages = 1; | 786 | req->num_pages = 1; |
793 | req->pages[0] = page; | 787 | req->pages[0] = page; |
794 | nbytes = fuse_send_readdir(req, file, inode, file->f_pos, PAGE_SIZE); | 788 | fuse_read_fill(req, file, inode, file->f_pos, PAGE_SIZE, FUSE_READDIR); |
789 | request_send(fc, req); | ||
790 | nbytes = req->out.args[0].size; | ||
795 | err = req->out.h.error; | 791 | err = req->out.h.error; |
796 | fuse_put_request(fc, req); | 792 | fuse_put_request(fc, req); |
797 | if (!err) | 793 | if (!err) |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 043d5b36846d..4a0b0f9a2179 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -250,19 +250,16 @@ static int fuse_fsync(struct file *file, struct dentry *de, int datasync) | |||
250 | return fuse_fsync_common(file, de, datasync, 0); | 250 | return fuse_fsync_common(file, de, datasync, 0); |
251 | } | 251 | } |
252 | 252 | ||
253 | size_t fuse_send_read_common(struct fuse_req *req, struct file *file, | 253 | void fuse_read_fill(struct fuse_req *req, struct file *file, |
254 | struct inode *inode, loff_t pos, size_t count, | 254 | struct inode *inode, loff_t pos, size_t count, int opcode) |
255 | int isdir) | ||
256 | { | 255 | { |
257 | struct fuse_conn *fc = get_fuse_conn(inode); | ||
258 | struct fuse_file *ff = file->private_data; | 256 | struct fuse_file *ff = file->private_data; |
259 | struct fuse_read_in inarg; | 257 | struct fuse_read_in *inarg = &req->misc.read_in; |
260 | 258 | ||
261 | memset(&inarg, 0, sizeof(struct fuse_read_in)); | 259 | inarg->fh = ff->fh; |
262 | inarg.fh = ff->fh; | 260 | inarg->offset = pos; |
263 | inarg.offset = pos; | 261 | inarg->size = count; |
264 | inarg.size = count; | 262 | req->in.h.opcode = opcode; |
265 | req->in.h.opcode = isdir ? FUSE_READDIR : FUSE_READ; | ||
266 | req->in.h.nodeid = get_node_id(inode); | 263 | req->in.h.nodeid = get_node_id(inode); |
267 | req->inode = inode; | 264 | req->inode = inode; |
268 | req->file = file; | 265 | req->file = file; |
@@ -273,14 +270,15 @@ size_t fuse_send_read_common(struct fuse_req *req, struct file *file, | |||
273 | req->out.argvar = 1; | 270 | req->out.argvar = 1; |
274 | req->out.numargs = 1; | 271 | req->out.numargs = 1; |
275 | req->out.args[0].size = count; | 272 | req->out.args[0].size = count; |
276 | request_send(fc, req); | ||
277 | return req->out.args[0].size; | ||
278 | } | 273 | } |
279 | 274 | ||
280 | static size_t fuse_send_read(struct fuse_req *req, struct file *file, | 275 | static size_t fuse_send_read(struct fuse_req *req, struct file *file, |
281 | struct inode *inode, loff_t pos, size_t count) | 276 | struct inode *inode, loff_t pos, size_t count) |
282 | { | 277 | { |
283 | return fuse_send_read_common(req, file, inode, pos, count, 0); | 278 | struct fuse_conn *fc = get_fuse_conn(inode); |
279 | fuse_read_fill(req, file, inode, pos, count, FUSE_READ); | ||
280 | request_send(fc, req); | ||
281 | return req->out.args[0].size; | ||
284 | } | 282 | } |
285 | 283 | ||
286 | static int fuse_readpage(struct file *file, struct page *page) | 284 | static int fuse_readpage(struct file *file, struct page *page) |
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 926b41c959d5..7ed1d3c53b8a 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -169,6 +169,7 @@ struct fuse_req { | |||
169 | struct fuse_release_in release_in; | 169 | struct fuse_release_in release_in; |
170 | struct fuse_init_in init_in; | 170 | struct fuse_init_in init_in; |
171 | struct fuse_init_out init_out; | 171 | struct fuse_init_out init_out; |
172 | struct fuse_read_in read_in; | ||
172 | } misc; | 173 | } misc; |
173 | 174 | ||
174 | /** page vector */ | 175 | /** page vector */ |
@@ -354,11 +355,10 @@ void fuse_send_forget(struct fuse_conn *fc, struct fuse_req *req, | |||
354 | unsigned long nodeid, u64 nlookup); | 355 | unsigned long nodeid, u64 nlookup); |
355 | 356 | ||
356 | /** | 357 | /** |
357 | * Send READ or READDIR request | 358 | * Initialize READ or READDIR request |
358 | */ | 359 | */ |
359 | size_t fuse_send_read_common(struct fuse_req *req, struct file *file, | 360 | void fuse_read_fill(struct fuse_req *req, struct file *file, |
360 | struct inode *inode, loff_t pos, size_t count, | 361 | struct inode *inode, loff_t pos, size_t count, int opcode); |
361 | int isdir); | ||
362 | 362 | ||
363 | /** | 363 | /** |
364 | * Send OPEN or OPENDIR request | 364 | * Send OPEN or OPENDIR request |