Skip to contentSkip to conversation

nilfs2-utils: userland tools to tune nilfs

PATCH Superseded Jiro SEKIBA 2 participants 5 messages Aug 27, 2010 – Aug 28, 2010 2 messages not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover nilfs2-utils: userland tools to tune nilfs

Hi, this is a 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.

 configure.ac                 |    7 +-
 include/nilfs.h              |    7 +
 lib/nilfs.c                  |   16 ++
 lib/sb.c                     |  125 ++++++++---
 man/Makefile.am              |    2 +-
 man/chcp.8                   |    3 +-
 man/lscp.1                   |    3 +-
 man/mkcp.8                   |    3 +-
 man/nilfs-tune.8             |   54 +++++
 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, 691 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): 1282904230-29618-1-git-send-email-jir-hfpbi5WX9J54Eiagz67IpQ@public.gmane.org

#2 lore raw

PATCH 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 copys 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        |  125 +++++++++++++++++++++++++++++++++++++++---------------
 3 files changed, 113 insertions(+), 35 deletions(-)
include/nilfs.h +7 -0
index 5feac85..8a83dd3 100644
@@ -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
index 44e368b..19bf6e4 100644
@@ -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 +90 -35

175 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
#3 lore raw

PATCH 2/2 nilfs-utils: add new command nilfs-tune

In reply to a message not in the archive

This patch add new commands named "nilfs-tune".
nilfs-tune modifys tunable NILFS parameters.
Currently supported parameters are:
- volume label
- UUID
- commit interval
- segment contsruction 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             |   54 +++++
 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, 578 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
index 74dbae3..af75142 100644
@@ -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
index 7085c86..3953f90 100644
@@ -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
index 65445f3..031e2eb 100644
@@ -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
index 73ffc9a..0513f57 100644
@@ -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
index 20e1848..490a75b 100644
@@ -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 +54 -0

54 lines not on this page · raw message

man/nilfs.8 +1 -0
index 8ec8f13..e8089e6 100644
@@ -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
index e7d65f9..6d99a21 100644
@@ -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
index 6038b8f..0783ce0 100644
@@ -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
new file mode 100644
index 0000000..e29ba2e
@@ -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
#4 lore raw
In reply to a message not in the archive
Quoted 13 lines · Jiro SEKIBA

Hi, this is a 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.

Quoted 15 lines
 configure.ac                 |    7 +-
 include/nilfs.h              |    7 +
 lib/nilfs.c                  |   16 ++
 lib/sb.c                     |  125 ++++++++---
 man/Makefile.am              |    2 +-
 man/chcp.8                   |    3 +-
 man/lscp.1                   |    3 +-
 man/mkcp.8                   |    3 +-
 man/nilfs-tune.8             |   54 +++++
 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, 691 insertions(+), 44 deletions(-)

Thanks for posting the tune tool!

Organization of their functions looks fine to me.

But they will bring several checkpatch errors to the utils:

ERROR: trailing whitespace
#214: FILE: lib/sb.c:170:
+^I$

ERROR: spaces required around that '=' (ctx:VxV)
#232: FILE: lib/sb.c:188:

+       for (i=0;i<2;i++) {
              ^

ERROR: space required after that ';' (ctx:VxV)
#232: FILE: lib/sb.c:188:

+       for (i=0;i<2;i++) {
                ^

ERROR: spaces required around that '<' (ctx:VxV)
#232: FILE: lib/sb.c:188:

+       for (i=0;i<2;i++) {
                  ^

ERROR: space required after that ';' (ctx:VxV)
#232: FILE: lib/sb.c:188:

+       for (i=0;i<2;i++) {
                    ^

ERROR: code indent should use tabs where possible
#233: FILE: lib/sb.c:189:
+^I if (!sbps[i])$

<snip>

ERROR: space required before the open parenthesis '(' #408: FILE: sbin/nilfs-tune/nilfs-tune.c:185:
+} while(0)

ERROR: space required before the open parenthesis '(' #500: FILE: sbin/nilfs-tune/nilfs-tune.c:277:
+ switch(creator) {

ERROR: space required before the open parenthesis '(' #571: FILE: sbin/nilfs-tune/nilfs-tune.c:348:
+ if(interval)

<snip>

To keep the code clean, I think these errors should be gone though this is not a kernel code.

Could you try to clean them up ?

Thanks,
Ryusuke Konishi
--
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): [email protected]

#6 lore raw

Hi,

Thank you for the comments!
I'll clean up those, and reset later.

thanks,

regards,

At Sat, 28 Aug 2010 12:52:55 +0900 (JST),

Quoted 91 lines · Ryusuke Konishi
Quoted 13 lines · Jiro SEKIBA

Hi, this is a 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.

Quoted 15 lines
 configure.ac                 |    7 +-
 include/nilfs.h              |    7 +
 lib/nilfs.c                  |   16 ++
 lib/sb.c                     |  125 ++++++++---
 man/Makefile.am              |    2 +-
 man/chcp.8                   |    3 +-
 man/lscp.1                   |    3 +-
 man/mkcp.8                   |    3 +-
 man/nilfs-tune.8             |   54 +++++
 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, 691 insertions(+), 44 deletions(-)

Thanks for posting the tune tool!

Organization of their functions looks fine to me.

But they will bring several checkpatch errors to the utils:

ERROR: trailing whitespace
#214: FILE: lib/sb.c:170:
+^I$

ERROR: spaces required around that '=' (ctx:VxV)
#232: FILE: lib/sb.c:188:

+       for (i=0;i<2;i++) {
              ^

ERROR: space required after that ';' (ctx:VxV)
#232: FILE: lib/sb.c:188:

+       for (i=0;i<2;i++) {
                ^

ERROR: spaces required around that '<' (ctx:VxV)
#232: FILE: lib/sb.c:188:

+       for (i=0;i<2;i++) {
                  ^

ERROR: space required after that ';' (ctx:VxV)
#232: FILE: lib/sb.c:188:

+       for (i=0;i<2;i++) {
                    ^

ERROR: code indent should use tabs where possible
#233: FILE: lib/sb.c:189:
+^I if (!sbps[i])$

<snip>

ERROR: space required before the open parenthesis '(' #408: FILE: sbin/nilfs-tune/nilfs-tune.c:185:
+} while(0)

ERROR: space required before the open parenthesis '(' #500: FILE: sbin/nilfs-tune/nilfs-tune.c:277:
+ switch(creator) {

ERROR: space required before the open parenthesis '(' #571: FILE: sbin/nilfs-tune/nilfs-tune.c:348:
+ if(interval)

<snip>

To keep the code clean, I think these errors should be gone though this is not a kernel code.

Could you try to clean them up ?

Thanks,
Ryusuke Konishi

Signature · 5 lines
Jiro SEKIBA <[email protected]>
--
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