mirror of
https://github.com/torvalds/linux.git
synced 2025-08-15 14:11:42 +02:00
blk-mq-debugfs: use debugfs_get_aux()
instead of manually stashing the data pointer into parent directory inode's ->i_private, just pass it to debugfs_create_file_aux() so that it can be extracted without that insane chasing through ->d_parent. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Link: https://lore.kernel.org/r/20250702212818.GJ3406663@ZenIV Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9d3b96be2e
commit
4c0727e568
1 changed files with 5 additions and 7 deletions
|
@ -521,7 +521,7 @@ CTX_RQ_SEQ_OPS(poll, HCTX_TYPE_POLL);
|
|||
static int blk_mq_debugfs_show(struct seq_file *m, void *v)
|
||||
{
|
||||
const struct blk_mq_debugfs_attr *attr = m->private;
|
||||
void *data = d_inode(m->file->f_path.dentry->d_parent)->i_private;
|
||||
void *data = debugfs_get_aux(m->file);
|
||||
|
||||
return attr->show(data, m);
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ static ssize_t blk_mq_debugfs_write(struct file *file, const char __user *buf,
|
|||
{
|
||||
struct seq_file *m = file->private_data;
|
||||
const struct blk_mq_debugfs_attr *attr = m->private;
|
||||
void *data = d_inode(file->f_path.dentry->d_parent)->i_private;
|
||||
void *data = debugfs_get_aux(file);
|
||||
|
||||
/*
|
||||
* Attributes that only implement .seq_ops are read-only and 'attr' is
|
||||
|
@ -546,7 +546,7 @@ static ssize_t blk_mq_debugfs_write(struct file *file, const char __user *buf,
|
|||
static int blk_mq_debugfs_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
const struct blk_mq_debugfs_attr *attr = inode->i_private;
|
||||
void *data = d_inode(file->f_path.dentry->d_parent)->i_private;
|
||||
void *data = debugfs_get_aux(file);
|
||||
struct seq_file *m;
|
||||
int ret;
|
||||
|
||||
|
@ -612,11 +612,9 @@ static void debugfs_create_files(struct dentry *parent, void *data,
|
|||
if (IS_ERR_OR_NULL(parent))
|
||||
return;
|
||||
|
||||
d_inode(parent)->i_private = data;
|
||||
|
||||
for (; attr->name; attr++)
|
||||
debugfs_create_file(attr->name, attr->mode, parent,
|
||||
(void *)attr, &blk_mq_debugfs_fops);
|
||||
debugfs_create_file_aux(attr->name, attr->mode, parent,
|
||||
(void *)attr, data, &blk_mq_debugfs_fops);
|
||||
}
|
||||
|
||||
void blk_mq_debugfs_register(struct request_queue *q)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue