Skip to content

Commit

Permalink
[GFS2] Tidy up log.c
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Steven Whitehouse committed Sep 13, 2006
1 parent 16feb9f commit faa31ce
Showing 1 changed file with 14 additions and 26 deletions.
40 changes: 14 additions & 26 deletions fs/gfs2/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct,
unsigned int first, second;

blks = 1;
first = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) /
ssize;
first = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) / ssize;

if (nstruct > first) {
second = (sdp->sd_sb.sb_bsize -
Expand Down Expand Up @@ -230,8 +229,7 @@ static u64 log_bmap(struct gfs2_sbd *sdp, unsigned int lbn)
* Returns: the distance in blocks
*/

static inline unsigned int log_distance(struct gfs2_sbd *sdp,
unsigned int newer,
static inline unsigned int log_distance(struct gfs2_sbd *sdp, unsigned int newer,
unsigned int older)
{
int dist;
Expand All @@ -250,11 +248,10 @@ static unsigned int current_tail(struct gfs2_sbd *sdp)

gfs2_log_lock(sdp);

if (list_empty(&sdp->sd_ail1_list))
if (list_empty(&sdp->sd_ail1_list)) {
tail = sdp->sd_log_head;
else {
ai = list_entry(sdp->sd_ail1_list.prev, struct gfs2_ail,
ai_list);
} else {
ai = list_entry(sdp->sd_ail1_list.prev, struct gfs2_ail, ai_list);
tail = ai->ai_first;
}

Expand All @@ -266,8 +263,7 @@ static unsigned int current_tail(struct gfs2_sbd *sdp)
static inline void log_incr_head(struct gfs2_sbd *sdp)
{
if (sdp->sd_log_flush_head == sdp->sd_log_tail)
gfs2_assert_withdraw(sdp,
sdp->sd_log_flush_head == sdp->sd_log_head);
gfs2_assert_withdraw(sdp, sdp->sd_log_flush_head == sdp->sd_log_head);

if (++sdp->sd_log_flush_head == sdp->sd_jdesc->jd_blocks) {
sdp->sd_log_flush_head = 0;
Expand Down Expand Up @@ -343,9 +339,7 @@ static void log_pull_tail(struct gfs2_sbd *sdp, unsigned int new_tail, int pull)

gfs2_log_lock(sdp);
sdp->sd_log_blks_free += dist - (pull ? 1 : 0);
/* printk(KERN_INFO "pull tail refunding %u blocks (%u left) pull=%d\n", dist - (pull ? 1 : 0), sdp->sd_log_blks_free, pull); */
gfs2_assert_withdraw(sdp,
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_log_unlock(sdp);

sdp->sd_log_tail = new_tail;
Expand All @@ -366,8 +360,6 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull)
unsigned int tail;
u32 hash;

/* printk(KERN_INFO "log write header start (flags=%08x, pull=%d)\n", flags, pull); */

bh = sb_getblk(sdp->sd_vfs, blkno);
lock_buffer(bh);
memset(bh->b_data, 0, bh->b_size);
Expand Down Expand Up @@ -402,8 +394,6 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull)

sdp->sd_log_idle = (tail == sdp->sd_log_flush_head);
log_incr_head(sdp);

/* printk(KERN_INFO "log write header out\n"); */
}

static void log_flush_commit(struct gfs2_sbd *sdp)
Expand Down Expand Up @@ -459,8 +449,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
INIT_LIST_HEAD(&ai->ai_ail1_list);
INIT_LIST_HEAD(&ai->ai_ail2_list);

gfs2_assert_withdraw(sdp,
sdp->sd_log_num_buf == sdp->sd_log_commited_buf);
gfs2_assert_withdraw(sdp, sdp->sd_log_num_buf == sdp->sd_log_commited_buf);
gfs2_assert_withdraw(sdp,
sdp->sd_log_num_revoke == sdp->sd_log_commited_revoke);

Expand All @@ -476,13 +465,12 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
lops_after_commit(sdp, ai);
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 =
sdp->sd_log_num_hdrs =
sdp->sd_log_commited_revoke = 0;
sdp->sd_log_blks_reserved = 0;
sdp->sd_log_commited_buf = 0;
sdp->sd_log_num_hdrs = 0;
sdp->sd_log_commited_revoke = 0;

gfs2_log_lock(sdp);
if (!list_empty(&ai->ai_ail1_list)) {
Expand Down Expand Up @@ -551,8 +539,9 @@ void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
if (sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks)) {
gfs2_log_unlock(sdp);
gfs2_log_flush(sdp, NULL);
} else
} else {
gfs2_log_unlock(sdp);
}
}

/**
Expand Down Expand Up @@ -580,7 +569,6 @@ 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_warn(sdp, sdp->sd_log_blks_free == sdp->sd_jdesc->jd_blocks);
gfs2_assert_warn(sdp, sdp->sd_log_head == sdp->sd_log_tail);
gfs2_assert_warn(sdp, list_empty(&sdp->sd_ail2_list));
Expand Down

0 comments on commit faa31ce

Please sign in to comment.