[linux-mm-cc] [UTIL PATCH 2/2] proc entry to select algo (ver2)
IKEDA Munehiro
m-ikeda at ds.jp.nec.com
Thu May 24 05:12:07 EDT 2007
You can read numeric index of algo from /proc/sys/vm/cc_algorithm,
but it isn't understandable.
So this patch modify /proc/ccache_stats to show selected algo name.
I investigted to make cc_algorithm output algo name, but I don't
like asymmetricity of write(index)/out(string).
It is my current conclusion that ccache_stats should show it.
---
mm/ccache.c | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/mm/ccache.c b/mm/ccache.c
index fcd205c..1ad0ddb 100644
--- a/mm/ccache.c
+++ b/mm/ccache.c
@@ -404,16 +404,19 @@ static int proc_read_ccache_stats(char *page, char **start, off_t off,
return 0;
}
- if (!fs_backed_cc_started)
- goto print_anon;
- len = sprintf(page,
- "fs_backed_cc_size: %d\n", atomic_read(&fs_backed_cc_size));
-print_anon:
- if (!anon_cc_started)
- goto out;
- len += sprintf(page + len,
- "anon_cc_size: %d\n", atomic_read(&anon_cc_size));
-out:
+ if (fs_backed_cc_started || anon_cc_started) {
+ char *name = "cyclic";
+ if (ccache_selected_algo >= 0)
+ name = comp_algo[ccache_selected_algo].name;
+ len = sprintf(page, "compression algorithm: %s (%d)\n",
+ name, ccache_selected_algo);
+ if (fs_backed_cc_started)
+ len += sprintf(page + len, "fs_backed_cc_size: %d\n",
+ atomic_read(&fs_backed_cc_size));
+ if (anon_cc_started)
+ len += sprintf(page + len, "anon_cc_size: %d\n",
+ atomic_read(&anon_cc_size));
+ }
return len;
}
--
1.4.4.4
More information about the linux-mm-cc
mailing list