]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
vmscan: don't bother with debugfs_real_fops()
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 2 Jul 2025 21:17:39 +0000 (22:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Jul 2025 11:30:28 +0000 (13:30 +0200)
... not when it's used only to check which file is used;
debugfs_create_file_aux_num() allows to stash a number into
debugfs entry and debugfs_get_aux_num() extracts it.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Braino-spotted-by: Matthew Wilcox <willy@infradead.org>
Link: https://lore.kernel.org/r/20250702211739.GE3406663@ZenIV
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/vmscan.c

index f8dfd2864bbf4fe5bbd0f52e7a89a47cd7980373..0e661672cbb939f6f598aaa556e258646def327e 100644 (file)
@@ -5420,7 +5420,7 @@ static void lru_gen_seq_show_full(struct seq_file *m, struct lruvec *lruvec,
 static int lru_gen_seq_show(struct seq_file *m, void *v)
 {
        unsigned long seq;
-       bool full = !debugfs_real_fops(m->file)->write;
+       bool full = debugfs_get_aux_num(m->file);
        struct lruvec *lruvec = v;
        struct lru_gen_folio *lrugen = &lruvec->lrugen;
        int nid = lruvec_pgdat(lruvec)->node_id;
@@ -5756,8 +5756,10 @@ static int __init init_lru_gen(void)
        if (sysfs_create_group(mm_kobj, &lru_gen_attr_group))
                pr_err("lru_gen: failed to create sysfs group\n");
 
-       debugfs_create_file("lru_gen", 0644, NULL, NULL, &lru_gen_rw_fops);
-       debugfs_create_file("lru_gen_full", 0444, NULL, NULL, &lru_gen_ro_fops);
+       debugfs_create_file_aux_num("lru_gen", 0644, NULL, NULL, 1,
+                                   &lru_gen_rw_fops);
+       debugfs_create_file_aux_num("lru_gen_full", 0444, NULL, NULL, 0,
+                                   &lru_gen_ro_fops);
 
        return 0;
 };