Merge tag 'fuse-update-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/mszered...
[linux-2.6-microblaze.git] / fs / fuse / fuse_i.h
index 3d18556..319596d 100644 (file)
@@ -482,6 +482,7 @@ struct fuse_dev {
 
 struct fuse_fs_context {
        int fd;
+       struct file *file;
        unsigned int rootmode;
        kuid_t user_id;
        kgid_t group_id;
@@ -508,6 +509,13 @@ struct fuse_fs_context {
        void **fudptr;
 };
 
+struct fuse_sync_bucket {
+       /* count is a possible scalability bottleneck */
+       atomic_t count;
+       wait_queue_head_t waitq;
+       struct rcu_head rcu;
+};
+
 /**
  * A Fuse connection.
  *
@@ -800,6 +808,9 @@ struct fuse_conn {
 
        /** List of filesystems using this connection */
        struct list_head mounts;
+
+       /* New writepages go into this bucket */
+       struct fuse_sync_bucket __rcu *curr_bucket;
 };
 
 /*
@@ -903,6 +914,15 @@ static inline void fuse_page_descs_length_init(struct fuse_page_desc *descs,
                descs[i].length = PAGE_SIZE - descs[i].offset;
 }
 
+static inline void fuse_sync_bucket_dec(struct fuse_sync_bucket *bucket)
+{
+       /* Need RCU protection to prevent use after free after the decrement */
+       rcu_read_lock();
+       if (atomic_dec_and_test(&bucket->count))
+               wake_up(&bucket->waitq);
+       rcu_read_unlock();
+}
+
 /** Device operations */
 extern const struct file_operations fuse_dev_operations;