This is the mail archive of the
cluster-cvs@sourceware.org
mailing list for the cluster.
cluster: RHEL5 - Use jbsize for height computations on journaledfiles.
- From: Bob Peterson <rpeterso at fedoraproject dot org>
- To: cluster-cvs-relay at redhat dot com
- Date: Wed, 10 Dec 2008 20:22:28 +0000 (UTC)
- Subject: cluster: RHEL5 - Use jbsize for height computations on journaledfiles.
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=39a10f3b9c63af72403375b04e60ebb00fccec90
Commit: 39a10f3b9c63af72403375b04e60ebb00fccec90
Parent: 4d517eabff06b1e9aa4bc4160791eab83acb95e3
Author: Bob Peterson <rpeterso@redhat.com>
AuthorDate: Tue Dec 9 17:12:57 2008 -0600
Committer: Bob Peterson <rpeterso@redhat.com>
CommitterDate: Tue Dec 9 17:12:57 2008 -0600
Use jbsize for height computations on journaled files.
bz 475488
This is an addendum patch for bug #471618.
Without this patch, users may encounter an infinite loop
in mkfs.gfs2 if the number of journals causes the block
size to be exceeded for the per_inode system directory.
For a block size of 1K, specifying five journals on
mkfs.gfs2 will cause this problem. For a default 4K block
size, you would likely need 17 journals to get the hang.
---
gfs2/convert/gfs2_convert.c | 9 ++++++---
gfs2/libgfs2/libgfs2.h | 2 +-
gfs2/libgfs2/misc.c | 11 ++++++-----
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 2dbe2ba..1bd4351 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -1114,11 +1114,12 @@ static int init(struct gfs2_sbd *sbp)
sbp->sd_jbsize = sbp->bsize - sizeof(struct gfs2_meta_header);
brelse(bh, not_updated);
sbp->sd_max_height = compute_heightsize(sbp, sbp->sd_heightsize,
- sbp->sd_diptrs,
+ sbp->bsize, sbp->sd_diptrs,
sbp->sd_inptrs);
sbp->sd_max_jheight = compute_heightsize(sbp, sbp->sd_jheightsize,
- sbp->sd_diptrs,
- sbp->sd_inptrs);
+ sbp->sd_jbsize,
+ sbp->sd_diptrs,
+ sbp->sd_inptrs);
/* -------------------------------------------------------- */
/* Our constants are for gfs1. Need some for gfs2 as well. */
/* -------------------------------------------------------- */
@@ -1126,9 +1127,11 @@ static int init(struct gfs2_sbd *sbp)
sizeof(uint64_t); /* How many ptrs can we fit on a block? */
memset(gfs2_heightsize, 0, sizeof(gfs2_heightsize));
gfs2_max_height = compute_heightsize(sbp, gfs2_heightsize,
+ sbp->bsize,
sbp->sd_diptrs, gfs2_inptrs);
memset(gfs2_jheightsize, 0, sizeof(gfs2_jheightsize));
gfs2_max_jheight = compute_heightsize(sbp, gfs2_jheightsize,
+ sbp->sd_jbsize,
sbp->sd_diptrs, gfs2_inptrs);
/* ---------------------------------------------- */
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index a18e49b..853c969 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -647,7 +647,7 @@ int gfs2_query(int *setonabort, struct gfs2_options *opts,
#define SYS_BASE "/sys/fs/gfs2"
uint32_t compute_heightsize(struct gfs2_sbd *sdp, uint64_t *heightsize,
- int diptrs, int inptrs);
+ uint32_t bsize1, int diptrs, int inptrs);
void compute_constants(struct gfs2_sbd *sdp);
int find_gfs2_meta(struct gfs2_sbd *sdp);
int dir_exists(const char *dir);
diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index 4c7cc5b..1bdbc0f 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -35,12 +35,12 @@
static char sysfs_buf[PAGE_SIZE];
uint32_t compute_heightsize(struct gfs2_sbd *sdp, uint64_t *heightsize,
- int diptrs, int inptrs)
+ uint32_t bsize1, int diptrs, int inptrs)
{
int x;
heightsize[0] = sdp->bsize - sizeof(struct gfs2_dinode);
- heightsize[1] = sdp->bsize * diptrs;
+ heightsize[1] = bsize1 * diptrs;
for (x = 2;; x++) {
uint64_t space, d;
uint32_t m;
@@ -97,11 +97,12 @@ compute_constants(struct gfs2_sbd *sdp)
sdp->sd_max_dirres = hash_blocks + ind_blocks + leaf_blocks;
sdp->sd_max_height = compute_heightsize(sdp, sdp->sd_heightsize,
- sdp->sd_diptrs,
+ sdp->bsize, sdp->sd_diptrs,
sdp->sd_inptrs);
sdp->sd_max_jheight = compute_heightsize(sdp, sdp->sd_jheightsize,
- sdp->sd_diptrs,
- sdp->sd_inptrs);
+ sdp->sd_jbsize,
+ sdp->sd_diptrs,
+ sdp->sd_inptrs);
}
int