]> err.no Git - linux-2.6/blobdiff - fs/fuse/fuse_i.h
[PATCH] fuse: add asynchronous request support
[linux-2.6] / fs / fuse / fuse_i.h
index 8cc87ebeed2ef8381552d5de13606e29be0f9d33..145098056ca6556749f12668eaead0006598cf3e 100644 (file)
@@ -120,12 +120,14 @@ enum fuse_req_state {
        FUSE_REQ_FINISHED
 };
 
+struct fuse_conn;
+
 /**
  * A request to the client
  */
 struct fuse_req {
-       /** This can be on either unused_list, pending or processing
-           lists in fuse_conn */
+       /** This can be on either unused_list, pending processing or
+           io lists in fuse_conn */
        struct list_head list;
 
        /** Entry on the background list */
@@ -186,6 +188,9 @@ struct fuse_req {
 
        /** File used in the request (or NULL) */
        struct file *file;
+
+       /** Request completion callback */
+       void (*end)(struct fuse_conn *, struct fuse_req *);
 };
 
 /**
@@ -196,9 +201,6 @@ struct fuse_req {
  * unmounted.
  */
 struct fuse_conn {
-       /** Reference count */
-       int count;
-
        /** The user id for this mount */
        uid_t user_id;
 
@@ -223,6 +225,9 @@ struct fuse_conn {
        /** The list of requests being processed */
        struct list_head processing;
 
+       /** The list of requests under I/O */
+       struct list_head io;
+
        /** Requests put in the background (RELEASE or any other
            interrupted request) */
        struct list_head background;
@@ -246,7 +251,8 @@ struct fuse_conn {
        /** Mount is active */
        unsigned mounted : 1;
 
-       /** Connection established */
+       /** Connection established, cleared on umount, connection
+           abort and device release */
        unsigned connected : 1;
 
        /** Connection failed (version mismatch) */
@@ -279,11 +285,17 @@ struct fuse_conn {
        /** Is create not implemented by fs? */
        unsigned no_create : 1;
 
+       /** The number of requests waiting for completion */
+       atomic_t num_waiting;
+
        /** Negotiated minor version */
        unsigned minor;
 
        /** Backing dev info */
        struct backing_dev_info bdi;
+
+       /** kobject */
+       struct kobject kobj;
 };
 
 static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
@@ -296,6 +308,11 @@ static inline struct fuse_conn *get_fuse_conn(struct inode *inode)
        return get_fuse_conn_super(inode->i_sb);
 }
 
+static inline struct fuse_conn *get_fuse_conn_kobj(struct kobject *obj)
+{
+       return container_of(obj, struct fuse_conn, kobj);
+}
+
 static inline struct fuse_inode *get_fuse_inode(struct inode *inode)
 {
        return container_of(inode, struct fuse_inode, inode);
@@ -395,12 +412,6 @@ void fuse_init_symlink(struct inode *inode);
  */
 void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr);
 
-/**
- * Check if the connection can be released, and if yes, then free the
- * connection structure
- */
-void fuse_release_conn(struct fuse_conn *fc);
-
 /**
  * Initialize the client device
  */
@@ -457,6 +468,9 @@ void request_send_background(struct fuse_conn *fc, struct fuse_req *req);
  */
 void fuse_release_background(struct fuse_req *req);
 
+/* Abort all requests */
+void fuse_abort_conn(struct fuse_conn *fc);
+
 /**
  * Get the attributes of a file
  */