All of lore.kernel.org
 help / color / mirror / Atom feed
From: rpeterso@sourceware.org <rpeterso@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/gfs2 man/gfs2_tool.8 tool/gfs2_tool.h  ...
Date: 30 Oct 2007 14:06:08 -0000	[thread overview]
Message-ID: <20071030140608.18686.qmail@sourceware.org> (raw)

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



             reply	other threads:[~2007-10-30 14:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-30 14:06 rpeterso [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-10-30 14:08 [Cluster-devel] cluster/gfs2 man/gfs2_tool.8 tool/gfs2_tool.h rpeterso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071030140608.18686.qmail@sourceware.org \
    --to=rpeterso@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.