aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/fuse_i.h
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2007-10-17 02:31:00 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 11:43:03 -0400
commitc756e0a4d79202535774806f148026e40466a5eb (patch)
treeaa769ecfe2204e2e1969108d2c391b88b95e983b /fs/fuse/fuse_i.h
parentde5e3dec421c44c999071b8f7e0580ad2ade92ae (diff)
fuse: add reference counting to fuse_file
Make lifetime of 'struct fuse_file' independent from 'struct file' by adding a reference counter and destructor. This will enable asynchronous page writeback, where it cannot be guaranteed, that the file is not released while a request with this file handle is being served. The actual RELEASE request is only sent when there are no more references to the fuse_file. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fuse/fuse_i.h')
-rw-r--r--fs/fuse/fuse_i.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 95bcb433d1b4..60683b787250 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -72,6 +72,9 @@ struct fuse_file {
72 72
73 /** File handle used by userspace */ 73 /** File handle used by userspace */
74 u64 fh; 74 u64 fh;
75
76 /** Refcount */
77 atomic_t count;
75}; 78};
76 79
77/** One input argument of a request */ 80/** One input argument of a request */
@@ -216,7 +219,7 @@ struct fuse_req {
216 unsigned page_offset; 219 unsigned page_offset;
217 220
218 /** File used in the request (or NULL) */ 221 /** File used in the request (or NULL) */
219 struct file *file; 222 struct fuse_file *ff;
220 223
221 /** vfsmount used in release */ 224 /** vfsmount used in release */
222 struct vfsmount *vfsmount; 225 struct vfsmount *vfsmount;
@@ -420,7 +423,7 @@ void fuse_send_forget(struct fuse_conn *fc, struct fuse_req *req,
420/** 423/**
421 * Initialize READ or READDIR request 424 * Initialize READ or READDIR request
422 */ 425 */
423void fuse_read_fill(struct fuse_req *req, struct file *file, 426void fuse_read_fill(struct fuse_req *req, struct fuse_file *ff,
424 struct inode *inode, loff_t pos, size_t count, int opcode); 427 struct inode *inode, loff_t pos, size_t count, int opcode);
425 428
426/** 429/**
@@ -433,9 +436,9 @@ void fuse_file_free(struct fuse_file *ff);
433void fuse_finish_open(struct inode *inode, struct file *file, 436void fuse_finish_open(struct inode *inode, struct file *file,
434 struct fuse_file *ff, struct fuse_open_out *outarg); 437 struct fuse_file *ff, struct fuse_open_out *outarg);
435 438
436/** */ 439/** Fill in ff->reserved_req with a RELEASE request */
437struct fuse_req *fuse_release_fill(struct fuse_file *ff, u64 nodeid, int flags, 440void fuse_release_fill(struct fuse_file *ff, u64 nodeid, int flags, int opcode);
438 int opcode); 441
439/** 442/**
440 * Send RELEASE or RELEASEDIR request 443 * Send RELEASE or RELEASEDIR request
441 */ 444 */