fuse: move forget related struct and helpers

Move:
 - struct fuse_forget_link to fuse_dev_i.h
 - fuse_alloc_forget() to dev.c/dev.h

Rename:
 - fuse_queue_forget -> fuse_chan_queue_forget

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
Miklos Szeredi 2026-03-31 13:18:27 +02:00
parent b6d83d4e3e
commit 4f5f0038d6
6 changed files with 29 additions and 29 deletions

View File

@ -244,6 +244,11 @@ __releases(fiq->lock)
spin_unlock(&fiq->lock);
}
struct fuse_forget_link *fuse_alloc_forget(void)
{
return kzalloc_obj(struct fuse_forget_link, GFP_KERNEL_ACCOUNT);
}
void fuse_dev_queue_forget(struct fuse_iqueue *fiq,
struct fuse_forget_link *forget)
{
@ -551,10 +556,10 @@ static void fuse_send_one(struct fuse_iqueue *fiq, struct fuse_req *req)
fiq->ops->send_req(fiq, req);
}
void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget,
u64 nodeid, u64 nlookup)
void fuse_chan_queue_forget(struct fuse_chan *fch, struct fuse_forget_link *forget,
u64 nodeid, u64 nlookup)
{
struct fuse_iqueue *fiq = &fc->chan->iq;
struct fuse_iqueue *fiq = &fch->iq;
forget->forget_one.nodeid = nodeid;
forget->forget_one.nlookup = nlookup;

View File

@ -25,6 +25,11 @@ void fuse_chan_set_fc(struct fuse_chan *fch, struct fuse_conn *fc);
void fuse_chan_set_initialized(struct fuse_chan *fch);
void fuse_chan_io_uring_enable(struct fuse_chan *fch);
struct fuse_forget_link *fuse_alloc_forget(void);
void fuse_chan_queue_forget(struct fuse_chan *fch, struct fuse_forget_link *forget,
u64 nodeid, u64 nlookup);
DEFINE_FREE(fuse_chan_free, struct fuse_chan *, if (_T) fuse_chan_free(_T))
void fuse_dev_install(struct fuse_dev *fud, struct fuse_conn *fc);

View File

@ -6,6 +6,7 @@
See the file COPYING.
*/
#include "dev.h"
#include "fuse_i.h"
#include <linux/pagemap.h>
@ -430,7 +431,7 @@ static int fuse_dentry_revalidate(struct inode *dir, const struct qstr *name,
fi = get_fuse_inode(inode);
if (outarg.nodeid != get_node_id(inode) ||
(bool) IS_AUTOMOUNT(inode) != (bool) (outarg.attr.flags & FUSE_ATTR_SUBMOUNT)) {
fuse_queue_forget(fm->fc, forget,
fuse_chan_queue_forget(fm->fc->chan, forget,
outarg.nodeid, 1);
goto invalid;
}
@ -593,7 +594,7 @@ int fuse_lookup_name(struct super_block *sb, u64 nodeid, const struct qstr *name
attr_version, evict_ctr);
err = -ENOMEM;
if (!*inode) {
fuse_queue_forget(fm->fc, forget, outarg->nodeid, 1);
fuse_chan_queue_forget(fm->fc->chan, forget, outarg->nodeid, 1);
goto out;
}
err = 0;
@ -894,7 +895,7 @@ static int fuse_create_open(struct mnt_idmap *idmap, struct inode *dir,
if (!inode) {
flags &= ~(O_CREAT | O_EXCL | O_TRUNC);
fuse_sync_release(NULL, ff, flags);
fuse_queue_forget(fm->fc, forget, outentry.nodeid, 1);
fuse_chan_queue_forget(fm->fc->chan, forget, outentry.nodeid, 1);
err = -ENOMEM;
goto out_err;
}
@ -1019,7 +1020,7 @@ static struct dentry *create_new_entry(struct mnt_idmap *idmap, struct fuse_moun
inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation,
&outarg.attr, ATTR_TIMEOUT(&outarg), 0, 0);
if (!inode) {
fuse_queue_forget(fm->fc, forget, outarg.nodeid, 1);
fuse_chan_queue_forget(fm->fc->chan, forget, outarg.nodeid, 1);
return ERR_PTR(-ENOMEM);
}
kfree(forget);

View File

@ -6,6 +6,7 @@
#ifndef _FS_FUSE_DEV_I_H
#define _FS_FUSE_DEV_I_H
#include <linux/fuse.h>
#include <linux/types.h>
/* Ordinary requests have even IDs, while interrupts IDs are odd */
@ -18,7 +19,6 @@ struct fuse_arg;
struct fuse_args;
struct fuse_pqueue;
struct fuse_iqueue;
struct fuse_forget_link;
/**
* Request flags
@ -106,6 +106,12 @@ struct fuse_req {
unsigned long create_time;
};
/* One forget request */
struct fuse_forget_link {
struct fuse_forget_one forget_one;
struct fuse_forget_link *next;
};
/**
* Input queue callbacks
*

View File

@ -68,11 +68,7 @@ extern struct mutex fuse_mutex;
extern unsigned int max_user_bgreq;
extern unsigned int max_user_congthresh;
/* One forget request */
struct fuse_forget_link {
struct fuse_forget_one forget_one;
struct fuse_forget_link *next;
};
struct fuse_forget_link;
/* Submount lookup tracking */
struct fuse_submount_lookup {
@ -883,14 +879,6 @@ struct inode *fuse_iget(struct super_block *sb, u64 nodeid,
int fuse_lookup_name(struct super_block *sb, u64 nodeid, const struct qstr *name,
struct fuse_entry_out *outarg, struct inode **inode);
/**
* Send FORGET command
*/
void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget,
u64 nodeid, u64 nlookup);
struct fuse_forget_link *fuse_alloc_forget(void);
/*
* Initialize READ or READDIR request
*/

View File

@ -66,11 +66,6 @@ MODULE_PARM_DESC(max_user_congthresh,
static struct file_system_type fuseblk_fs_type;
#endif
struct fuse_forget_link *fuse_alloc_forget(void)
{
return kzalloc_obj(struct fuse_forget_link, GFP_KERNEL_ACCOUNT);
}
static struct fuse_submount_lookup *fuse_alloc_submount_lookup(void)
{
struct fuse_submount_lookup *sl;
@ -144,7 +139,7 @@ static void fuse_cleanup_submount_lookup(struct fuse_conn *fc,
if (!refcount_dec_and_test(&sl->count))
return;
fuse_queue_forget(fc, sl->forget, sl->nodeid, 1);
fuse_chan_queue_forget(fc->chan, sl->forget, sl->nodeid, 1);
sl->forget = NULL;
kfree(sl);
}
@ -167,8 +162,8 @@ static void fuse_evict_inode(struct inode *inode)
if (FUSE_IS_DAX(inode))
fuse_dax_inode_cleanup(inode);
if (fi->nlookup) {
fuse_queue_forget(fc, fi->forget, fi->nodeid,
fi->nlookup);
fuse_chan_queue_forget(fc->chan, fi->forget, fi->nodeid,
fi->nlookup);
fi->forget = NULL;
}