diff options
author | Benjamin Marzinski <bmarzins@redhat.com> | 2006-08-24 15:47:17 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-08-25 09:57:41 -0400 |
commit | 5dc39fe621ead2fa2a0439a686be4df185861eae (patch) | |
tree | 3ca539e18bae3f45f0e807165998440db0f7a033 | |
parent | a2242db0906445491d9ac50bfa756b0de0a25d45 (diff) |
[GFS2] Fix journal off-by-one error
log_refund() incorrectly assumed that if a transaction had been touched, it
always committed buffers to the incore log. Thus, when you got around to
flushing the log, you would need one more block than you committed, to account
for the header. So it automatically set reserved to 1, which had the effect of
making sdp->sd_log_blks_reserved one greater when you got to gfs2_log_flush().
However, if you don't actually commit anything to the incore log between
flushes, you don't need the header, because you aren't writing anything out.
With this patch, log_refund() only increments reservered to account for the
header if something has been committed since the last flush.
Signed-off-by: Benjamin E. Marzinski <bmarzins@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r-- | fs/gfs2/log.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index a591fb8fae20..af728cb3b327 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c | |||
@@ -509,7 +509,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl) | |||
509 | 509 | ||
510 | static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr) | 510 | static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr) |
511 | { | 511 | { |
512 | unsigned int reserved = 1; | 512 | unsigned int reserved = 0; |
513 | unsigned int old; | 513 | unsigned int old; |
514 | 514 | ||
515 | gfs2_log_lock(sdp); | 515 | gfs2_log_lock(sdp); |
@@ -524,6 +524,8 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr) | |||
524 | if (sdp->sd_log_commited_revoke) | 524 | if (sdp->sd_log_commited_revoke) |
525 | reserved += gfs2_struct2blk(sdp, sdp->sd_log_commited_revoke, | 525 | reserved += gfs2_struct2blk(sdp, sdp->sd_log_commited_revoke, |
526 | sizeof(uint64_t)); | 526 | sizeof(uint64_t)); |
527 | if (reserved) | ||
528 | reserved++; | ||
527 | 529 | ||
528 | old = sdp->sd_log_blks_free; | 530 | old = sdp->sd_log_blks_free; |
529 | sdp->sd_log_blks_free += tr->tr_reserved - | 531 | sdp->sd_log_blks_free += tr->tr_reserved - |