Cluster Project branch, master, updated. cluster-2.99.04-12-ge8ff592

rpeterso@sourceware.org rpeterso@sourceware.org
Wed Jun 11 20:07:00 GMT 2008


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=e8ff592bd08ceb683e9512daaff5732185b82ef9

The branch, master has been updated
       via  e8ff592bd08ceb683e9512daaff5732185b82ef9 (commit)
      from  9258d221c87f833d21ace567993a9e9ffe543969 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e8ff592bd08ceb683e9512daaff5732185b82ef9
Author: Bob Peterson <rpeterso@redhat.com>
Date:   Wed Jun 11 13:55:00 2008 -0500

    Added an optional block-size to mkfs.gfs2

-----------------------------------------------------------------------

Summary of changes:
 gfs2/man/mkfs.gfs2.8  |   11 ++++++++---
 gfs2/mkfs/main_mkfs.c |   29 ++++++++++++++++++++++++-----
 2 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/gfs2/man/mkfs.gfs2.8 b/gfs2/man/mkfs.gfs2.8
index 4bb726c..279c12f 100644
--- a/gfs2/man/mkfs.gfs2.8
+++ b/gfs2/man/mkfs.gfs2.8
@@ -5,7 +5,7 @@ mkfs.gfs2 - Make a GFS2 filesystem
 
 .SH SYNOPSIS
 .B mkfs.gfs2
-[\fIOPTION\fR]... \fIDEVICE\fR
+[\fIOPTION\fR]... \fIDEVICE\fR \fI[ block-count ]\fR 
 
 .SH DESCRIPTION
 mkfs.gfs2 is used to create a Global File System.
@@ -20,7 +20,7 @@ x86_64, s390, s390x), the memory page size is 4096 bytes.  On other
 architectures it may be bigger.  The default block size is 4096 bytes.
 In general, GFS2 filesystems should not deviate from the default value.
 .TP
-\fB-c MegaBytes\fP
+\fB-c\fP \fIMegaBytes\fR
 Initial size of each journal's quota change file
 .TP
 \fB-D\fP
@@ -70,12 +70,17 @@ Fsname is a unique file system name used to distinguish this GFS2 file
 system from others created (1 to 16 characters).  Lock_nolock doesn't
 use this field.
 .TP
-\fB-u MegaBytes\fP
+\fB-u\fP \fIMegaBytes\fR
 Initial size of each journal's unlinked tag file
 .TP
 \fB-V\fP
 Print program version information, then exit.
 
+.TP
+[ \fIblock-count\fR ]
+Make the file system this many blocks in size.  If not specified, the
+entire length of the specified device is used.
+
 .SH EXAMPLE
 .TP
 gfs2_mkfs -t mycluster:mygfs2 -p lock_dlm -j 2 /dev/vg0/mygfs2
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 5563ae4..0e3a19a 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -42,7 +42,7 @@ print_usage(void)
 {
 	printf("Usage:\n");
 	printf("\n");
-	printf("%s [options] <device>\n", prog_name);
+	printf("%s [options] <device> [ block-count ]\n", prog_name);
 	printf("\n");
 	printf("Options:\n");
 	printf("\n");
@@ -77,6 +77,7 @@ decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
 
 	memset(sdp->device_name, 0, sizeof(sdp->device_name));
 	sdp->md.journals = 1;
+	sdp->orig_fssize = 0;
 
 	while (cont) {
 		optchar = getopt(argc, argv, "-b:c:DhJ:j:Op:qr:t:u:VX");
@@ -160,10 +161,13 @@ decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
 		case 1:
 			if (strcmp(optarg, "gfs2") == 0)
 				continue;
-			if (sdp->device_name[0]) {
-				die("More than one device specified (try -h for help)");
-			} 
-			strcpy(sdp->device_name, optarg);
+			if (!sdp->device_name[0])
+				strcpy(sdp->device_name, optarg);
+			else if (!sdp->orig_fssize &&
+				 isdigit(optarg[0]))
+				sdp->orig_fssize = atol(optarg);
+			else
+				die("More than one device specified (try -h for help)\n");
 			break;
 
 		default:
@@ -179,6 +183,9 @@ decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
 		die("no device specified (try -h for help)\n");
 
 	if (optind < argc)
+		sdp->orig_fssize = atol(argv[optind++]);
+
+	if (optind < argc)
 		die("Unrecognized argument: %s\n", argv[optind]);
 
 	if (sdp->debug) {
@@ -197,6 +204,9 @@ decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
 		printf("  table = %s\n", sdp->locktable);
 		printf("  utsize = %u\n", sdp->utsize);
 		printf("  device = %s\n", sdp->device_name);
+		if (sdp->orig_fssize)
+			printf("  block-count = %llu\n",
+			       (unsigned long long)sdp->orig_fssize);
 	}
 }
 
@@ -391,6 +401,15 @@ main_mkfs(int argc, char *argv[])
 	/* Get the device geometry */
 
 	device_geometry(sdp);
+	/* Convert optional block-count to basic blocks */
+	if (sdp->orig_fssize) {
+		sdp->orig_fssize *= sdp->bsize;
+		sdp->orig_fssize >>= GFS2_BASIC_BLOCK_SHIFT;
+		if (sdp->orig_fssize > sdp->device.length)
+			die("specified block count is smaller than the"
+			    "actual device.\n");
+		sdp->device.length = sdp->orig_fssize;
+	}
 	fix_device_geometry(sdp);
 
 	/* Compute the resource group layouts */


hooks/post-receive
--
Cluster Project



More information about the Cluster-cvs mailing list