[Devel] [PATCH VZ10 1/7] fs/fuse: revamp the struct fuse_args;

Liu Kui kui.liu at virtuozzo.com
Tue Aug 26 13:44:49 MSK 2025


Apparently the 'inode' is redundant given the presence of 'io_inode',
so removes it.

meanwhile move the 'page_cache' and 'killed' bit after other bit field.

Signed-off-by: Liu Kui <kui.liu at virtuozzo.com>
---
 fs/fuse/dev.c    |  4 ++--
 fs/fuse/file.c   |  3 +--
 fs/fuse/fuse_i.h | 12 +++---------
 fs/fuse/inode.c  |  2 +-
 4 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index e27c7c23380f..782f79010dce 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1465,8 +1465,8 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,
 		goto out_end;
 
 	}
-	if (args->page_cache && args->inode) {
-		struct fuse_inode *fi = get_fuse_inode(args->inode);
+	if (args->page_cache && args->io_inode) {
+		struct fuse_inode *fi = get_fuse_inode(args->io_inode);
 
 		if (test_bit(FUSE_I_INVAL_FILES, &fi->state) || args->killed) {
 			req->out.h.error = -EIO;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 27e4b5491358..2b92e59ac1db 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -871,7 +871,6 @@ void fuse_read_args_fill(struct fuse_io_args *ia, struct file *file, loff_t pos,
 
 	if (opcode == FUSE_READ && count >= read_route_break) {
 		args->fiq = fuse_route_io(ff->fm->fc, &ff->fm->fc->rrt, count, args->io_inode);
-		args->inode = file->f_path.dentry->d_inode;
 		args->ff = ff;
 	}
 }
@@ -1233,7 +1232,7 @@ static void fuse_readpages_end(struct fuse_mount *fm, struct fuse_args *args,
 	struct fuse_args_pages *ap = &ia->ap;
 	size_t count = ia->read.in.size;
 	size_t num_read = args->out_args[0].size;
-	struct inode *inode = args->inode;
+	struct inode *inode = args->io_inode;
 
 	if (unlikely(killed))
 		err = -EIO;
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 3536e4216ecb..b07a18e39487 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -356,21 +356,15 @@ struct fuse_args {
 	bool nonblocking:1;
 	bool kio_internal:1;
 	bool async:1;
+	bool page_cache:1;
+	bool killed:1;
 	struct fuse_in_arg in_args[3];
 	struct fuse_arg out_args[3];
 	void (*end)(struct fuse_mount *fm, struct fuse_args *args, int error);
 	struct fuse_req *req;
 
-	/** Request contains pages from page-cache */
-	unsigned page_cache:1;
-
-	/** Request was killed -- pages were unlocked */
-	unsigned killed:1;
-
-	struct inode *io_inode;
-
 	/** Inode used in the request or NULL */
-	struct inode *inode;
+	struct inode *io_inode;
 
 	/** Request will be handled by fud pointing to this fiq */
 	struct fuse_iqueue *fiq;
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 49b49bc90a4a..987b1d3267a3 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -603,7 +603,7 @@ void fuse_kill_requests(struct fuse_conn *fc, struct inode *inode,
 	struct fuse_req *req;
 
 	list_for_each_entry(req, req_list, list)
-		if (req->args->inode == inode && req->args->page_cache &&
+		if (req->args->io_inode == inode && req->args->page_cache &&
 		    !req->args->killed) {
 			struct fuse_io_args *ia = container_of(req->args, typeof(*ia),
 							       ap.args);
-- 
2.39.5 (Apple Git-154)



More information about the Devel mailing list