Re: [RFC v2 83/83] Sysfs support.
On Thu, Mar 22, 2018 at 8:00 AM, David Sterbawrote: > On Sat, Mar 10, 2018 at 10:19:04AM -0800, Andiry Xu wrote: >> From: Andiry Xu >> >> Sysfs support allows user to get/post information of running NOVA instance. >> After mount, NOVA creates four entries under proc directory >> /proc/fs/nova/pmem#/: >> >> timing_stats IO_statsallocator gc >> >> Show NOVA file operation timing statistics: >> cat /proc/fs/NOVA/pmem#/timing_stats >> >> Clear timing statistics: >> echo 1 > /proc/fs/NOVA/pmem#/timing_stats >> >> Show NOVA I/O statistics: >> cat /proc/fs/NOVA/pmem#/IO_stats >> >> Clear I/O statistics: >> echo 1 > /proc/fs/NOVA/pmem#/IO_stats >> >> Show NOVA allocator information: >> cat /proc/fs/NOVA/pmem#/allocator >> >> Manual garbage collection: >> echo #inode_number > /proc/fs/NOVA/pmem#/gc > > IIRC no new entries should be added to /proc, /sys is supposed to be > used. I can't find it documented though, so you'd better check with > sysfs people. Thanks. I will try to switch to sysfs. Thanks, Andiry
Re: [RFC v2 83/83] Sysfs support.
On Thu, Mar 22, 2018 at 8:00 AM, David Sterba wrote: > On Sat, Mar 10, 2018 at 10:19:04AM -0800, Andiry Xu wrote: >> From: Andiry Xu >> >> Sysfs support allows user to get/post information of running NOVA instance. >> After mount, NOVA creates four entries under proc directory >> /proc/fs/nova/pmem#/: >> >> timing_stats IO_statsallocator gc >> >> Show NOVA file operation timing statistics: >> cat /proc/fs/NOVA/pmem#/timing_stats >> >> Clear timing statistics: >> echo 1 > /proc/fs/NOVA/pmem#/timing_stats >> >> Show NOVA I/O statistics: >> cat /proc/fs/NOVA/pmem#/IO_stats >> >> Clear I/O statistics: >> echo 1 > /proc/fs/NOVA/pmem#/IO_stats >> >> Show NOVA allocator information: >> cat /proc/fs/NOVA/pmem#/allocator >> >> Manual garbage collection: >> echo #inode_number > /proc/fs/NOVA/pmem#/gc > > IIRC no new entries should be added to /proc, /sys is supposed to be > used. I can't find it documented though, so you'd better check with > sysfs people. Thanks. I will try to switch to sysfs. Thanks, Andiry
Re: [RFC v2 83/83] Sysfs support.
On Sat, Mar 10, 2018 at 10:19:04AM -0800, Andiry Xu wrote: > From: Andiry Xu> > Sysfs support allows user to get/post information of running NOVA instance. > After mount, NOVA creates four entries under proc directory > /proc/fs/nova/pmem#/: > > timing_stats IO_statsallocator gc > > Show NOVA file operation timing statistics: > cat /proc/fs/NOVA/pmem#/timing_stats > > Clear timing statistics: > echo 1 > /proc/fs/NOVA/pmem#/timing_stats > > Show NOVA I/O statistics: > cat /proc/fs/NOVA/pmem#/IO_stats > > Clear I/O statistics: > echo 1 > /proc/fs/NOVA/pmem#/IO_stats > > Show NOVA allocator information: > cat /proc/fs/NOVA/pmem#/allocator > > Manual garbage collection: > echo #inode_number > /proc/fs/NOVA/pmem#/gc IIRC no new entries should be added to /proc, /sys is supposed to be used. I can't find it documented though, so you'd better check with sysfs people.
Re: [RFC v2 83/83] Sysfs support.
On Sat, Mar 10, 2018 at 10:19:04AM -0800, Andiry Xu wrote: > From: Andiry Xu > > Sysfs support allows user to get/post information of running NOVA instance. > After mount, NOVA creates four entries under proc directory > /proc/fs/nova/pmem#/: > > timing_stats IO_statsallocator gc > > Show NOVA file operation timing statistics: > cat /proc/fs/NOVA/pmem#/timing_stats > > Clear timing statistics: > echo 1 > /proc/fs/NOVA/pmem#/timing_stats > > Show NOVA I/O statistics: > cat /proc/fs/NOVA/pmem#/IO_stats > > Clear I/O statistics: > echo 1 > /proc/fs/NOVA/pmem#/IO_stats > > Show NOVA allocator information: > cat /proc/fs/NOVA/pmem#/allocator > > Manual garbage collection: > echo #inode_number > /proc/fs/NOVA/pmem#/gc IIRC no new entries should be added to /proc, /sys is supposed to be used. I can't find it documented though, so you'd better check with sysfs people.
Re: [RFC v2 83/83] Sysfs support.
On Wed, Mar 14, 2018 at 5:33 PM, Randy Dunlapwrote: > On 03/10/2018 10:19 AM, Andiry Xu wrote: >> Sysfs support allows user to get/post information of running NOVA instance. >> After mount, NOVA creates four entries under proc directory >> /proc/fs/nova/pmem#/: >> >> timing_stats IO_statsallocator gc > > Hi, > > This is all procfs, not sysfs, so the name is (or can be) confusing. > > Please change it. > Thanks, will fix. Andiry > -- > ~Randy
Re: [RFC v2 83/83] Sysfs support.
On Wed, Mar 14, 2018 at 5:33 PM, Randy Dunlap wrote: > On 03/10/2018 10:19 AM, Andiry Xu wrote: >> Sysfs support allows user to get/post information of running NOVA instance. >> After mount, NOVA creates four entries under proc directory >> /proc/fs/nova/pmem#/: >> >> timing_stats IO_statsallocator gc > > Hi, > > This is all procfs, not sysfs, so the name is (or can be) confusing. > > Please change it. > Thanks, will fix. Andiry > -- > ~Randy
Re: [RFC v2 83/83] Sysfs support.
On 03/10/2018 10:19 AM, Andiry Xu wrote: > Sysfs support allows user to get/post information of running NOVA instance. > After mount, NOVA creates four entries under proc directory > /proc/fs/nova/pmem#/: > > timing_stats IO_statsallocator gc Hi, This is all procfs, not sysfs, so the name is (or can be) confusing. Please change it. -- ~Randy
Re: [RFC v2 83/83] Sysfs support.
On 03/10/2018 10:19 AM, Andiry Xu wrote: > Sysfs support allows user to get/post information of running NOVA instance. > After mount, NOVA creates four entries under proc directory > /proc/fs/nova/pmem#/: > > timing_stats IO_statsallocator gc Hi, This is all procfs, not sysfs, so the name is (or can be) confusing. Please change it. -- ~Randy
[RFC v2 83/83] Sysfs support.
From: Andiry XuSysfs support allows user to get/post information of running NOVA instance. After mount, NOVA creates four entries under proc directory /proc/fs/nova/pmem#/: timing_statsIO_statsallocator gc Show NOVA file operation timing statistics: cat /proc/fs/NOVA/pmem#/timing_stats Clear timing statistics: echo 1 > /proc/fs/NOVA/pmem#/timing_stats Show NOVA I/O statistics: cat /proc/fs/NOVA/pmem#/IO_stats Clear I/O statistics: echo 1 > /proc/fs/NOVA/pmem#/IO_stats Show NOVA allocator information: cat /proc/fs/NOVA/pmem#/allocator Manual garbage collection: echo #inode_number > /proc/fs/NOVA/pmem#/gc Signed-off-by: Andiry Xu --- fs/nova/Makefile | 2 +- fs/nova/nova.h | 6 + fs/nova/super.c | 9 ++ fs/nova/super.h | 1 + fs/nova/sysfs.c | 379 +++ 5 files changed, 396 insertions(+), 1 deletion(-) create mode 100644 fs/nova/sysfs.c diff --git a/fs/nova/Makefile b/fs/nova/Makefile index 7a5fb6d..6e1c29d 100644 --- a/fs/nova/Makefile +++ b/fs/nova/Makefile @@ -5,4 +5,4 @@ obj-$(CONFIG_NOVA_FS) += nova.o nova-y := balloc.o bbuild.o dax.o dir.o file.o gc.o inode.o ioctl.o journal.o\ - log.o namei.o rebuild.o stats.o super.o symlink.o + log.o namei.o rebuild.o stats.o super.o symlink.o sysfs.o diff --git a/fs/nova/nova.h b/fs/nova/nova.h index 32b7b2f..0814676 100644 --- a/fs/nova/nova.h +++ b/fs/nova/nova.h @@ -546,6 +546,12 @@ int nova_block_symlink(struct super_block *sb, struct nova_inode *pi, struct inode *inode, const char *symname, int len, u64 epoch_id); extern const struct inode_operations nova_symlink_inode_operations; +/* sysfs.c */ +extern const char *proc_dirname; +extern struct proc_dir_entry *nova_proc_root; +void nova_sysfs_init(struct super_block *sb); +void nova_sysfs_exit(struct super_block *sb); + /* stats.c */ void nova_get_timing_stats(void); void nova_get_IO_stats(void); diff --git a/fs/nova/super.c b/fs/nova/super.c index 14b4af6..039c003 100644 --- a/fs/nova/super.c +++ b/fs/nova/super.c @@ -596,6 +596,8 @@ static int nova_fill_super(struct super_block *sb, void *data, int silent) goto out; } + nova_sysfs_init(sb); + /* Init a new nova instance */ if (sbi->s_mount_opt & NOVA_MOUNT_FORMAT) { root_pi = nova_init(sb, sbi->initsize); @@ -680,6 +682,8 @@ static int nova_fill_super(struct super_block *sb, void *data, int silent) kfree(sbi->inode_maps); sbi->inode_maps = NULL; + nova_sysfs_exit(sb); + kfree(sbi->nova_sb); kfree(sbi); nova_dbg("%s failed: return %d\n", __func__, retval); @@ -783,6 +787,8 @@ static void nova_put_super(struct super_block *sb) i, inode_map->allocated, inode_map->freed); } + nova_sysfs_exit(sb); + kfree(sbi->inode_maps); kfree(sbi->nova_sb); kfree(sbi); @@ -1007,6 +1013,8 @@ static int __init init_nova_fs(void) nova_info("Arch new instructions support: CLWB %s\n", support_clwb ? "YES" : "NO"); + nova_proc_root = proc_mkdir(proc_dirname, NULL); + rc = init_rangenode_cache(); if (rc) goto out; @@ -1041,6 +1049,7 @@ static int __init init_nova_fs(void) static void __exit exit_nova_fs(void) { unregister_filesystem(_fs_type); + remove_proc_entry(proc_dirname, NULL); destroy_file_write_item_cache(); destroy_inodecache(); destroy_rangenode_cache(); diff --git a/fs/nova/super.h b/fs/nova/super.h index bcf9548..bcbe862 100644 --- a/fs/nova/super.h +++ b/fs/nova/super.h @@ -112,6 +112,7 @@ struct nova_sb_info { struct mutexs_lock; /* protects the SB's buffer-head */ int cpus; + struct proc_dir_entry *s_proc; /* Current epoch. volatile guarantees visibility */ volatile u64 s_epoch_id; diff --git a/fs/nova/sysfs.c b/fs/nova/sysfs.c new file mode 100644 index 000..0a73ef4 --- /dev/null +++ b/fs/nova/sysfs.c @@ -0,0 +1,379 @@ +/* + * BRIEF DESCRIPTION + * + * Proc fs operations + * + * Copyright 2015-2016 Regents of the University of California, + * UCSD Non-Volatile Systems Lab, Andiry Xu + * Copyright 2012-2013 Intel Corporation + * Copyright 2009-2011 Marco Stornelli + * Copyright 2003 Sony Corporation + * Copyright 2003 Matsushita Electric Industrial Co., Ltd. + * 2003-2004 (c) MontaVista Software, Inc. , Steve Longerbeam + * + * This program is free software; you can redistribute it and/or modify it + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include "nova.h" +#include "inode.h" + +const char *proc_dirname = "fs/NOVA"; +struct proc_dir_entry *nova_proc_root; + +/*
[RFC v2 83/83] Sysfs support.
From: Andiry Xu Sysfs support allows user to get/post information of running NOVA instance. After mount, NOVA creates four entries under proc directory /proc/fs/nova/pmem#/: timing_statsIO_statsallocator gc Show NOVA file operation timing statistics: cat /proc/fs/NOVA/pmem#/timing_stats Clear timing statistics: echo 1 > /proc/fs/NOVA/pmem#/timing_stats Show NOVA I/O statistics: cat /proc/fs/NOVA/pmem#/IO_stats Clear I/O statistics: echo 1 > /proc/fs/NOVA/pmem#/IO_stats Show NOVA allocator information: cat /proc/fs/NOVA/pmem#/allocator Manual garbage collection: echo #inode_number > /proc/fs/NOVA/pmem#/gc Signed-off-by: Andiry Xu --- fs/nova/Makefile | 2 +- fs/nova/nova.h | 6 + fs/nova/super.c | 9 ++ fs/nova/super.h | 1 + fs/nova/sysfs.c | 379 +++ 5 files changed, 396 insertions(+), 1 deletion(-) create mode 100644 fs/nova/sysfs.c diff --git a/fs/nova/Makefile b/fs/nova/Makefile index 7a5fb6d..6e1c29d 100644 --- a/fs/nova/Makefile +++ b/fs/nova/Makefile @@ -5,4 +5,4 @@ obj-$(CONFIG_NOVA_FS) += nova.o nova-y := balloc.o bbuild.o dax.o dir.o file.o gc.o inode.o ioctl.o journal.o\ - log.o namei.o rebuild.o stats.o super.o symlink.o + log.o namei.o rebuild.o stats.o super.o symlink.o sysfs.o diff --git a/fs/nova/nova.h b/fs/nova/nova.h index 32b7b2f..0814676 100644 --- a/fs/nova/nova.h +++ b/fs/nova/nova.h @@ -546,6 +546,12 @@ int nova_block_symlink(struct super_block *sb, struct nova_inode *pi, struct inode *inode, const char *symname, int len, u64 epoch_id); extern const struct inode_operations nova_symlink_inode_operations; +/* sysfs.c */ +extern const char *proc_dirname; +extern struct proc_dir_entry *nova_proc_root; +void nova_sysfs_init(struct super_block *sb); +void nova_sysfs_exit(struct super_block *sb); + /* stats.c */ void nova_get_timing_stats(void); void nova_get_IO_stats(void); diff --git a/fs/nova/super.c b/fs/nova/super.c index 14b4af6..039c003 100644 --- a/fs/nova/super.c +++ b/fs/nova/super.c @@ -596,6 +596,8 @@ static int nova_fill_super(struct super_block *sb, void *data, int silent) goto out; } + nova_sysfs_init(sb); + /* Init a new nova instance */ if (sbi->s_mount_opt & NOVA_MOUNT_FORMAT) { root_pi = nova_init(sb, sbi->initsize); @@ -680,6 +682,8 @@ static int nova_fill_super(struct super_block *sb, void *data, int silent) kfree(sbi->inode_maps); sbi->inode_maps = NULL; + nova_sysfs_exit(sb); + kfree(sbi->nova_sb); kfree(sbi); nova_dbg("%s failed: return %d\n", __func__, retval); @@ -783,6 +787,8 @@ static void nova_put_super(struct super_block *sb) i, inode_map->allocated, inode_map->freed); } + nova_sysfs_exit(sb); + kfree(sbi->inode_maps); kfree(sbi->nova_sb); kfree(sbi); @@ -1007,6 +1013,8 @@ static int __init init_nova_fs(void) nova_info("Arch new instructions support: CLWB %s\n", support_clwb ? "YES" : "NO"); + nova_proc_root = proc_mkdir(proc_dirname, NULL); + rc = init_rangenode_cache(); if (rc) goto out; @@ -1041,6 +1049,7 @@ static int __init init_nova_fs(void) static void __exit exit_nova_fs(void) { unregister_filesystem(_fs_type); + remove_proc_entry(proc_dirname, NULL); destroy_file_write_item_cache(); destroy_inodecache(); destroy_rangenode_cache(); diff --git a/fs/nova/super.h b/fs/nova/super.h index bcf9548..bcbe862 100644 --- a/fs/nova/super.h +++ b/fs/nova/super.h @@ -112,6 +112,7 @@ struct nova_sb_info { struct mutexs_lock; /* protects the SB's buffer-head */ int cpus; + struct proc_dir_entry *s_proc; /* Current epoch. volatile guarantees visibility */ volatile u64 s_epoch_id; diff --git a/fs/nova/sysfs.c b/fs/nova/sysfs.c new file mode 100644 index 000..0a73ef4 --- /dev/null +++ b/fs/nova/sysfs.c @@ -0,0 +1,379 @@ +/* + * BRIEF DESCRIPTION + * + * Proc fs operations + * + * Copyright 2015-2016 Regents of the University of California, + * UCSD Non-Volatile Systems Lab, Andiry Xu + * Copyright 2012-2013 Intel Corporation + * Copyright 2009-2011 Marco Stornelli + * Copyright 2003 Sony Corporation + * Copyright 2003 Matsushita Electric Industrial Co., Ltd. + * 2003-2004 (c) MontaVista Software, Inc. , Steve Longerbeam + * + * This program is free software; you can redistribute it and/or modify it + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include "nova.h" +#include "inode.h" + +const char *proc_dirname = "fs/NOVA"; +struct proc_dir_entry *nova_proc_root; + +/* == Statistics */ +static int