diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2007-06-01 10:19:33 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2007-07-09 03:23:03 -0400 |
commit | 89918647a445fddfe223b097e29f775dcfa81eab (patch) | |
tree | 627b21140ea3b2655c6818c03d3df55157c2a387 /fs/gfs2 | |
parent | 1990e917651d58a3c5155d0491431c09e29e385b (diff) |
[GFS2] Make the log reserved blocks depend on block size
The number of blocks which we reserve in the log at the start of each
transaction needs to depends upon the block size since the overhead is
related to the number of "pointers" which can be fitted into a single
block.
This relates to Red Hat bz #240435
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/log.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 291415ddfe51..586923d24e6e 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c | |||
@@ -262,7 +262,7 @@ static void ail2_empty(struct gfs2_sbd *sdp, unsigned int new_tail) | |||
262 | * @sdp: The GFS2 superblock | 262 | * @sdp: The GFS2 superblock |
263 | * @blks: The number of blocks to reserve | 263 | * @blks: The number of blocks to reserve |
264 | * | 264 | * |
265 | * Note that we never give out the last 6 blocks of the journal. Thats | 265 | * Note that we never give out the last few blocks of the journal. Thats |
266 | * due to the fact that there is are a small number of header blocks | 266 | * due to the fact that there is are a small number of header blocks |
267 | * associated with each log flush. The exact number can't be known until | 267 | * associated with each log flush. The exact number can't be known until |
268 | * flush time, so we ensure that we have just enough free blocks at all | 268 | * flush time, so we ensure that we have just enough free blocks at all |
@@ -274,6 +274,7 @@ static void ail2_empty(struct gfs2_sbd *sdp, unsigned int new_tail) | |||
274 | int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks) | 274 | int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks) |
275 | { | 275 | { |
276 | unsigned int try = 0; | 276 | unsigned int try = 0; |
277 | unsigned reserved_blks = 6 * (4096 / sdp->sd_vfs->s_blocksize); | ||
277 | 278 | ||
278 | if (gfs2_assert_warn(sdp, blks) || | 279 | if (gfs2_assert_warn(sdp, blks) || |
279 | gfs2_assert_warn(sdp, blks <= sdp->sd_jdesc->jd_blocks)) | 280 | gfs2_assert_warn(sdp, blks <= sdp->sd_jdesc->jd_blocks)) |
@@ -281,7 +282,7 @@ int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks) | |||
281 | 282 | ||
282 | mutex_lock(&sdp->sd_log_reserve_mutex); | 283 | mutex_lock(&sdp->sd_log_reserve_mutex); |
283 | gfs2_log_lock(sdp); | 284 | gfs2_log_lock(sdp); |
284 | while(sdp->sd_log_blks_free <= (blks + 6)) { | 285 | while(sdp->sd_log_blks_free <= (blks + reserved_blks)) { |
285 | gfs2_log_unlock(sdp); | 286 | gfs2_log_unlock(sdp); |
286 | gfs2_ail1_empty(sdp, 0); | 287 | gfs2_ail1_empty(sdp, 0); |
287 | gfs2_log_flush(sdp, NULL); | 288 | gfs2_log_flush(sdp, NULL); |