[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/gfs2 libgfs2/fs_geometry.c libgfs2/lib ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	rpeterso sourceware org	2006-11-30 15:25:49

Modified files:
	gfs2/libgfs2   : fs_geometry.c libgfs2.h 
	gfs2/mkfs      : main_mkfs.c 
	gfs2/man       : mkfs.gfs2.8 

Log message:
	Resolves: bz217798: Need to port Resource Group optimization from
	gfs1 to gfs2

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/libgfs2/fs_geometry.c.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/libgfs2/libgfs2.h.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mkfs/main_mkfs.c.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/man/mkfs.gfs2.8.diff?cvsroot=cluster&r1=1.2&r2=1.3

--- cluster/gfs2/libgfs2/fs_geometry.c	2006/06/06 14:20:41	1.2
+++ cluster/gfs2/libgfs2/fs_geometry.c	2006/11/30 15:25:49	1.3
@@ -34,13 +34,25 @@
  */
 
 static uint64_t
-how_many_rgrps(struct gfs2_sbd *sdp, struct subdevice *sdev)
+how_many_rgrps(struct gfs2_sbd *sdp, struct subdevice *sdev,
+			   int rgsize_specified)
 {
-	uint64_t nrgrp = DIV_RU(sdev->length,
-				(sdp->rgsize << 20) / sdp->bsize);
+	uint64_t nrgrp;
+
+	while (TRUE) {
+		nrgrp = DIV_RU(sdev->length, (sdp->rgsize << 20) / sdp->bsize);
+
+		if (rgsize_specified || /* If user specified an rg size or */
+			nrgrp <= GFS2_EXCESSIVE_RGS || /* not an excessive # of rgs or  */
+			sdp->rgsize >= 2048)     /* we've reached the max rg size */
+			break;
+
+		sdp->rgsize += GFS2_DEFAULT_RGSIZE; /* Try again w/bigger rgs */
+	}
 
 	if (sdp->debug)
-		printf("  nrgrp = %"PRIu64"\n", nrgrp);
+		printf("  rg sz = %"PRIu32"\n  nrgrp = %"PRIu64"\n", sdp->rgsize,
+			   nrgrp);
 
 	return nrgrp;
 }
@@ -53,14 +65,16 @@
  */
 
 void
-compute_rgrp_layout(struct gfs2_sbd *sdp, int new_fs)
+compute_rgrp_layout(struct gfs2_sbd *sdp, int rgsize_specified)
 {
 	struct subdevice *sdev;
 	struct rgrp_list *rl, *rlast = NULL;
 	osi_list_t *tmp, *head = &sdp->rglist;
 	uint64_t rgrp, nrgrp;
 	unsigned int x;
+	int new_fs;
 
+	new_fs = TRUE;
 	for (x = 0; x < sdp->device.nsubdev; x++) {
 		sdev = sdp->device.subdev + x;
 
@@ -74,7 +88,7 @@
 		if (sdp->debug)
 			printf("\nData Subdevice %u\n", x);
 
-		nrgrp = how_many_rgrps(sdp, sdev);
+		nrgrp = how_many_rgrps(sdp, sdev, rgsize_specified);
 
 		for (rgrp = 0; rgrp < nrgrp; rgrp++) {
 			zalloc(rl, sizeof(struct rgrp_list));
--- cluster/gfs2/libgfs2/libgfs2.h	2006/09/20 15:23:34	1.7
+++ cluster/gfs2/libgfs2/libgfs2.h	2006/11/30 15:25:49	1.8
@@ -237,6 +237,7 @@
 #define GFS2_DEFAULT_UTSIZE         (1)
 #define GFS2_DEFAULT_QCSIZE         (1)
 #define GFS2_MIN_GROW_SIZE          (10)
+#define GFS2_EXCESSIVE_RGS          (10000)
 
 #define DATA (1)
 #define META (2)
@@ -373,7 +374,7 @@
 int gfs2_set_bitmap(struct gfs2_sbd *sdp, uint64_t blkno, int state);
 
 /* fs_geometry.c */
-void compute_rgrp_layout(struct gfs2_sbd *sdp, int new_fs);
+void compute_rgrp_layout(struct gfs2_sbd *sdp, int rgsize_specified);
 void build_rgrps(struct gfs2_sbd *sdp);
 
 /* fs_ops.c */
--- cluster/gfs2/mkfs/main_mkfs.c	2006/11/28 18:35:28	1.9
+++ cluster/gfs2/mkfs/main_mkfs.c	2006/11/30 15:25:49	1.10
@@ -197,7 +197,10 @@
 		printf("  override = %d\n", sdp->override);
 		printf("  proto = %s\n", sdp->lockproto);
 		printf("  quiet = %d\n", sdp->quiet);
-		printf("  rgsize = %u\n", sdp->rgsize);
+		if (sdp->rgsize==-1)
+			printf("  rgsize = optimize for best performance\n");
+		else
+			printf("  rgsize = %u\n", sdp->rgsize);
 		printf("  table = %s\n", sdp->locktable);
 		printf("  utsize = %u\n", sdp->utsize);
 		printf("  device = %s\n", sdp->device_name);
@@ -327,11 +330,12 @@
 	struct gfs2_sbd sbd, *sdp = &sbd;
 	unsigned int x;
 	int error;
+	int rgsize_specified = 0;
 
 	memset(sdp, 0, sizeof(struct gfs2_sbd));
 	sdp->bsize = GFS2_DEFAULT_BSIZE;
 	sdp->jsize = GFS2_DEFAULT_JSIZE;
-	sdp->rgsize = GFS2_DEFAULT_RGSIZE;
+	sdp->rgsize = -1;
 	sdp->utsize = GFS2_DEFAULT_UTSIZE;
 	sdp->qcsize = GFS2_DEFAULT_QCSIZE;
 	sdp->time = time(NULL);
@@ -341,6 +345,11 @@
 		osi_list_init(&sdp->buf_hash[x]);
 
 	decode_arguments(argc, argv, sdp);
+	if (sdp->rgsize == -1)                 /* if rg size not specified */
+		sdp->rgsize = GFS2_DEFAULT_RGSIZE; /* default it for now */
+	else
+		rgsize_specified = TRUE;
+
 	verify_arguments(sdp);
 
 	sdp->device_fd = open(sdp->device_name, O_RDWR);
@@ -360,7 +369,7 @@
 
 	/* Compute the resource group layouts */
 
-	compute_rgrp_layout(sdp, TRUE);
+	compute_rgrp_layout(sdp, rgsize_specified);
 
 	/* Build ondisk structures */
 
--- cluster/gfs2/man/mkfs.gfs2.8	2006/11/28 18:35:28	1.2
+++ cluster/gfs2/man/mkfs.gfs2.8	2006/11/30 15:25:49	1.3
@@ -48,7 +48,11 @@
 .TP
 \fB-r\fP \fIMegaBytes\fR
 gfs2_mkfs will try to make Resource Groups about this big.
-The default is 256 MB.
+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, mkfs.gfs2 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-t\fP \fILockTableName\fR 
 The lock table field appropriate to the lock module you're using.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]