diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-09-13 11:13:27 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-09-13 11:13:27 -0400 |
commit | faa31ce85f626dff30ba865684bd1f0ad97a9ca0 (patch) | |
tree | 24e2573df5da036c832972fecc227e2628941aac | |
parent | 16feb9fec0e1f74339bd6992130ceedb3aa9567e (diff) |
[GFS2] Tidy up log.c
Based upon previous feedback from lkml and also removing some
commented out debugging which is no longer needed.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r-- | fs/gfs2/log.c | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 8fce592f4011..50f88059c3d5 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c | |||
@@ -47,8 +47,7 @@ unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct, | |||
47 | unsigned int first, second; | 47 | unsigned int first, second; |
48 | 48 | ||
49 | blks = 1; | 49 | blks = 1; |
50 | first = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) / | 50 | first = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) / ssize; |
51 | ssize; | ||
52 | 51 | ||
53 | if (nstruct > first) { | 52 | if (nstruct > first) { |
54 | second = (sdp->sd_sb.sb_bsize - | 53 | second = (sdp->sd_sb.sb_bsize - |
@@ -230,8 +229,7 @@ static u64 log_bmap(struct gfs2_sbd *sdp, unsigned int lbn) | |||
230 | * Returns: the distance in blocks | 229 | * Returns: the distance in blocks |
231 | */ | 230 | */ |
232 | 231 | ||
233 | static inline unsigned int log_distance(struct gfs2_sbd *sdp, | 232 | static inline unsigned int log_distance(struct gfs2_sbd *sdp, unsigned int newer, |
234 | unsigned int newer, | ||
235 | unsigned int older) | 233 | unsigned int older) |
236 | { | 234 | { |
237 | int dist; | 235 | int dist; |
@@ -250,11 +248,10 @@ static unsigned int current_tail(struct gfs2_sbd *sdp) | |||
250 | 248 | ||
251 | gfs2_log_lock(sdp); | 249 | gfs2_log_lock(sdp); |
252 | 250 | ||
253 | if (list_empty(&sdp->sd_ail1_list)) | 251 | if (list_empty(&sdp->sd_ail1_list)) { |
254 | tail = sdp->sd_log_head; | 252 | tail = sdp->sd_log_head; |
255 | else { | 253 | } else { |
256 | ai = list_entry(sdp->sd_ail1_list.prev, struct gfs2_ail, | 254 | ai = list_entry(sdp->sd_ail1_list.prev, struct gfs2_ail, ai_list); |
257 | ai_list); | ||
258 | tail = ai->ai_first; | 255 | tail = ai->ai_first; |
259 | } | 256 | } |
260 | 257 | ||
@@ -266,8 +263,7 @@ static unsigned int current_tail(struct gfs2_sbd *sdp) | |||
266 | static inline void log_incr_head(struct gfs2_sbd *sdp) | 263 | static inline void log_incr_head(struct gfs2_sbd *sdp) |
267 | { | 264 | { |
268 | if (sdp->sd_log_flush_head == sdp->sd_log_tail) | 265 | if (sdp->sd_log_flush_head == sdp->sd_log_tail) |
269 | gfs2_assert_withdraw(sdp, | 266 | gfs2_assert_withdraw(sdp, sdp->sd_log_flush_head == sdp->sd_log_head); |
270 | sdp->sd_log_flush_head == sdp->sd_log_head); | ||
271 | 267 | ||
272 | if (++sdp->sd_log_flush_head == sdp->sd_jdesc->jd_blocks) { | 268 | if (++sdp->sd_log_flush_head == sdp->sd_jdesc->jd_blocks) { |
273 | sdp->sd_log_flush_head = 0; | 269 | sdp->sd_log_flush_head = 0; |
@@ -343,9 +339,7 @@ static void log_pull_tail(struct gfs2_sbd *sdp, unsigned int new_tail, int pull) | |||
343 | 339 | ||
344 | gfs2_log_lock(sdp); | 340 | gfs2_log_lock(sdp); |
345 | sdp->sd_log_blks_free += dist - (pull ? 1 : 0); | 341 | sdp->sd_log_blks_free += dist - (pull ? 1 : 0); |
346 | /* printk(KERN_INFO "pull tail refunding %u blocks (%u left) pull=%d\n", dist - (pull ? 1 : 0), sdp->sd_log_blks_free, pull); */ | 342 | gfs2_assert_withdraw(sdp, sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks); |
347 | gfs2_assert_withdraw(sdp, | ||
348 | sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks); | ||
349 | gfs2_log_unlock(sdp); | 343 | gfs2_log_unlock(sdp); |
350 | 344 | ||
351 | sdp->sd_log_tail = new_tail; | 345 | sdp->sd_log_tail = new_tail; |
@@ -366,8 +360,6 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull) | |||
366 | unsigned int tail; | 360 | unsigned int tail; |
367 | u32 hash; | 361 | u32 hash; |
368 | 362 | ||
369 | /* printk(KERN_INFO "log write header start (flags=%08x, pull=%d)\n", flags, pull); */ | ||
370 | |||
371 | bh = sb_getblk(sdp->sd_vfs, blkno); | 363 | bh = sb_getblk(sdp->sd_vfs, blkno); |
372 | lock_buffer(bh); | 364 | lock_buffer(bh); |
373 | memset(bh->b_data, 0, bh->b_size); | 365 | memset(bh->b_data, 0, bh->b_size); |
@@ -402,8 +394,6 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull) | |||
402 | 394 | ||
403 | sdp->sd_log_idle = (tail == sdp->sd_log_flush_head); | 395 | sdp->sd_log_idle = (tail == sdp->sd_log_flush_head); |
404 | log_incr_head(sdp); | 396 | log_incr_head(sdp); |
405 | |||
406 | /* printk(KERN_INFO "log write header out\n"); */ | ||
407 | } | 397 | } |
408 | 398 | ||
409 | static void log_flush_commit(struct gfs2_sbd *sdp) | 399 | static void log_flush_commit(struct gfs2_sbd *sdp) |
@@ -459,8 +449,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl) | |||
459 | INIT_LIST_HEAD(&ai->ai_ail1_list); | 449 | INIT_LIST_HEAD(&ai->ai_ail1_list); |
460 | INIT_LIST_HEAD(&ai->ai_ail2_list); | 450 | INIT_LIST_HEAD(&ai->ai_ail2_list); |
461 | 451 | ||
462 | gfs2_assert_withdraw(sdp, | 452 | gfs2_assert_withdraw(sdp, sdp->sd_log_num_buf == sdp->sd_log_commited_buf); |
463 | sdp->sd_log_num_buf == sdp->sd_log_commited_buf); | ||
464 | gfs2_assert_withdraw(sdp, | 453 | gfs2_assert_withdraw(sdp, |
465 | sdp->sd_log_num_revoke == sdp->sd_log_commited_revoke); | 454 | sdp->sd_log_num_revoke == sdp->sd_log_commited_revoke); |
466 | 455 | ||
@@ -476,13 +465,12 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl) | |||
476 | lops_after_commit(sdp, ai); | 465 | lops_after_commit(sdp, ai); |
477 | sdp->sd_log_head = sdp->sd_log_flush_head; | 466 | sdp->sd_log_head = sdp->sd_log_flush_head; |
478 | 467 | ||
479 | /* printk(KERN_INFO "sd_log_num_hdrs %u\n", sdp->sd_log_num_hdrs); */ | ||
480 | sdp->sd_log_blks_free -= sdp->sd_log_num_hdrs; | 468 | sdp->sd_log_blks_free -= sdp->sd_log_num_hdrs; |
481 | 469 | ||
482 | sdp->sd_log_blks_reserved = | 470 | sdp->sd_log_blks_reserved = 0; |
483 | sdp->sd_log_commited_buf = | 471 | sdp->sd_log_commited_buf = 0; |
484 | sdp->sd_log_num_hdrs = | 472 | sdp->sd_log_num_hdrs = 0; |
485 | sdp->sd_log_commited_revoke = 0; | 473 | sdp->sd_log_commited_revoke = 0; |
486 | 474 | ||
487 | gfs2_log_lock(sdp); | 475 | gfs2_log_lock(sdp); |
488 | if (!list_empty(&ai->ai_ail1_list)) { | 476 | if (!list_empty(&ai->ai_ail1_list)) { |
@@ -551,8 +539,9 @@ void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr) | |||
551 | if (sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks)) { | 539 | if (sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks)) { |
552 | gfs2_log_unlock(sdp); | 540 | gfs2_log_unlock(sdp); |
553 | gfs2_log_flush(sdp, NULL); | 541 | gfs2_log_flush(sdp, NULL); |
554 | } else | 542 | } else { |
555 | gfs2_log_unlock(sdp); | 543 | gfs2_log_unlock(sdp); |
544 | } | ||
556 | } | 545 | } |
557 | 546 | ||
558 | /** | 547 | /** |
@@ -580,7 +569,6 @@ void gfs2_log_shutdown(struct gfs2_sbd *sdp) | |||
580 | 569 | ||
581 | log_write_header(sdp, GFS2_LOG_HEAD_UNMOUNT, 0); | 570 | log_write_header(sdp, GFS2_LOG_HEAD_UNMOUNT, 0); |
582 | 571 | ||
583 | /* printk(KERN_INFO "sd_log_blks_free %u, sd_jdesc->jd_blocks %u\n", sdp->sd_log_blks_free, sdp->sd_jdesc->jd_blocks); */ | ||
584 | gfs2_assert_warn(sdp, sdp->sd_log_blks_free == sdp->sd_jdesc->jd_blocks); | 572 | gfs2_assert_warn(sdp, sdp->sd_log_blks_free == sdp->sd_jdesc->jd_blocks); |
585 | gfs2_assert_warn(sdp, sdp->sd_log_head == sdp->sd_log_tail); | 573 | gfs2_assert_warn(sdp, sdp->sd_log_head == sdp->sd_log_tail); |
586 | gfs2_assert_warn(sdp, list_empty(&sdp->sd_ail2_list)); | 574 | gfs2_assert_warn(sdp, list_empty(&sdp->sd_ail2_list)); |