Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Al Viro and committed by
Greg Kroah-Hartman
4c0727e5 9d3b96be

+5 -7
+5 -7
block/blk-mq-debugfs.c
··· 521 521 static int blk_mq_debugfs_show(struct seq_file *m, void *v) 522 522 { 523 523 const struct blk_mq_debugfs_attr *attr = m->private; 524 - void *data = d_inode(m->file->f_path.dentry->d_parent)->i_private; 524 + void *data = debugfs_get_aux(m->file); 525 525 526 526 return attr->show(data, m); 527 527 } ··· 531 531 { 532 532 struct seq_file *m = file->private_data; 533 533 const struct blk_mq_debugfs_attr *attr = m->private; 534 - void *data = d_inode(file->f_path.dentry->d_parent)->i_private; 534 + void *data = debugfs_get_aux(file); 535 535 536 536 /* 537 537 * Attributes that only implement .seq_ops are read-only and 'attr' is ··· 546 546 static int blk_mq_debugfs_open(struct inode *inode, struct file *file) 547 547 { 548 548 const struct blk_mq_debugfs_attr *attr = inode->i_private; 549 - void *data = d_inode(file->f_path.dentry->d_parent)->i_private; 549 + void *data = debugfs_get_aux(file); 550 550 struct seq_file *m; 551 551 int ret; 552 552 ··· 612 612 if (IS_ERR_OR_NULL(parent)) 613 613 return; 614 614 615 - d_inode(parent)->i_private = data; 616 - 617 615 for (; attr->name; attr++) 618 - debugfs_create_file(attr->name, attr->mode, parent, 619 - (void *)attr, &blk_mq_debugfs_fops); 616 + debugfs_create_file_aux(attr->name, attr->mode, parent, 617 + (void *)attr, data, &blk_mq_debugfs_fops); 620 618 } 621 619 622 620 void blk_mq_debugfs_register(struct request_queue *q)