cluster: STABLE3 - gfs2_tool: Remove obsolete subcommands

Steven Whitehouse swhiteho@fedoraproject.org
Wed May 27 10:22:00 GMT 2009


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=5cb749f78da0309cab91acaed80d57d8cf9efa29
Commit:        5cb749f78da0309cab91acaed80d57d8cf9efa29
Parent:        797bcb77cbed90852be871012075fd18ea0ba6c3
Author:        Steven Whitehouse <swhiteho@redhat.com>
AuthorDate:    Fri May 22 14:11:59 2009 +0100
Committer:     Steven Whitehouse <swhiteho@redhat.com>
CommitterDate: Wed May 27 10:06:54 2009 +0100

gfs2_tool: Remove obsolete subcommands

This removes the following subcommands:

list - replaced with cat /proc/mounts or mount
getargs - replaces with cat /proc/mounts or mount
shrink - obsolete
layout - obsolete and was only a stub anyway
margs - obsolete and was only a stub

I've also updated the man page.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
---
 gfs2/man/gfs2_tool.8  |   57 +++++----------
 gfs2/tool/gfs2_tool.h |   10 ---
 gfs2/tool/main.c      |    8 --
 gfs2/tool/misc.c      |  191 ++-----------------------------------------------
 4 files changed, 23 insertions(+), 243 deletions(-)

diff --git a/gfs2/man/gfs2_tool.8 b/gfs2/man/gfs2_tool.8
index a938a49..01bf4f2 100644
--- a/gfs2/man/gfs2_tool.8
+++ b/gfs2/man/gfs2_tool.8
@@ -8,7 +8,10 @@ gfs2_tool - interface to gfs2 ioctl/sysfs calls
 \fICOMMAND\fR [\fIOPTION\fR]...
 
 .SH DESCRIPTION
-gfs2_tool is an interface to a variety of the GFS2 ioctl/sysfs calls.
+gfs2_tool is an interface to a variety of the GFS2 ioctl/sysfs calls. Some
+of the functions of gfs_tool have been replaced by standard system tools
+such as mount and chattr, so gfs2_tool doesn't have as many options
+as gfs_tool used to.
 
 .SH COMMANDS
 .TP
@@ -25,47 +28,21 @@ printed is more detailed than a standard "df".
 \fBfreeze\fP \fIMountPoint\fR
 Freeze (quiesce) a GFS2 cluster.
 .TP
-\fBgetargs\fP \fIMountPoint\fR
-Get the GFS-specific mount arguments used to mount a filesystem.
-.\".TP
-.\"\fBgetsb\fP \fIMountPoint\fR
-.\"Print out the superblock of a mounted filesystem.
-.TP
 \fBgettune\fP \fIMountPoint\fR
 Print out the current values of the tuning parameters in a running
-filesystem.
+filesystem. A better source of similar (more comprehensive) information
+is that in the /proc/mounts file. Running the mount command with no
+arguments will also provide the same information. This option is
+considered obsolete and will probably be removed at some future
+date.
 .TP
 \fBjournals\fP \fIMountPoint\fR
 Print out information about the journals in a mounted filesystem.
-.\".TP
-.\"\fBjindex\fP \fIMountPoint\fR
-.\"Print out the journal index of a mounted filesystem.
-.\".TP
-.\"\fBlayout\fP \fIFile\fR \fI[buffersize]\fR
-.\"Print out on-disk layout information about a file or directory.
-.\"Buffersize is the size of the buffer (in bytes) that gfs2_tool allocates
-.\"to store the file's metadata during processing.  It defaults to 4194304
-.\"bytes.  If you are printing a very big directory you may need to specify
-.\"a bigger size.
-.TP
-\fBlist\fP
-List the currently mounted GFS2 filesystems.  Each line represents
-a filesystem.  The columns represent (in order): 1) An identifier that
-represents the mounted filesystem. 2) The name of the
-device that holds the filesystem (well, the name as the Linux
-kernel knows it).
 .TP
 \fBlockdump\fP \fIMountPoint\fR
 Print out information about the locks this machine holds for a given
-filesystem.
-.\".TP
-.\"\fBmargs\fP \fIarguments\fR
-.\"This loads arguments into the module what will override the mount
-.\"options passed with the -o field on the next mount.  See gfs2_mount(8).
-.\".TP
-.\"\fBquota\fP \fIMountPoint\fR
-.\"Print out the quota file of a mounted filesystem.  Also see
-.\"the "gfs2_quota list" command.
+filesystem. This information is also available via the debugfs
+glock dump file.
 .\".TP
 .\"\fBrindex\fP \fIMountPoint\fR
 .\"Print out the resource group index of a mounted filesystem.
@@ -101,8 +78,9 @@ Print out the superblock.
 .TP
 \fBsetflag\fP \fIFlag\fR \fIFile1\fR \fIFile2\fR \fI...\fR 
 Set an attribute flag on a file.  The currently supported flags are 
-jdata, immutable, appendonly, noatime, and sync.  In most cases, the 
-chattr command may be used rather than gfs2_tool to set attributes.
+jdata, immutable, appendonly, noatime, and sync.  The 
+chattr command is the preferred way to set attributes on
+files.
 
 The \fIjdata\fR flag causes all the data written to a file
 to be journaled.  If the \fIjdata\fR flag is set for a directory,
@@ -125,10 +103,9 @@ stable storage immediately.  Same as chattr +S.
 .TP
 \fBsettune\fP \fIMountPoint\fR \fIparameter\fR \fInewvalue\fR
 Set the value of tuning parameter.  Use \fBgettune\fP for a listing of 
-tunable parameters.
-.TP
-\fBshrink\fP \fIMountPoint\fR
-Causes any unused locks to be thrown out of memory.
+tunable parameters. The mount -oremount command is the preferred way
+to set the values of tunable parameters. At some future stage, when
+all parameters can be set via mount, this option will be removed.
 .\".TP
 .\"\fBstat\fP \fIFile\fR
 .\"Print out extended stat information about a file.
diff --git a/gfs2/tool/gfs2_tool.h b/gfs2/tool/gfs2_tool.h
index fa43eb1..4fcba9b 100644
--- a/gfs2/tool/gfs2_tool.h
+++ b/gfs2/tool/gfs2_tool.h
@@ -25,11 +25,6 @@ void print_counters(int argc, char **argv);
 void print_df(int argc, char **argv);
 
 
-/* From layout.c */
-
-void print_layout(int argc, char **argv);
-
-
 /* From main.c */
 
 void print_usage(void);
@@ -37,20 +32,15 @@ void print_usage(void);
 
 /* From misc.c */
 
-void do_file_flush(int argc, char **argv);
 void do_freeze(int argc, char **argv);
-void margs(int argc, char **argv);
 void print_lockdump(int argc, char **argv);
 void set_flag(int argc, char **argv);
 void print_stat(int argc, char **argv);
 void print_sb(int argc, char **argv);
-void print_args(int argc, char **argv);
 void print_jindex(int argc, char **argv);
 void print_journals(int argc, char **argv);
 void print_rindex(int argc, char **argv);
 void print_quota(int argc, char **argv);
-void print_list(void);
-void do_shrink(int argc, char **argv);
 void do_withdraw(int argc, char **argv);
 
 
diff --git a/gfs2/tool/main.c b/gfs2/tool/main.c
index aa872c3..3b9340e 100644
--- a/gfs2/tool/main.c
+++ b/gfs2/tool/main.c
@@ -185,26 +185,18 @@ int main(int argc, char *argv[])
 		print_df(argc, argv);
 	else if (strcmp(action, "freeze") == 0)
 		do_freeze(argc, argv);
-	else if (strcmp(action, "getargs") == 0)
-		print_args(argc, argv);
 	else if (strcmp(action, "gettune") == 0)
 		get_tune(argc, argv);
 	else if (strcmp(action, "journals") == 0)
 		print_journals(argc, argv);
-	else if (strcmp(action, "list") == 0)
-		print_list();
 	else if (strcmp(action, "lockdump") == 0)
 		print_lockdump(argc, argv);
-	else if (strcmp(action, "margs") == 0)
-		margs(argc, argv);
 	else if (strcmp(action, "sb") == 0)
 		do_sb(argc, argv);
 	else if (strcmp(action, "setflag") == 0)
 		set_flag(argc, argv);
 	else if (strcmp(action, "settune") == 0)
 		set_tune(argc, argv);
-	else if (strcmp(action, "shrink") == 0)
-		do_shrink(argc, argv);
 	else if (strcmp(action, "unfreeze") == 0)
 		do_freeze(argc, argv);
 	else if (strcmp(action, "version") == 0)
diff --git a/gfs2/tool/misc.c b/gfs2/tool/misc.c
index 649c354..359567c 100644
--- a/gfs2/tool/misc.c
+++ b/gfs2/tool/misc.c
@@ -28,8 +28,6 @@
 #define FITHAW          _IOWR('X', 120, int)    /* Thaw */
 #endif
 
-#define SYS_BASE "/sys/fs/gfs2" /* FIXME: Look in /proc/mounts to find this */
-
 /**
  * do_freeze - freeze a GFS2 filesystem
  * @argc:
@@ -75,8 +73,7 @@ void do_freeze(int argc, char **argv)
  *
  */
 
-void
-print_lockdump(int argc, char **argv)
+void print_lockdump(int argc, char **argv)
 {
 	char path[PATH_MAX];
 	char *name, line[PATH_MAX];
@@ -137,26 +134,12 @@ print_lockdump(int argc, char **argv)
 }
 
 /**
- * margs -
- * @argc:
- * @argv:
- *
- */
-
-void
-margs(int argc, char **argv)
-{
-	die( _("margs not implemented\n"));
-}
-
-/**
  * print_flags - print the flags in a dinode's di_flags field
  * @di: the dinode structure
  *
  */
 
-static void
-print_flags(struct gfs2_dinode *di)
+static void print_flags(struct gfs2_dinode *di)
 {
 	if (di->di_flags) {
 		printf( _("Flags:\n"));
@@ -183,8 +166,7 @@ print_flags(struct gfs2_dinode *di)
  * Use FS_XXX_FL flags defined in <linux/fs.h> which correspond to
  * GFS2_DIF_XXX
  */
-static unsigned int 
-get_flag_from_name(char *name)
+static unsigned int get_flag_from_name(char *name)
 {
 	if (strncmp(name, "jdata", 5) == 0)
 		return FS_JOURNAL_DATA_FL;
@@ -208,8 +190,7 @@ get_flag_from_name(char *name)
  * @argv:
  *
  */
-void
-set_flag(int argc, char **argv)
+void set_flag(int argc, char **argv)
 {
 	struct gfs2_dinode di;
 	char *flstr;
@@ -247,69 +228,13 @@ set_flag(int argc, char **argv)
 }
 
 /**
- * print_args -
- * @argc:
- * @argv:
- *
- */
-
-
-void
-print_args(int argc, char **argv)
-{
-	char *fs;
-	DIR *d;
-	struct dirent *de;
-	char path[PATH_MAX];
-	struct gfs2_sbd sbd;
-
-	if (optind == argc)
-		die( _("Usage: gfs2_tool getargs <mountpoint>\n"));
-
-	sbd.path_name = argv[optind];
-	if (check_for_gfs2(&sbd)) {
-		if (errno == EINVAL)
-			fprintf(stderr, _("Not a valid GFS2 mount point: %s\n"),
-					sbd.path_name);
-		else
-			fprintf(stderr, "%s\n", strerror(errno));
-		exit(-1);
-	}
-	fs = mp2fsname(argv[optind]);
-	if (!fs) {
-		fprintf(stderr, _("Couldn't find GFS2 filesystem mounted at %s\n"),
-				argv[optind]);
-		exit(-1);
-	}
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX - 1, "%s/%s/args/", SYS_BASE, fs);
-
-	d = opendir(path);
-	if (!d)
-		die( _("can't open %s: %s\n"), path, strerror(errno));
-
-	while((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-		snprintf(path, PATH_MAX - 1, "args/%s", de->d_name);
-		printf("%s %s\n", de->d_name, get_sysfs(fs, path));
-	}
-
-	closedir(d);
-	
-}
-
-/**
  * print_journals - print out the file system journal information
  * @argc:
  * @argv:
  *
  */
 
-void
-print_journals(int argc, char **argv)
+void print_journals(int argc, char **argv)
 {
 	struct gfs2_sbd sbd;
 	DIR *jindex;
@@ -377,117 +302,13 @@ print_journals(int argc, char **argv)
 }
 
 /**
- * print_list - print the list of mounted filesystems
- *
- */
-
-#define LIST_SIZE 1048576
-
-void
-print_list(void)
-{
-	char path[PATH_MAX];
-	char s_id[PATH_MAX];
-	char *list, *p;
-	int rv, fd, x = 0, total = 0;
-	DIR *d;
-	struct dirent *de;
-
-	list = malloc(LIST_SIZE);
-	if (!list)
-		die("out of memory\n");
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX, "%s", SYS_BASE);
-
-	d = opendir(path);
-	if (!d)
-		die( _("can't open %s: %s\n"), SYS_BASE, strerror(errno));
-
-	while ((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-		memset(path, 0, PATH_MAX);
-		snprintf(path, PATH_MAX, "%s/%s/id", SYS_BASE, de->d_name);
-
-		fd = open(path, O_RDONLY);
-		if (fd < 0)
-			die("can't open %s: %s\n", path, strerror(errno));
-
-		memset(s_id, 0, PATH_MAX);
-
-		rv = read(fd, s_id, sizeof(s_id));
-		if (rv < 0)
-			die("can't read %s: %s\n", path, strerror(errno));
-
-		close(fd);
-
-		p = strstr(s_id, "\n");
-		if (p)
-			*p = '\0';
-
-		total += strlen(s_id) + strlen(de->d_name) + 2;
-		if (total > LIST_SIZE)
-			break;
-
-		x += sprintf(list + x, "%s %s\n", s_id, de->d_name);
-
-	}
-
-	closedir(d);
-	printf("%s", list);
-	free(list);
-}
-
-/**
- * do_shrink - shrink the inode cache for a filesystem
- * @argc:
- * @argv:
- *
- */
-
-void
-do_shrink(int argc, char **argv)
-{
-	char *fs;
-	struct gfs2_sbd sbd;
-
-	if (optind == argc)
-		die("Usage: gfs2_tool shrink <mountpoint>\n");
-
-	sbd.path_name = argv[optind];
-	if (check_for_gfs2(&sbd)) {
-		if (errno == EINVAL)
-			fprintf(stderr, _("Not a valid GFS2 mount point: %s\n"),
-					sbd.path_name);
-		else
-			fprintf(stderr, "%s\n", strerror(errno));
-		exit(-1);
-	}
-	fs = mp2fsname(argv[optind]);
-	if (!fs) {
-		fprintf(stderr, _("Couldn't find GFS2 filesystem mounted at %s\n"),
-				argv[optind]);
-		exit(-1);
-	}
-	
-	if (set_sysfs(fs, "shrink", "1")) {
-		fprintf(stderr, _("Error writing to sysfs shrink file: %s\n"),
-				strerror(errno));
-		exit(-1);
-	}
-}
-
-/**
  * do_withdraw - withdraw a GFS2 filesystem
  * @argc:
  * @argv:
  *
  */
 
-void
-do_withdraw(int argc, char **argv)
+void do_withdraw(int argc, char **argv)
 {
 	char *name;
 	struct gfs2_sbd sbd;



More information about the Cluster-cvs mailing list