]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fuse: move io_uring related members to fuse_chan
authorMiklos Szeredi <mszeredi@redhat.com>
Tue, 17 Mar 2026 14:29:04 +0000 (15:29 +0100)
committerMiklos Szeredi <mszeredi@redhat.com>
Mon, 15 Jun 2026 12:06:16 +0000 (14:06 +0200)
Move:

 - io_uring
 - ring

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/dev.c
fs/fuse/dev_uring.c
fs/fuse/dev_uring_i.h
fs/fuse/fuse_dev_i.h
fs/fuse/fuse_i.h
fs/fuse/inode.c

index 3c05a84b5d706c688f8ce21c40ac0652525b9f93..81bb40778a5b2090c7a8a411457283794929e339 100644 (file)
@@ -80,7 +80,7 @@ void fuse_set_initialized(struct fuse_conn *fc)
 static bool fuse_block_alloc(struct fuse_conn *fc, bool for_background)
 {
        return !fc->chan->initialized || (for_background && fc->chan->blocked) ||
-              (fc->io_uring && fc->chan->connected && !fuse_uring_ready(fc));
+              (fc->chan->io_uring && fc->chan->connected && !fuse_uring_ready(fc));
 }
 
 static void fuse_drop_waiting(struct fuse_conn *fc)
index 723f7f2e2b1e7993c6f6b509b99de5988ef802c3..eef7f7eac7957a74a8ea093a5136e80c9740d30a 100644 (file)
@@ -159,7 +159,7 @@ static bool ent_list_request_expired(struct fuse_conn *fc, struct list_head *lis
 
 bool fuse_uring_request_expired(struct fuse_conn *fc)
 {
-       struct fuse_ring *ring = fc->ring;
+       struct fuse_ring *ring = fc->chan->ring;
        struct fuse_ring_queue *queue;
        int qid;
 
@@ -187,7 +187,7 @@ bool fuse_uring_request_expired(struct fuse_conn *fc)
 
 void fuse_uring_destruct(struct fuse_conn *fc)
 {
-       struct fuse_ring *ring = fc->ring;
+       struct fuse_ring *ring = fc->chan->ring;
        int qid;
 
        if (!ring)
@@ -218,7 +218,7 @@ void fuse_uring_destruct(struct fuse_conn *fc)
 
        kfree(ring->queues);
        kfree(ring);
-       fc->ring = NULL;
+       fc->chan->ring = NULL;
 }
 
 /*
@@ -231,7 +231,7 @@ static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc)
        struct fuse_ring *res = NULL;
        size_t max_payload_size;
 
-       ring = kzalloc_obj(*fc->ring, GFP_KERNEL_ACCOUNT);
+       ring = kzalloc_obj(*fc->chan->ring, GFP_KERNEL_ACCOUNT);
        if (!ring)
                return NULL;
 
@@ -248,10 +248,10 @@ static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc)
                spin_unlock(&fc->lock);
                goto out_err;
        }
-       if (fc->ring) {
+       if (fc->chan->ring) {
                /* race, another thread created the ring in the meantime */
                spin_unlock(&fc->lock);
-               res = fc->ring;
+               res = fc->chan->ring;
                goto out_err;
        }
 
@@ -260,7 +260,7 @@ static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc)
        ring->nr_queues = nr_queues;
        ring->fc = fc;
        ring->max_payload_sz = max_payload_size;
-       smp_store_release(&fc->ring, ring);
+       smp_store_release(&fc->chan->ring, ring);
 
        spin_unlock(&fc->lock);
        return ring;
@@ -898,7 +898,7 @@ static int fuse_uring_commit_fetch(struct io_uring_cmd *cmd, int issue_flags,
                                                                       struct fuse_uring_cmd_req);
        struct fuse_ring_ent *ent;
        int err;
-       struct fuse_ring *ring = fc->ring;
+       struct fuse_ring *ring = fc->chan->ring;
        struct fuse_ring_queue *queue;
        uint64_t commit_id = READ_ONCE(cmd_req->commit_id);
        unsigned int qid = READ_ONCE(cmd_req->qid);
@@ -1118,7 +1118,7 @@ static int fuse_uring_register(struct io_uring_cmd *cmd,
 {
        const struct fuse_uring_cmd_req *cmd_req = io_uring_sqe128_cmd(cmd->sqe,
                                                                       struct fuse_uring_cmd_req);
-       struct fuse_ring *ring = smp_load_acquire(&fc->ring);
+       struct fuse_ring *ring = smp_load_acquire(&fc->chan->ring);
        struct fuse_ring_queue *queue;
        struct fuse_ring_ent *ent;
        int err;
@@ -1183,7 +1183,7 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags)
        fc = fud->fc;
 
        /* Once a connection has io-uring enabled on it, it can't be disabled */
-       if (!enable_uring && !fc->io_uring) {
+       if (!enable_uring && !fc->chan->io_uring) {
                pr_info_ratelimited("fuse-io-uring is disabled\n");
                return -EOPNOTSUPP;
        }
@@ -1206,7 +1206,7 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags)
                if (err) {
                        pr_info_once("FUSE_IO_URING_CMD_REGISTER failed err=%d\n",
                                     err);
-                       fc->io_uring = 0;
+                       fc->chan->io_uring = 0;
                        wake_up_all(&fc->chan->blocked_waitq);
                        return err;
                }
@@ -1307,7 +1307,7 @@ static void fuse_uring_dispatch_ent(struct fuse_ring_ent *ent)
 void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req)
 {
        struct fuse_conn *fc = req->fm->fc;
-       struct fuse_ring *ring = fc->ring;
+       struct fuse_ring *ring = fc->chan->ring;
        struct fuse_ring_queue *queue;
        struct fuse_ring_ent *ent = NULL;
        int err;
@@ -1350,7 +1350,7 @@ err:
 bool fuse_uring_queue_bq_req(struct fuse_req *req)
 {
        struct fuse_conn *fc = req->fm->fc;
-       struct fuse_ring *ring = fc->ring;
+       struct fuse_ring *ring = fc->chan->ring;
        struct fuse_ring_queue *queue;
        struct fuse_ring_ent *ent = NULL;
 
index e60057b5dbf83f5f3ef94c90cada9b56b63b45eb..35604f1c7058a92c57b1948216e4fc5518e32866 100644 (file)
@@ -148,7 +148,7 @@ bool fuse_uring_request_expired(struct fuse_conn *fc);
 
 static inline void fuse_uring_abort(struct fuse_conn *fc)
 {
-       struct fuse_ring *ring = fc->ring;
+       struct fuse_ring *ring = fc->chan->ring;
 
        if (ring == NULL)
                return;
@@ -161,7 +161,7 @@ static inline void fuse_uring_abort(struct fuse_conn *fc)
 
 static inline void fuse_uring_wait_stopped_queues(struct fuse_conn *fc)
 {
-       struct fuse_ring *ring = fc->ring;
+       struct fuse_ring *ring = fc->chan->ring;
 
        if (ring)
                wait_event(ring->stop_waitq,
@@ -170,7 +170,7 @@ static inline void fuse_uring_wait_stopped_queues(struct fuse_conn *fc)
 
 static inline bool fuse_uring_ready(struct fuse_conn *fc)
 {
-       struct fuse_ring *ring = READ_ONCE(fc->ring);
+       struct fuse_ring *ring = READ_ONCE(fc->chan->ring);
 
        return ring && smp_load_acquire(&ring->ready);
 }
index 3c350dfd31b484dc53a64b9515ded374800caa7b..916aa98671474eeff7dfd4d752241cc60030b521 100644 (file)
@@ -127,6 +127,14 @@ struct fuse_chan {
 
        /** The number of requests waiting for completion */
        atomic_t num_waiting;
+
+       /* Use io_uring for communication */
+       unsigned int io_uring;
+
+#ifdef CONFIG_FUSE_IO_URING
+       /**  uring connection information*/
+       struct fuse_ring *ring;
+#endif
 };
 
 #define FUSE_PQ_HASH_BITS 8
index a56e49c7a3249e812b828b95ab8714864a9b8e13..701bb18dcb001ddea34dfc548ab7b2e7a3174b98 100644 (file)
@@ -764,9 +764,6 @@ struct fuse_conn {
        /* Is synchronous FUSE_INIT allowed? */
        unsigned int sync_init:1;
 
-       /* Use io_uring for communication */
-       unsigned int io_uring;
-
        /** Maximum stack depth for passthrough backing files */
        int max_stack_depth;
 
@@ -819,11 +816,6 @@ struct fuse_conn {
        struct idr backing_files_map;
 #endif
 
-#ifdef CONFIG_FUSE_IO_URING
-       /**  uring connection information*/
-       struct fuse_ring *ring;
-#endif
-
        /** Only used if the connection opts into request timeouts */
        struct {
                /* Worker for checking if any requests have timed out */
index 13d788abe6de1bb64d4a209a73435c4b4d4f5665..e34881ae8b9fddf0721f708c1e53579322d0b0d0 100644 (file)
@@ -1412,7 +1412,7 @@ static void process_init_reply(struct fuse_mount *fm, struct fuse_args *args,
                                        ok = false;
                        }
                        if (flags & FUSE_OVER_IO_URING && fuse_uring_enabled())
-                               fc->io_uring = 1;
+                               fc->chan->io_uring = 1;
 
                        if (flags & FUSE_REQUEST_TIMEOUT)
                                timeout = arg->request_timeout;