All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cluster-devel] cluster/gfs2 man/gfs2_tool.8 tool/gfs2_tool.h  ...
@ 2007-10-30 14:06 rpeterso
  0 siblings, 0 replies; 2+ messages in thread
From: rpeterso @ 2007-10-30 14:06 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	rpeterso at sourceware.org	2007-10-30 14:06:06

Modified files:
	gfs2/man       : gfs2_tool.8 
	gfs2/tool      : gfs2_tool.h main.c misc.c 

Log message:
	Resolves: bz 349601: GFS2 requires straightforward way to determine
	number of journals

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/man/gfs2_tool.8.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/tool/gfs2_tool.h.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/tool/main.c.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/tool/misc.c.diff?cvsroot=cluster&r1=1.10&r2=1.11

--- cluster/gfs2/man/gfs2_tool.8	2007/07/26 23:19:31	1.4
+++ cluster/gfs2/man/gfs2_tool.8	2007/10/30 14:06:06	1.5
@@ -41,6 +41,9 @@
 \fBgettune\fP \fIMountPoint\fR
 Print out the current values of the tuning parameters in a running
 filesystem.
+.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.
--- cluster/gfs2/tool/gfs2_tool.h	2007/10/25 14:14:33	1.7
+++ cluster/gfs2/tool/gfs2_tool.h	2007/10/30 14:06:06	1.8
@@ -72,6 +72,7 @@
 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);
--- cluster/gfs2/tool/main.c	2007/10/11 20:27:49	1.6
+++ cluster/gfs2/tool/main.c	2007/10/30 14:06:06	1.7
@@ -53,6 +53,9 @@
 	"Get tuneable parameters for a filesystem\n",
 	"  gfs2_tool gettune <mountpoint>\n",
 	"\n",
+	"List the file system's journals:\n",
+	"  gfs2_tool journals <mountpoint>\n",
+	"\n",
 	"List filesystems:\n",
 	"  gfs2_tool list\n",
 	"\n",
@@ -235,6 +238,8 @@
 		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)
--- cluster/gfs2/tool/misc.c	2007/10/25 14:27:33	1.10
+++ cluster/gfs2/tool/misc.c	2007/10/30 14:06:06	1.11
@@ -358,6 +358,71 @@
 	
 }
 
+/**
+ * print_journals - print out the file system journal information
+ * @argc:
+ * @argv:
+ *
+ */
+
+void
+print_journals(int argc, char **argv)
+{
+	struct gfs2_sbd sbd;
+	DIR *jindex;
+	struct dirent *journal;
+	char jindex_name[PATH_MAX], jname[PATH_MAX];
+	int jcount;
+	struct stat statbuf;
+
+	memset(&sbd, 0, sizeof(struct gfs2_sbd));
+	sbd.bsize = GFS2_DEFAULT_BSIZE;
+	sbd.rgsize = -1;
+	sbd.jsize = GFS2_DEFAULT_JSIZE;
+	sbd.qcsize = GFS2_DEFAULT_QCSIZE;
+	sbd.md.journals = 1;
+
+	sbd.path_name = argv[optind];
+	sbd.path_fd = open(sbd.path_name, O_RDONLY);
+	if (sbd.path_fd < 0)
+		die("can't open root directory %s: %s\n",
+		    sbd.path_name, strerror(errno));
+	check_for_gfs2(&sbd);
+	sbd.device_fd = open(sbd.device_name, O_RDONLY);
+	if (sbd.device_fd < 0)
+		die("can't open device %s: %s\n",
+		    sbd.device_name, strerror(errno));
+	if (!find_gfs2_meta(&sbd))
+		mount_gfs2_meta(&sbd);
+	lock_for_admin(&sbd);
+
+	sprintf(jindex_name, "%s/jindex", sbd.metafs_path);
+	jindex = opendir(jindex_name);
+	if (!jindex) {
+		die("Can't open %s\n", jindex_name);
+	} else {
+		jcount = 0;
+		while ((journal = readdir(jindex))) {
+			if (journal->d_name[0] == '.')
+				continue;
+			sprintf(jname, "%s/%s", jindex_name, journal->d_name);
+			if (stat(jname, &statbuf)) {
+				statbuf.st_size = 0;
+				perror(jname);
+			}
+			jcount++;
+			printf("%s - %lluMB\n", journal->d_name,
+			       (unsigned long long)statbuf.st_size / 1048576);
+		}
+
+		printf("%d journal(s) found.\n", jcount);
+		closedir(jindex);
+	}
+	cleanup_metafs(&sbd);
+	close(sbd.device_fd);
+	close(sbd.path_fd);
+}
+
 #if GFS2_TOOL_FEATURE_IMPLEMENTED 
 /**
  * print_jindex - print out the journal index



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Cluster-devel] cluster/gfs2 man/gfs2_tool.8 tool/gfs2_tool.h  ...
@ 2007-10-30 14:08 rpeterso
  0 siblings, 0 replies; 2+ messages in thread
From: rpeterso @ 2007-10-30 14:08 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	rpeterso at sourceware.org	2007-10-30 14:08:33

Modified files:
	gfs2/man       : gfs2_tool.8 
	gfs2/tool      : gfs2_tool.h main.c misc.c 

Log message:
	Resolves: bz 349601: GFS2 requires straightforward way to determine
	number of journals

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/man/gfs2_tool.8.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.1&r2=1.3.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/tool/gfs2_tool.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5.2.2&r2=1.5.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/tool/main.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.1&r2=1.4.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/tool/misc.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8.2.2&r2=1.8.2.3

--- cluster/gfs2/man/gfs2_tool.8	2007/07/26 23:20:59	1.3.2.1
+++ cluster/gfs2/man/gfs2_tool.8	2007/10/30 14:08:33	1.3.2.2
@@ -41,6 +41,9 @@
 \fBgettune\fP \fIMountPoint\fR
 Print out the current values of the tuning parameters in a running
 filesystem.
+.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.
--- cluster/gfs2/tool/gfs2_tool.h	2007/10/25 14:14:47	1.5.2.2
+++ cluster/gfs2/tool/gfs2_tool.h	2007/10/30 14:08:33	1.5.2.3
@@ -72,6 +72,7 @@
 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);
--- cluster/gfs2/tool/main.c	2007/10/11 20:32:37	1.4.2.1
+++ cluster/gfs2/tool/main.c	2007/10/30 14:08:33	1.4.2.2
@@ -53,6 +53,9 @@
 	"Get tuneable parameters for a filesystem\n",
 	"  gfs2_tool gettune <mountpoint>\n",
 	"\n",
+	"List the file system's journals:\n",
+	"  gfs2_tool journals <mountpoint>\n",
+	"\n",
 	"List filesystems:\n",
 	"  gfs2_tool list\n",
 	"\n",
@@ -235,6 +238,8 @@
 		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)
--- cluster/gfs2/tool/misc.c	2007/10/25 14:27:54	1.8.2.2
+++ cluster/gfs2/tool/misc.c	2007/10/30 14:08:33	1.8.2.3
@@ -358,6 +358,71 @@
 	
 }
 
+/**
+ * print_journals - print out the file system journal information
+ * @argc:
+ * @argv:
+ *
+ */
+
+void
+print_journals(int argc, char **argv)
+{
+	struct gfs2_sbd sbd;
+	DIR *jindex;
+	struct dirent *journal;
+	char jindex_name[PATH_MAX], jname[PATH_MAX];
+	int jcount;
+	struct stat statbuf;
+
+	memset(&sbd, 0, sizeof(struct gfs2_sbd));
+	sbd.bsize = GFS2_DEFAULT_BSIZE;
+	sbd.rgsize = -1;
+	sbd.jsize = GFS2_DEFAULT_JSIZE;
+	sbd.qcsize = GFS2_DEFAULT_QCSIZE;
+	sbd.md.journals = 1;
+
+	sbd.path_name = argv[optind];
+	sbd.path_fd = open(sbd.path_name, O_RDONLY);
+	if (sbd.path_fd < 0)
+		die("can't open root directory %s: %s\n",
+		    sbd.path_name, strerror(errno));
+	check_for_gfs2(&sbd);
+	sbd.device_fd = open(sbd.device_name, O_RDONLY);
+	if (sbd.device_fd < 0)
+		die("can't open device %s: %s\n",
+		    sbd.device_name, strerror(errno));
+	if (!find_gfs2_meta(&sbd))
+		mount_gfs2_meta(&sbd);
+	lock_for_admin(&sbd);
+
+	sprintf(jindex_name, "%s/jindex", sbd.metafs_path);
+	jindex = opendir(jindex_name);
+	if (!jindex) {
+		die("Can't open %s\n", jindex_name);
+	} else {
+		jcount = 0;
+		while ((journal = readdir(jindex))) {
+			if (journal->d_name[0] == '.')
+				continue;
+			sprintf(jname, "%s/%s", jindex_name, journal->d_name);
+			if (stat(jname, &statbuf)) {
+				statbuf.st_size = 0;
+				perror(jname);
+			}
+			jcount++;
+			printf("%s - %lluMB\n", journal->d_name,
+			       (unsigned long long)statbuf.st_size / 1048576);
+		}
+
+		printf("%d journal(s) found.\n", jcount);
+		closedir(jindex);
+	}
+	cleanup_metafs(&sbd);
+	close(sbd.device_fd);
+	close(sbd.path_fd);
+}
+
 #if GFS2_TOOL_FEATURE_IMPLEMENTED 
 /**
  * print_jindex - print out the journal index



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-10-30 14:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-30 14:08 [Cluster-devel] cluster/gfs2 man/gfs2_tool.8 tool/gfs2_tool.h rpeterso
  -- strict thread matches above, loose matches on Subject: below --
2007-10-30 14:06 rpeterso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.