diff options
Diffstat (limited to 'fs')
-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); |