Commit a7694ff1 authored by Al Viro's avatar Al Viro Committed by Greg Kroah-Hartman
Browse files

vmscan: don't bother with debugfs_real_fops()



... 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: default avatarAl Viro <viro@zeniv.linux.org.uk>
Braino-spotted-by: default avatarMatthew Wilcox <willy@infradead.org>
Link: https://lore.kernel.org/r/20250702211739.GE3406663@ZenIV


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 460e36ee
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -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;
};