summaryrefslogtreecommitdiffstats
path: root/fs/gfs2/log.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-04-11 14:49:06 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-04-11 14:49:06 -0400
commitf4154ea039bbf45c52840b30c68143a2dc28d4b4 (patch)
treefa00645dd60a9140e885be96a4aa9797cf4cfeac /fs/gfs2/log.c
parented3865079b573ef55dc13ab0bfb242ed5ebab4c1 (diff)
[GFS2] Update journal accounting code.
A small update to the journaling code to change the way that the "extra" blocks are accounted for in the journal. These are used at a rate of one per 503 metadata blocks or one per 251 journaled data blocks (or just one if the total number of journaled blocks in the transaction is smaller). Since we are using them at two different rates the old method of accounting for them no longer works and we count them up as required. Since the "per transaction" accounting can't handle this (there is no fixed number of header blocks per transaction) we have to account for it in the general journal code. We now require that each transaction reserves more blocks than it actually needs to take account of the possible extra blocks. Also a final fix to dir.c to ensure that all ref counts are handled correctly. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/log.c')
-rw-r--r--fs/gfs2/log.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 0b26d6a7411..b0dd0b9ad79 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -412,11 +412,13 @@ static void log_flush_commit(struct gfs2_sbd *sdp)
struct list_head *head = &sdp->sd_log_flush_list;
struct gfs2_log_buf *lb;
struct buffer_head *bh;
+#if 0
unsigned int d;
d = log_distance(sdp, sdp->sd_log_flush_head, sdp->sd_log_head);
gfs2_assert_withdraw(sdp, d + 1 == sdp->sd_log_blks_reserved);
+#endif
while (!list_empty(head)) {
lb = list_entry(head->next, struct gfs2_log_buf, lb_list);
@@ -483,6 +485,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
sdp->sd_log_head = sdp->sd_log_flush_head;
/* printk(KERN_INFO "sd_log_num_hdrs %u\n", sdp->sd_log_num_hdrs); */
+ sdp->sd_log_blks_free -= sdp->sd_log_num_hdrs;
sdp->sd_log_blks_reserved =
sdp->sd_log_commited_buf =
@@ -515,8 +518,7 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
gfs2_assert_withdraw(sdp, ((int)sdp->sd_log_commited_revoke) >= 0);
if (sdp->sd_log_commited_buf)
- reserved += 1 + sdp->sd_log_commited_buf +
- sdp->sd_log_commited_buf/503;
+ reserved += sdp->sd_log_commited_buf;
if (sdp->sd_log_commited_revoke)
reserved += gfs2_struct2blk(sdp, sdp->sd_log_commited_revoke,
sizeof(uint64_t));
@@ -527,7 +529,8 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
gfs2_assert_withdraw(sdp, sdp->sd_log_blks_free >= old);
gfs2_assert_withdraw(sdp,
- sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks);
+ sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks +
+ sdp->sd_log_num_hdrs);
sdp->sd_log_blks_reserved = reserved;
@@ -582,6 +585,7 @@ void gfs2_log_shutdown(struct gfs2_sbd *sdp)
log_write_header(sdp, GFS2_LOG_HEAD_UNMOUNT, 0);
+ /* printk(KERN_INFO "sd_log_blks_free %u, sd_jdesc->jd_blocks %u\n", sdp->sd_log_blks_free, sdp->sd_jdesc->jd_blocks); */
gfs2_assert_withdraw(sdp, sdp->sd_log_blks_free ==
sdp->sd_jdesc->jd_blocks);
gfs2_assert_withdraw(sdp, sdp->sd_log_head == sdp->sd_log_tail);