* [PATCH 05/11] vmscan: don't bother with debugfs_real_fops()
[not found] ` <20250702211408.GA3406663@ZenIV>
@ 2025-07-02 21:17 ` Al Viro
2025-07-03 11:51 ` Matthew Wilcox
0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2025-07-02 21:17 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-fsdevel, linux-mm
... 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>
---
mm/vmscan.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f8dfd2864bbf..0e661672cbb9 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -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;
};
--
2.39.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 05/11] vmscan: don't bother with debugfs_real_fops()
2025-07-02 21:17 ` [PATCH 05/11] vmscan: don't bother with debugfs_real_fops() Al Viro
@ 2025-07-03 11:51 ` Matthew Wilcox
2025-07-04 4:07 ` Al Viro
0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2025-07-03 11:51 UTC (permalink / raw)
To: Al Viro; +Cc: Greg Kroah-Hartman, linux-fsdevel, linux-mm
On Wed, Jul 02, 2025 at 10:17:39PM +0100, Al Viro wrote:
> - bool full = !debugfs_real_fops(m->file)->write;
> + bool full = debugfs_get_aux_num(m->file);
> + 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);
Looks like you have the polarity inverted there?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 05/11] vmscan: don't bother with debugfs_real_fops()
2025-07-03 11:51 ` Matthew Wilcox
@ 2025-07-04 4:07 ` Al Viro
0 siblings, 0 replies; 3+ messages in thread
From: Al Viro @ 2025-07-04 4:07 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: Greg Kroah-Hartman, linux-fsdevel, linux-mm
On Thu, Jul 03, 2025 at 12:51:57PM +0100, Matthew Wilcox wrote:
> On Wed, Jul 02, 2025 at 10:17:39PM +0100, Al Viro wrote:
> > - bool full = !debugfs_real_fops(m->file)->write;
> > + bool full = debugfs_get_aux_num(m->file);
>
> > + 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);
>
> Looks like you have the polarity inverted there?
Right you are. My apologies... Fixed, force-pushed into the same branch,
replacement commit below:
From 51d26db0fd00fbd501f9271550667bab6c5fb107 Mon Sep 17 00:00:00 2001
From: Al Viro <viro@zeniv.linux.org.uk>
Date: Wed, 29 Jan 2025 14:43:44 -0500
Subject: [PATCH 05/11] 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.
Braino-spotted-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
mm/vmscan.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f8dfd2864bbf..27c70848c0a0 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -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, false,
+ &lru_gen_rw_fops);
+ debugfs_create_file_aux_num("lru_gen_full", 0444, NULL, NULL, true,
+ &lru_gen_ro_fops);
return 0;
};
--
2.39.5
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-04 4:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20250702211305.GE1880847@ZenIV>
[not found] ` <20250702211408.GA3406663@ZenIV>
2025-07-02 21:17 ` [PATCH 05/11] vmscan: don't bother with debugfs_real_fops() Al Viro
2025-07-03 11:51 ` Matthew Wilcox
2025-07-04 4:07 ` Al Viro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox