Skip to contentSkip to conversation

cluster/gfs gfs_mkfs/fs_geometry.c gfs_mkfs/ma ...

Cluster-devel [email protected] 1 participant 1 message Nov 29, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL50
Changes by: rpeterso at sourceware.org 2006-11-29 18:28:15

Modified files:
gfs/gfs_mkfs : fs_geometry.c main.c mkfs_gfs.h
gfs/man : gfs_mkfs.8

Log message:
Resolves: bz213763: mkdir takes more time on larger file systems. Made gfs_mkfs use RG sizes based on size of file system to maximize performance.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/gfs_mkfs/fs_geometry.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.3&r2=1.3.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/gfs_mkfs/main.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.5&r2=1.5.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/gfs_mkfs/mkfs_gfs.h.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.4&r2=1.4.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/man/gfs_mkfs.8.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.3&r2=1.3.4.1

gfs/gfs_mkfs/fs_geometry.c +17 -7
@@ -42,13 +42,23 @@
 	uint64 nrgrp;
 	unsigned int min = (comline->expert) ? 1 : 4;
 
-	nrgrp = DIV_RU(sdev->length, (comline->rgsize << 20) / comline->bsize);
+	while (TRUE) {
+		nrgrp = DIV_RU(sdev->length, (comline->rgsize << 20) / comline->bsize);
 
-	if (nrgrp < min)
-		nrgrp = min;
+		if (nrgrp < min)
+			nrgrp = min;
+
+		if (comline->rgsize_specified || /* If user specified an rg size or */
+			nrgrp <= MKFS_EXCESSIVE_RGS || /* not an excessive # of rgs or  */
+			comline->rgsize >= 2048)     /* we've reached the max rg size */
+			break;
+
+		comline->rgsize += MKFS_DEFAULT_RGSIZE; /* Try again w/bigger rgs */
+	}
 
 	if (comline->debug)
-		printf("  nrgrp = %"PRIu64"\n", nrgrp);
+		printf("  rg sz = %"PRIu32"\n  nrgrp = %"PRIu64"\n", comline->rgsize,
+			   nrgrp);
 
 	return nrgrp;
 }
@@ -118,9 +128,9 @@
 
 		for (tmp = rlist->next; tmp != rlist; tmp = tmp->next) {
 			rl = osi_list_entry(tmp, rgrp_list_t, list);
-			printf("subdevice %u:  rg_o = %"PRIu64", rg_l = %"PRIu64"\n",
-				   rl->subdevice,
-				   rl->rg_offset, rl->rg_length);
+			printf("subdevice %u:  rg_o = %"PRIu64", rg_l = %"PRIu64" blocks (%"PRIu64"MB)\n",
+				   rl->subdevice, rl->rg_offset, rl->rg_length, 
+				   rl->rg_length * comline->bsize / (1024 * 1024));
 		}
 	}
 }
gfs/gfs_mkfs/main.c +2 -1
@@ -82,7 +82,6 @@
   int cont = TRUE;
   int optchar;
 
-
   while (cont)
   {
     optchar = getopt(argc, argv, OPTION_STRING);
@@ -133,6 +132,7 @@
 
 
     case 'r':
+      comline->rgsize_specified = TRUE;
       comline->rgsize = atoi(optarg);
       break;
 
@@ -303,6 +303,7 @@
 	comline.seg_size = MKFS_DEFAULT_SEG_SIZE;
 	comline.jsize = MKFS_DEFAULT_JSIZE;
 	comline.rgsize = MKFS_DEFAULT_RGSIZE;
+	comline.rgsize_specified = FALSE;
 
 	decode_arguments(argc, argv, &comline);
 
gfs/gfs_mkfs/mkfs_gfs.h +2 -1
@@ -102,6 +102,7 @@
   uint32 journals;          /*  Number of journals  */
   uint32 jsize;             /*  Size of journals  */
   uint32 rgsize;            /*  The Resource Group size  */
+  int rgsize_specified;     /*  Did the user specify a rg size? */
 
   int debug;                /*  Print out debugging information?  */
   int quiet;                /*  No messages  */
@@ -156,7 +157,7 @@
 #define MKFS_DEFAULT_SEG_SIZE       (16)
 #define MKFS_DEFAULT_JSIZE          (128)
 #define MKFS_DEFAULT_RGSIZE         (256)
-
+#define MKFS_EXCESSIVE_RGS          (10000)
 
 /*  device_geometry.c  */
 
gfs/man/gfs_mkfs.8 +6 -2
@@ -52,8 +52,12 @@
 Be quiet.  Don't print anything.
 .TP
 \fB-r\fP \fIMegaBytes\fR
-gfs_mkfs will try to make Resource Groups about this big.
-The default is 256 MB.
+gfs_mkfs will try to make Resource Groups (RGs) about this big.
+Minimum RG size is 32 MB.  Maximum RG size is 2048 MB.
+A large RG size may increase performance on very large file systems.
+If not specified, gfs_mkfs will choose the RG size based on the size
+of the file system: average size file systems will have 256 MB RGs, and
+bigger file systems will have bigger RGs for better performance.
 .TP
 \fB-s\fP \fIBlocks\fR 
 Journal segment size in filesystem blocks.  This value must be at