From: Miklos Szeredi <mszeredi@redhat.com>
To: fuse-devel@lists.linux.dev, linux-fsdevel@vger.kernel.org
Subject: [PATCH 21/32] fuse: remove fm arg of args->end callback
Date: Thu, 16 Apr 2026 11:16:45 +0200 [thread overview]
Message-ID: <20260416091658.462783-22-mszeredi@redhat.com> (raw)
In-Reply-To: <20260416091658.462783-1-mszeredi@redhat.com>
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/cuse.c | 7 ++++---
fs/fuse/dev.c | 7 +++----
fs/fuse/file.c | 22 +++++++++-------------
fs/fuse/inode.c | 10 ++++++----
4 files changed, 22 insertions(+), 24 deletions(-)
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index 9341bb5a88cb..bf5724415b04 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -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;
@@ -467,6 +467,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);
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index cbf8f086536c..f1e7e67912a3 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -641,7 +641,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);
}
@@ -1983,8 +1983,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);
@@ -2071,7 +2070,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;
}
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 11d3797ad26b..d549f47170d6 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -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);
}
@@ -710,8 +709,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;
@@ -759,7 +757,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;
}
@@ -1001,8 +999,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);
@@ -1068,7 +1065,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)
@@ -1985,8 +1982,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);
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 5cb0cc9b365e..b7dfe8338988 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -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;
--
2.53.0
next prev parent reply other threads:[~2026-04-16 9:17 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 9:16 [PATCH 00/32] fuse: improve transport and fs layer separation Miklos Szeredi
2026-04-16 9:16 ` [PATCH 01/32] fuse: move request timeout code to a new source file Miklos Szeredi
2026-04-16 9:16 ` [PATCH 02/32] fuse: add struct fuse_chan Miklos Szeredi
2026-04-16 9:16 ` [PATCH 03/32] fuse: move fuse_iqueue to fuse_chan Miklos Szeredi
2026-04-16 9:16 ` [PATCH 04/32] fuse: move fuse_dev and fuse_pqueue to dev.c Miklos Szeredi
2026-04-16 9:16 ` [PATCH 05/32] fuse: move 'devices' member from fuse_conn to fuse_chan Miklos Szeredi
2026-04-16 9:16 ` [PATCH 06/32] fuse: move background queuing related members " Miklos Szeredi
2026-04-22 17:53 ` Joanne Koong
2026-04-23 7:20 ` Miklos Szeredi
2026-04-16 9:16 ` [PATCH 07/32] fuse: move request blocking " Miklos Szeredi
2026-04-16 9:16 ` [PATCH 08/32] fuse: move io_uring " Miklos Szeredi
2026-04-16 9:16 ` [PATCH 09/32] fuse: move interrupt " Miklos Szeredi
2026-04-16 9:16 ` [PATCH 10/32] fuse: split off fch->lock from fc->lock Miklos Szeredi
2026-04-16 9:16 ` [PATCH 11/32] fuse: add back pointer from fuse_chan to fuse_conn Miklos Szeredi
2026-04-16 9:16 ` [PATCH 12/32] fuse: move request timeout to fuse_chan Miklos Szeredi
2026-04-16 9:16 ` [PATCH 13/32] fuse: move struct fuse_req and related to fuse_dev_i.h Miklos Szeredi
2026-04-16 9:16 ` [PATCH 14/32] fuse: don't access transport layer structs directly from the fs layer Miklos Szeredi
2026-04-16 9:16 ` [PATCH 15/32] fuse: move forget related struct and helpers Miklos Szeredi
2026-04-16 9:16 ` [PATCH 16/32] fuse: move fuse_dev_waitq to dev.c Miklos Szeredi
2026-04-16 9:16 ` [PATCH 17/32] fuse: remove #include "fuse_i.h" from "dev_uring_i.h" Miklos Szeredi
2026-04-16 9:16 ` [PATCH 18/32] fuse: remove #include "fuse_i.h" from "req_timeout.c" Miklos Szeredi
2026-04-16 9:16 ` [PATCH 19/32] fuse: abort related layering cleanup Miklos Szeredi
2026-04-16 9:16 ` [PATCH 20/32] fuse: split off fuse_args and related definitions into a separate header Miklos Szeredi
2026-04-17 21:52 ` Joanne Koong
2026-04-20 10:14 ` Miklos Szeredi
2026-04-16 9:16 ` Miklos Szeredi [this message]
2026-04-16 9:16 ` [PATCH 22/32] fuse: change req->fm to req->chan Miklos Szeredi
2026-04-16 9:16 ` [PATCH 23/32] fuse: split out filesystem part of request sending Miklos Szeredi
2026-04-16 9:16 ` [PATCH 24/32] fuse: change fud->fc to fud->chan Miklos Szeredi
2026-04-16 9:16 ` [PATCH 25/32] fuse: create poll.c Miklos Szeredi
2026-04-16 9:16 ` [PATCH 26/32] fuse: create notify.c Miklos Szeredi
2026-04-16 9:16 ` [PATCH 27/32] fuse: set params in fuse_chan_set_initialized() Miklos Szeredi
2026-04-22 17:41 ` Joanne Koong
2026-04-23 7:19 ` Miklos Szeredi
2026-04-16 9:16 ` [PATCH 28/32] fuse: remove fuse_mutex protection from fuse_dev_ioctl_sync_init() Miklos Szeredi
2026-04-16 9:16 ` [PATCH 29/32] fuse: change ring->fc to ring->chan Miklos Szeredi
2026-04-16 9:16 ` [PATCH 30/32] fuse: remove #include "fuse_i.h" from dev.c and dev_uring.c Miklos Szeredi
2026-04-16 9:16 ` [PATCH 31/32] fuse: alloc pqueue before installing fch in fuse_dev Miklos Szeredi
2026-04-22 19:30 ` Joanne Koong
2026-04-16 9:16 ` [PATCH 32/32] fuse: simplify fuse_dev_ioctl_clone() Miklos Szeredi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260416091658.462783-22-mszeredi@redhat.com \
--to=mszeredi@redhat.com \
--cc=fuse-devel@lists.linux.dev \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox