Skip to contentSkip to conversation

libgfs2: Added new RGSIZE macros

PATCH New Carlos Maiolino 2 participants 4 messages Jul 7, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 libgfs2: Added new RGSIZE macros

This patch add new macros related to
default rgsizes which makes the purpose
of the values easier to understand

---
 gfs2/libgfs2/libgfs2.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
gfs2/libgfs2/libgfs2.h +5 -0
index be5bdfa..a0c3eea 100644
@@ -258,6 +258,11 @@ struct metapath {
 #define GFS2_MIN_GROW_SIZE          (10)
 #define GFS2_EXCESSIVE_RGS          (10000)
 
+#define GFS2_EXP_MIN_RGSIZE         (1)
+#define GFS2_DEFAULT_MIN_RGSIZE     (32)
+/* Look at this!  Why can't we go bigger than 2GB? */
+#define GFS2_MAX_RGSIZE             (2048)
+
 #define DATA (1)
 #define META (2)
 #define DINODE (3)
Signature · 1 line
1.7.5.2
#1 lore raw

PATCH 2/2 mkfs: Change hardcoded numbers by new macro definitions

The verify_arguments() function makes use of some hardcoded integers that would best fit as macros.

---
 gfs2/mkfs/main_mkfs.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
gfs2/mkfs/main_mkfs.c +2 -3
index db2309a..c417b29 100644
@@ -332,12 +332,11 @@ static void verify_arguments(struct gfs2_sbd *sdp)
 {
 	if (!sdp->expert)
 		test_locking(sdp->lockproto, sdp->locktable);
-	/* Look at this!  Why can't we go bigger than 2GB? */
 	if (sdp->expert) {
-		if (1 > sdp->rgsize || sdp->rgsize > 2048)
+		if (GFS2_EXP_MIN_RGSIZE > sdp->rgsize || sdp->rgsize > GFS2_MAX_RGSIZE)
 			die( _("bad resource group size\n"));
 	} else {
-		if (32 > sdp->rgsize || sdp->rgsize > 2048)
+		if (GFS2_DEFAULT_MIN_RGSIZE > sdp->rgsize || sdp->rgsize > GFS2_MAX_RGSIZE)
 			die( _("bad resource group size\n"));
 	}
 
Signature · 1 line
1.7.5.2
#2 lore raw

PATCH 2/2 mkfs: Change hardcoded numbers by new macro definitions

Hi,

Quoted 15 lines · Carlos Maiolino

The verify_arguments() function makes use of some hardcoded integers that would best fit as macros.

---
 gfs2/mkfs/main_mkfs.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
gfs2/mkfs/main_mkfs.c +0 -1
index db2309a..c417b29 100644
@@ -332,12 +332,11 @@ static void verify_arguments(struct gfs2_sbd *sdp)
 {
 	if (!sdp->expert)
 		test_locking(sdp->lockproto, sdp->locktable);
-	/* Look at this!  Why can't we go bigger than 2GB? */

gfs2/mkfs/main_mkfs.c static void verify_arguments(struct gfs2_sbd *sdp) · line 342

Quoted 10 lines
gfs2/mkfs/main_mkfs.c +2 -2
 	if (sdp->expert) {
-		if (1 > sdp->rgsize || sdp->rgsize > 2048)
+		if (GFS2_EXP_MIN_RGSIZE > sdp->rgsize || sdp->rgsize > GFS2_MAX_RGSIZE)
 			die( _("bad resource group size\n"));
 	} else {
-		if (32 > sdp->rgsize || sdp->rgsize > 2048)
+		if (GFS2_DEFAULT_MIN_RGSIZE > sdp->rgsize || sdp->rgsize > GFS2_MAX_RGSIZE)
 			die( _("bad resource group size\n"));
 	}
 

I'm not sure that "default min" makes sense. If 32 is the min, lets just call it that otherwise it should just be the default size and not also called the min size,

Steve.

#3 lore raw

PATCH 1/2 libgfs2: Added new RGSIZE macros

In reply to Carlos Maiolino

Hi,

Quoted 13 lines · Carlos Maiolino

This patch add new macros related to
default rgsizes which makes the purpose
of the values easier to understand

---
 gfs2/libgfs2/libgfs2.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
gfs2/libgfs2/libgfs2.h +0 -0
index be5bdfa..a0c3eea 100644
@@ -258,6 +258,11 @@ struct metapath {
 #define GFS2_MIN_GROW_SIZE          (10)

gfs2/libgfs2/libgfs2.h struct metapath { · line 268

Quoted 10 lines
gfs2/libgfs2/libgfs2.h +5 -0
 #define GFS2_EXCESSIVE_RGS          (10000)
 
+#define GFS2_EXP_MIN_RGSIZE         (1)
+#define GFS2_DEFAULT_MIN_RGSIZE     (32)
+/* Look at this!  Why can't we go bigger than 2GB? */
+#define GFS2_MAX_RGSIZE             (2048)
+
 #define DATA (1)
 #define META (2)
 #define DINODE (3)

The limit is due to 32 bit offsets used within the rgrp's data fields, and there shouldn't be a need to go to a greater size than that really since the intent is to divide the disk into a reasonably large number of rgrps to reduce the likelihood of rgrp contention.

Anyway, looks good modulo my comment on the other patch,

Steve.