nilfs2-utils: userland tools to tune nilfs
Subsystems (2)
v2 cover nilfs2-utils: userland tools to tune nilfs
Hi, this is a second patch series to introduce new user land tool named "nilfs-tune" to nilfs2-utils.
nilfs-tune is a command that modify tunable nilfs parameters, like volume label. I intented "nilfs-tune" as the step toward to unified "nilfs" command. I'm hoping finaly it will be used as "nilfs tune".
First patch introduces a new library call nilfs_sb_write to write back super blocks.
Second patch is the actual patch to add new command.
differences from first patch are following:
- fix styles
- fix typos and description of manpages
- fix a condition of assert at beginning of the nilfs_sb_write
- add condition to check sb pointer in the nilfs_sb_write
configure.ac | 7 +- include/nilfs.h | 7 + lib/nilfs.c | 16 ++ lib/sb.c | 128 ++++++++--- man/Makefile.am | 2 +- man/chcp.8 | 3 +- man/lscp.1 | 3 +- man/mkcp.8 | 3 +- man/nilfs-tune.8 | 56 +++++ man/nilfs.8 | 1 + man/rmcp.8 | 3 +- sbin/Makefile.am | 2 +- sbin/nilfs-tune/Makefile.am | 9 + sbin/nilfs-tune/nilfs-tune.c | 500 ++++++++++++++++++++++++++++++++++++++++++ 14 files changed, 696 insertions(+), 44 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1283523043-7166-1-git-send-email-jir-hfpbi5WX9J54Eiagz67IpQ@public.gmane.org
PATCH v2 1/2 nilfs2-utils: add nilfs_sb_write
This patch adds nilfs_sb_write to modify super blocks.
To modify a part of both super blocks, it first reads both super blocks then copes fields specified as "mask".
To read the super blocks, new functions nilfs_sb_read and __nilfs_sb_read are introduced. __nilfs_sb_read reads both super blocks and returns both super blocks. nilfs_sb_read calls __nilfs_sb_read and returns effective super block out of two super blocks.
nilfs_read_sb now calls nilfs_sb_read to read super block.
--- include/nilfs.h | 7 +++ lib/nilfs.c | 16 +++++++ lib/sb.c | 128 ++++++++++++++++++++++++++++++++++++++++--------------- 3 files changed, 116 insertions(+), 35 deletions(-)
include/nilfs.h +7 -0
@@ -94,6 +94,10 @@ typedef __u64 nilfs_cno_t;#define NILFS_CNO_MIN ((nilfs_cno_t)1)#define NILFS_CNO_MAX (~(nilfs_cno_t)0) +#define NILFS_SB_LABEL 0x0001 +#define NILFS_SB_UUID 0x0002 +#define NILFS_SB_COMMIT_INTERVAL 0x4000 +#define NILFS_SB_BLOCK_MAX 0x8000/** * struct nilfs - nilfs object
@@ -287,6 +291,9 @@ static inline int nilfs_block_is_node(const struct nilfs_block *blk)#define NILFS_SB_BLOCK_SIZE_SHIFT 10 +struct nilfs_super_block *nilfs_sb_read (int devfd); +int nilfs_sb_write (int devfd,struct nilfs_super_block *sbp,int mask); +int nilfs_read_sb (struct nilfs *);ssize_t nilfs_get_segment (struct nilfs *,unsigned long ,void **);
lib/nilfs.c +16 -0
@@ -939,3 +939,19 @@ nilfs_cno_t nilfs_get_oldest_cno(struct nilfs *nilfs)nilfs_get_cpinfo (nilfs, nilfs->n_mincno,NILFS_CHECKPOINT , cpinfo,1 );return nilfs->n_mincno; } + +struct nilfs_super_block *nilfs_get_sb (struct nilfs *nilfs) +{ +return nilfs->n_sb; +} + +int nilfs_read_sb (struct nilfs *nilfs) +{ +assert (nilfs->n_sb ==NULL ); + + nilfs->n_sb =nilfs_sb_read (nilfs->n_devfd); +if (!nilfs->n_sb) +return -1 ; + +return 0 ; +}
lib/sb.c +93 -35
178 lines not on this page · raw message
Signature · 6 lines
1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 2/2 nilfs-utils: add new command nilfs-tune
In reply to a message not in the archiveThis patch add new commands name nilfs-tune.
nilfs-tune modifies tunable NILFS parameters.
Currently supported parameters are:
- volume label
- UUID
- commit interval
- segment construction block max
It also displays NILFS super block information if specified.
--- configure.ac | 7 +- man/Makefile.am | 2 +- man/chcp.8 | 3 +- man/lscp.1 | 3 +- man/mkcp.8 | 3 +- man/nilfs-tune.8 | 56 +++++ man/nilfs.8 | 1 + man/rmcp.8 | 3 +- sbin/Makefile.am | 2 +- sbin/nilfs-tune/Makefile.am | 9 + sbin/nilfs-tune/nilfs-tune.c | 500 ++++++++++++++++++++++++++++++++++++++++++ 11 files changed, 580 insertions(+), 9 deletions(-) create mode 100644 man/nilfs-tune.8 create mode 100644 sbin/nilfs-tune/Makefile.am create mode 100644 sbin/nilfs-tune/nilfs-tune.c
configure.ac +4 -3
@@ -37,7 +37,7 @@ AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h paths.h \ stdlib.h string.h strings.h sys/ioctl.h sys/mount.h \ - sys/time.h syslog.h unistd.h linux/types.h]) + sys/time.h syslog.h unistd.h linux/types.h grp.h pwd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST
@@ -68,7 +68,7 @@ AC_FUNC_STRFTIME AC_FUNC_VPRINTF AC_CHECK_FUNCS([alarm atexit ftruncate getcwd gettimeofday localtime_r \ memmove memset munmap strchr strdup strerror strrchr strstr \ - strtoul]) + strtoul getgrgid getpwuid]) # Checks for system services AC_SYS_LARGEFILE
@@ -87,5 +87,6 @@ AC_CONFIG_FILES([Makefile sbin/Makefile sbin/cleanerd/Makefile sbin/mkfs/Makefile - sbin/mount/Makefile]) + sbin/mount/Makefile + sbin/nilfs-tune/Makefile]) AC_OUTPUT
man/Makefile.am +1 -1
@@ -2,4 +2,4 @@ dist_man_MANS = nilfs.8 mkfs.nilfs2.8 mount.nilfs2.8 umount.nilfs2.8 \ lscp.1 mkcp.8 chcp.8 rmcp.8 lssu.1 dumpseg.8 nilfs_cleanerd.8 \ - nilfs_cleanerd.conf.5 + nilfs_cleanerd.conf.5 nilfs-tune.8
man/chcp.8 +2 -1
@@ -33,4 +33,5 @@ http://www.nilfs.org. .BR nilfs (8), .BR lscp (1), .BR mkcp (8), -.BR rmcp (8). +.BR rmcp (8), +.BR nilfs-tune (8).
man/lscp.1 +2 -1
@@ -70,4 +70,5 @@ http://www.nilfs.org. .BR nilfs (8), .BR mkcp (8), .BR chcp (8), -.BR rmcp (8). +.BR rmcp (8), +.BR nilfs-tune (8).
man/mkcp.8 +2 -1
@@ -32,4 +32,5 @@ http://www.nilfs.org. .BR nilfs (8), .BR lscp (1), .BR chcp (8), -.BR rmcp (8). +.BR rmcp (8), +.BR nilfs-tune (8).
man/nilfs-tune.8 new file +56 -0
56 lines not on this page · raw message
man/nilfs.8 +1 -0
@@ -111,6 +111,7 @@ was developed by NILFS development team <[email protected]>. .BR umount.nilfs2 (8), .BR nilfs_cleanerd (8), .BR nilfs_cleanerd.conf (5), +.BR nilfs-tune (8), .BR lscp (1), .BR mkcp (8), .BR chcp (8),
man/rmcp.8 +2 -1
@@ -52,4 +52,5 @@ http://www.nilfs.org. .BR nilfs (8), .BR lscp (1), .BR mkcp (8), -.BR chcp (8). +.BR chcp (8), +.BR nilfs-tune (8).
sbin/Makefile.am +1 -1
@@ -1,3 +1,3 @@ ## Makefile.am -SUBDIRS = cleanerd mkfs mount +SUBDIRS = cleanerd mkfs mount nilfs-tune
sbin/nilfs-tune/Makefile.am new file +9 -0
@@ -0,0 +1,9 @@ +## Makefile.am + +AM_CFLAGS = -Wall +AM_CPPFLAGS = -I$(top_srcdir)/include + +sbin_PROGRAMS = nilfs-tune + +nilfs_tune_SOURCES = nilfs-tune.c +nilfs_tune_LDADD = $(top_builddir)/lib/libnilfs.la
sbin/nilfs-tune/nilfs-tune.c new file +500 -0
500 lines not on this page · raw message
Signature · 6 lines
1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi,
Quoted 11 lines · Jiro SEKIBA
Hi, this is a second patch series to introduce new user land tool named "nilfs-tune" to nilfs2-utils.
nilfs-tune is a command that modify tunable nilfs parameters, like volume label. I intented "nilfs-tune" as the step toward to unified "nilfs" command. I'm hoping finaly it will be used as "nilfs tune".
First patch introduces a new library call
nilfs_sb_writeto write back super blocks.Second patch is the actual patch to add new command.
I got the following error when I first tried nilfs-tune:
$ nilfs-tune -l /dev/sdb1 nilfs-tune 2.0.19 /dev/sdb1: cannot open NILFS
It took some time to understand what happened.
The message looks confusing. I think it should be as below to let users know it's a sort of privilege error.
"cannot open device: /dev/sdb1"
Anyway I applied the patches to the git repo.
Please test it and send me fixes.
Thanks!
Ryusuke Konishi
Quoted 6 lines
differences from first patch are following:
- fix styles
- fix typos and description of manpages
- fix a condition of assert at beginning of thenilfs_sb_write
- add condition to check sb pointer in thenilfs_sb_write
Quoted 15 lines
configure.ac | 7 +- include/nilfs.h | 7 + lib/nilfs.c | 16 ++ lib/sb.c | 128 ++++++++--- man/Makefile.am | 2 +- man/chcp.8 | 3 +- man/lscp.1 | 3 +- man/mkcp.8 | 3 +- man/nilfs-tune.8 | 56 +++++ man/nilfs.8 | 1 + man/rmcp.8 | 3 +- sbin/Makefile.am | 2 +- sbin/nilfs-tune/Makefile.am | 9 + sbin/nilfs-tune/nilfs-tune.c | 500 ++++++++++++++++++++++++++++++++++++++++++ 14 files changed, 696 insertions(+), 44 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html