aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/fuse_i.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-11-26 06:03:55 -0500
committerMiklos Szeredi <miklos@szeredi.hu>2008-11-26 06:03:55 -0500
commit95668a69a4bb862063c4d28a746e55107dee7b98 (patch)
tree0679e0f43274648bad70e694a9efb8bcfed55adc /fs/fuse/fuse_i.h
parent8599396b5062bf6bd2a0b433503849e2322df1c2 (diff)
fuse: implement poll support
Implement poll support. Polled files are indexed using kh in a RB tree rooted at fuse_conn->polled_files. Client should send FUSE_NOTIFY_POLL notification once after processing FUSE_POLL which has FUSE_POLL_SCHEDULE_NOTIFY set. Sending notification unconditionally after the latest poll or everytime file content might have changed is inefficient but won't cause malfunction. fuse_file_poll() can sleep and requires patches from the following thread which allows f_op->poll() to sleep. http://thread.gmane.org/gmane.linux.kernel/726176 Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs/fuse/fuse_i.h')
-rw-r--r--fs/fuse/fuse_i.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 86f013303828..986fbd4c1ff5 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -19,6 +19,8 @@
19#include <linux/backing-dev.h> 19#include <linux/backing-dev.h>
20#include <linux/mutex.h> 20#include <linux/mutex.h>
21#include <linux/rwsem.h> 21#include <linux/rwsem.h>
22#include <linux/rbtree.h>
23#include <linux/poll.h>
22 24
23/** Max number of pages that can be used in a single read request */ 25/** Max number of pages that can be used in a single read request */
24#define FUSE_MAX_PAGES_PER_REQ 32 26#define FUSE_MAX_PAGES_PER_REQ 32
@@ -111,6 +113,12 @@ struct fuse_file {
111 113
112 /** Entry on inode's write_files list */ 114 /** Entry on inode's write_files list */
113 struct list_head write_entry; 115 struct list_head write_entry;
116
117 /** RB node to be linked on fuse_conn->polled_files */
118 struct rb_node polled_node;
119
120 /** Wait queue head for poll */
121 wait_queue_head_t poll_wait;
114}; 122};
115 123
116/** One input argument of a request */ 124/** One input argument of a request */
@@ -328,6 +336,9 @@ struct fuse_conn {
328 /** The next unique kernel file handle */ 336 /** The next unique kernel file handle */
329 u64 khctr; 337 u64 khctr;
330 338
339 /** rbtree of fuse_files waiting for poll events indexed by ph */
340 struct rb_root polled_files;
341
331 /** Number of requests currently in the background */ 342 /** Number of requests currently in the background */
332 unsigned num_background; 343 unsigned num_background;
333 344
@@ -416,6 +427,9 @@ struct fuse_conn {
416 /** Is bmap not implemented by fs? */ 427 /** Is bmap not implemented by fs? */
417 unsigned no_bmap:1; 428 unsigned no_bmap:1;
418 429
430 /** Is poll not implemented by fs? */
431 unsigned no_poll:1;
432
419 /** Do multi-page cached writes */ 433 /** Do multi-page cached writes */
420 unsigned big_writes:1; 434 unsigned big_writes:1;
421 435
@@ -525,6 +539,12 @@ int fuse_fsync_common(struct file *file, struct dentry *de, int datasync,
525 int isdir); 539 int isdir);
526 540
527/** 541/**
542 * Notify poll wakeup
543 */
544int fuse_notify_poll_wakeup(struct fuse_conn *fc,
545 struct fuse_notify_poll_wakeup_out *outarg);
546
547/**
528 * Initialize file operations on a regular file 548 * Initialize file operations on a regular file
529 */ 549 */
530void fuse_init_file_inode(struct inode *inode); 550void fuse_init_file_inode(struct inode *inode);