This is the mail archive of the
cluster-cvs@sourceware.org
mailing list for the cluster.
cluster: master - 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:56:46 +0000 (UTC)
- Subject: cluster: master - Use jbsize for height computations on journaledfiles.
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=c3d21611f050fc5d35f46c091d5844787ad79db5
Commit: c3d21611f050fc5d35f46c091d5844787ad79db5
Parent: 9e7ba291babc001442443b8f73deb6ece8b394a6
Author: Bob Peterson <rpeterso@redhat.com>
AuthorDate: Tue Dec 9 17:12:57 2008 -0600
Committer: Bob Peterson <rpeterso@redhat.com>
CommitterDate: Wed Dec 10 14:56:47 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 8808e7d..97dd17f 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -1108,11 +1108,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. */
/* -------------------------------------------------------- */
@@ -1120,9 +1121,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 dfdc376..82f74c7 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -630,7 +630,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 644a776..61ea65b 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -23,12 +23,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;
@@ -85,11 +85,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);
}
void