]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fuse: remove fm arg of args->end callback
authorMiklos Szeredi <mszeredi@redhat.com>
Thu, 26 Mar 2026 15:11:52 +0000 (16:11 +0100)
committerMiklos Szeredi <mszeredi@redhat.com>
Mon, 15 Jun 2026 12:06:17 +0000 (14:06 +0200)
Only used by FUSE_INIT and CUSE_INIT, these can store the relevant pointer
in their structs derived from fuse_args.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/args.h
fs/fuse/cuse.c
fs/fuse/dev.c
fs/fuse/file.c
fs/fuse/inode.c

index 12c94ece569fbeb78d90ade3d94923257b5d5b1a..ecfe51a192af0becae2abed3b14672c312230151 100644 (file)
@@ -44,7 +44,7 @@ struct fuse_args {
        bool abort_on_kill:1;
        struct fuse_in_arg in_args[4];
        struct fuse_arg out_args[2];
-       void (*end)(struct fuse_mount *fm, struct fuse_args *args, int error);
+       void (*end)(struct fuse_args *args, int error);
        /* Used for kvec iter backed by vmalloc address */
        void *vmap_base;
 };
index 321ba7af0ec5146be8bed52305089fe2ba667857..f66ee8c2b310e3b48ec05a78ec8f8ab12c111dd6 100644 (file)
@@ -307,6 +307,7 @@ struct cuse_init_args {
        struct cuse_init_out out;
        struct folio *folio;
        struct fuse_folio_desc desc;
+       struct fuse_conn *fc;
 };
 
 /**
@@ -320,11 +321,10 @@ struct cuse_init_args {
  * required data structures for it.  Please read the comment at the
  * top of this file for high level overview.
  */
-static void cuse_process_init_reply(struct fuse_mount *fm,
-                                   struct fuse_args *args, int error)
+static void cuse_process_init_reply(struct fuse_args *args, int error)
 {
-       struct fuse_conn *fc = fm->fc;
        struct cuse_init_args *ia = container_of(args, typeof(*ia), ap.args);
+       struct fuse_conn *fc = ia->fc;
        struct fuse_args_pages *ap = &ia->ap;
        struct cuse_conn *cc = fc_to_cc(fc), *pos;
        struct cuse_init_out *arg = &ia->out;
@@ -469,6 +469,7 @@ static int cuse_send_init(struct cuse_conn *cc)
        ap->descs = &ia->desc;
        ia->folio = folio;
        ia->desc.length = ap->args.out_args[1].size;
+       ia->fc = &cc->fc;
        ap->args.end = cuse_process_init_reply;
 
        rc = fuse_simple_background(fm, &ap->args, GFP_KERNEL);
index c4a6ee9482829bae0e1355c9ef9f87ce09741eff..d933d030f78cbfaa17feaf77730842474af9cf15 100644 (file)
@@ -649,7 +649,7 @@ void fuse_request_end(struct fuse_req *req)
        }
 
        if (test_bit(FR_ASYNC, &req->flags))
-               req->args->end(fm, req->args, req->out.h.error);
+               req->args->end(req->args, req->out.h.error);
 put_request:
        fuse_put_request(req);
 }
@@ -1988,8 +1988,7 @@ struct fuse_retrieve_args {
        struct fuse_notify_retrieve_in inarg;
 };
 
-static void fuse_retrieve_end(struct fuse_mount *fm, struct fuse_args *args,
-                             int error)
+static void fuse_retrieve_end(struct fuse_args *args, int error)
 {
        struct fuse_retrieve_args *ra =
                container_of(args, typeof(*ra), ap.args);
@@ -2076,7 +2075,7 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode,
 
        err = fuse_simple_notify_reply(fm, args, outarg->notify_unique);
        if (err)
-               fuse_retrieve_end(fm, args, err);
+               fuse_retrieve_end(args, err);
 
        return err;
 }
index c603cb0070f2daad9b0ad808d50586fce73172e0..057ff884500d5165f6ecafdd6c71b83665833695 100644 (file)
@@ -92,8 +92,7 @@ static struct fuse_file *fuse_file_get(struct fuse_file *ff)
        return ff;
 }
 
-static void fuse_release_end(struct fuse_mount *fm, struct fuse_args *args,
-                            int error)
+static void fuse_release_end(struct fuse_args *args, int error)
 {
        struct fuse_release_args *ra = container_of(args, typeof(*ra), args);
 
@@ -113,10 +112,10 @@ static void fuse_file_put(struct fuse_file *ff, bool sync)
                if (!args) {
                        /* Do nothing when server does not implement 'opendir' */
                } else if (args->opcode == FUSE_RELEASE && ff->fm->fc->no_open) {
-                       fuse_release_end(ff->fm, args, 0);
+                       fuse_release_end(args, 0);
                } else if (sync) {
                        fuse_simple_request(ff->fm, args);
-                       fuse_release_end(ff->fm, args, 0);
+                       fuse_release_end(args, 0);
                } else {
                        /*
                         * DAX inodes may need to issue a number of synchronous
@@ -127,7 +126,7 @@ static void fuse_file_put(struct fuse_file *ff, bool sync)
                        args->end = fuse_release_end;
                        if (fuse_simple_background(ff->fm, args,
                                                   GFP_KERNEL | __GFP_NOFAIL))
-                               fuse_release_end(ff->fm, args, -ENOTCONN);
+                               fuse_release_end(args, -ENOTCONN);
                }
                kfree(ff);
        }
@@ -716,8 +715,7 @@ static void fuse_io_free(struct fuse_io_args *ia)
        kfree(ia);
 }
 
-static void fuse_aio_complete_req(struct fuse_mount *fm, struct fuse_args *args,
-                                 int err)
+static void fuse_aio_complete_req(struct fuse_args *args, int err)
 {
        struct fuse_io_args *ia = container_of(args, typeof(*ia), ap.args);
        struct fuse_io_priv *io = ia->io;
@@ -765,7 +763,7 @@ static ssize_t fuse_async_req_send(struct fuse_mount *fm,
        ia->ap.args.may_block = io->should_dirty;
        err = fuse_simple_background(fm, &ia->ap.args, GFP_KERNEL);
        if (err)
-               fuse_aio_complete_req(fm, &ia->ap.args, err);
+               fuse_aio_complete_req(&ia->ap.args, err);
 
        return num_bytes;
 }
@@ -1008,8 +1006,7 @@ static int fuse_iomap_read_folio_range(const struct iomap_iter *iter,
        return fuse_do_readfolio(file, folio, off, len);
 }
 
-static void fuse_readpages_end(struct fuse_mount *fm, struct fuse_args *args,
-                              int err)
+static void fuse_readpages_end(struct fuse_args *args, int err)
 {
        int i;
        struct fuse_io_args *ia = container_of(args, typeof(*ia), ap.args);
@@ -1075,7 +1072,7 @@ static void fuse_send_readpages(struct fuse_io_args *ia, struct file *file,
                res = fuse_simple_request(fm, &ap->args);
                err = res < 0 ? res : 0;
        }
-       fuse_readpages_end(fm, &ap->args, err);
+       fuse_readpages_end(&ap->args, err);
 }
 
 static void fuse_readahead(struct readahead_control *rac)
@@ -1992,8 +1989,7 @@ __acquires(fi->lock)
        }
 }
 
-static void fuse_writepage_end(struct fuse_mount *fm, struct fuse_args *args,
-                              int error)
+static void fuse_writepage_end(struct fuse_args *args, int error)
 {
        struct fuse_writepage_args *wpa =
                container_of(args, typeof(*wpa), ia.ap.args);
index 66e37af3a6dd4862b1e53948c66afff6b2bad608..8d689f84e533d2199dd91cc992b23ffc51b064c2 100644 (file)
@@ -1263,13 +1263,14 @@ struct fuse_init_args {
        struct fuse_args args;
        struct fuse_init_in in;
        struct fuse_init_out out;
+       struct fuse_mount *fm;
 };
 
-static void process_init_reply(struct fuse_mount *fm, struct fuse_args *args,
-                              int error)
+static void process_init_reply(struct fuse_args *args, int error)
 {
-       struct fuse_conn *fc = fm->fc;
        struct fuse_init_args *ia = container_of(args, typeof(*ia), args);
+       struct fuse_mount *fm = ia->fm;
+       struct fuse_conn *fc = fm->fc;
        struct fuse_init_out *arg = &ia->out;
        bool ok = true;
 
@@ -1437,6 +1438,7 @@ static struct fuse_init_args *fuse_new_init(struct fuse_mount *fm)
 
        ia = kzalloc_obj(*ia, GFP_KERNEL | __GFP_NOFAIL);
 
+       ia->fm = fm;
        ia->in.major = FUSE_KERNEL_VERSION;
        ia->in.minor = FUSE_KERNEL_MINOR_VERSION;
        ia->in.max_readahead = fm->sb->s_bdi->ra_pages * PAGE_SIZE;
@@ -1510,7 +1512,7 @@ int fuse_send_init(struct fuse_mount *fm)
                if (!err)
                        return 0;
        }
-       process_init_reply(fm, &ia->args, err);
+       process_init_reply(&ia->args, err);
        if (fm->fc->conn_error)
                return -ENOTCONN;
        return 0;