From: rpeterso@sourceware.org <rpeterso@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/gfs2 libgfs2/fs_geometry.c libgfs2/lib ...
Date: 30 Nov 2006 15:25:51 -0000 [thread overview]
Message-ID: <20061130152551.30722.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: rpeterso at 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.
next reply other threads:[~2006-11-30 15:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-30 15:25 rpeterso [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-11-30 15:29 [Cluster-devel] cluster/gfs2 libgfs2/fs_geometry.c libgfs2/lib rpeterso
2006-11-30 15:31 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=20061130152551.30722.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.