diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2012-04-03 10:04:22 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2012-04-24 11:44:26 -0400 |
commit | 14e5f1848dcaed611e7dadfaa0d593a4a1b93010 (patch) | |
tree | 645446839468853520277f27b40bbfc5689fc70a /fs | |
parent | fdb76a4228303491b1b9b8923310f2cbcec8dc9f (diff) |
GFS2: Make gfs2_log_fake_buf() write the buffer too
Since we always write the buffer directly after this function
returns, we might as well merge it into here. This is a clean
up in preparation for some further updates to the log code
which are coming soon.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/lops.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index 6b1efb594d90..a5937b3c9913 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c | |||
@@ -208,15 +208,13 @@ static void gfs2_fake_write_endio(struct buffer_head *bh, int uptodate) | |||
208 | } | 208 | } |
209 | 209 | ||
210 | /** | 210 | /** |
211 | * gfs2_log_fake_buf - Build a fake buffer head to write metadata buffer to log | 211 | * gfs2_log_write_buf - write metadata buffer to log |
212 | * @sdp: the filesystem | 212 | * @sdp: the filesystem |
213 | * @data: the data the buffer_head should point to | 213 | * @real: the in-place buffer head |
214 | * | 214 | * |
215 | * Returns: the log buffer descriptor | ||
216 | */ | 215 | */ |
217 | 216 | ||
218 | static struct buffer_head *gfs2_log_fake_buf(struct gfs2_sbd *sdp, | 217 | static void gfs2_log_write_buf(struct gfs2_sbd *sdp, struct buffer_head *real) |
219 | struct buffer_head *real) | ||
220 | { | 218 | { |
221 | u64 blkno = gfs2_log_bmap(sdp, sdp->sd_log_flush_head); | 219 | u64 blkno = gfs2_log_bmap(sdp, sdp->sd_log_flush_head); |
222 | struct buffer_head *bh; | 220 | struct buffer_head *bh; |
@@ -234,7 +232,7 @@ static struct buffer_head *gfs2_log_fake_buf(struct gfs2_sbd *sdp, | |||
234 | gfs2_log_incr_head(sdp); | 232 | gfs2_log_incr_head(sdp); |
235 | atomic_inc(&sdp->sd_log_in_flight); | 233 | atomic_inc(&sdp->sd_log_in_flight); |
236 | 234 | ||
237 | return bh; | 235 | submit_bh(WRITE, bh); |
238 | } | 236 | } |
239 | 237 | ||
240 | static struct buffer_head *gfs2_get_log_desc(struct gfs2_sbd *sdp, u32 ld_type) | 238 | static struct buffer_head *gfs2_get_log_desc(struct gfs2_sbd *sdp, u32 ld_type) |
@@ -321,7 +319,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp) | |||
321 | } | 319 | } |
322 | 320 | ||
323 | gfs2_log_unlock(sdp); | 321 | gfs2_log_unlock(sdp); |
324 | submit_bh(WRITE_SYNC, bh); | 322 | submit_bh(WRITE, bh); |
325 | gfs2_log_lock(sdp); | 323 | gfs2_log_lock(sdp); |
326 | 324 | ||
327 | n = 0; | 325 | n = 0; |
@@ -330,8 +328,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp) | |||
330 | get_bh(bd2->bd_bh); | 328 | get_bh(bd2->bd_bh); |
331 | gfs2_log_unlock(sdp); | 329 | gfs2_log_unlock(sdp); |
332 | lock_buffer(bd2->bd_bh); | 330 | lock_buffer(bd2->bd_bh); |
333 | bh = gfs2_log_fake_buf(sdp, bd2->bd_bh); | 331 | gfs2_log_write_buf(sdp, bd2->bd_bh); |
334 | submit_bh(WRITE_SYNC, bh); | ||
335 | gfs2_log_lock(sdp); | 332 | gfs2_log_lock(sdp); |
336 | if (++n >= num) | 333 | if (++n >= num) |
337 | break; | 334 | break; |
@@ -475,7 +472,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp) | |||
475 | sdp->sd_log_num_revoke--; | 472 | sdp->sd_log_num_revoke--; |
476 | 473 | ||
477 | if (offset + sizeof(u64) > sdp->sd_sb.sb_bsize) { | 474 | if (offset + sizeof(u64) > sdp->sd_sb.sb_bsize) { |
478 | submit_bh(WRITE_SYNC, bh); | 475 | submit_bh(WRITE, bh); |
479 | 476 | ||
480 | bh = gfs2_log_get_buf(sdp); | 477 | bh = gfs2_log_get_buf(sdp); |
481 | mh = (struct gfs2_meta_header *)bh->b_data; | 478 | mh = (struct gfs2_meta_header *)bh->b_data; |
@@ -490,7 +487,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp) | |||
490 | } | 487 | } |
491 | gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke); | 488 | gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke); |
492 | 489 | ||
493 | submit_bh(WRITE_SYNC, bh); | 490 | submit_bh(WRITE, bh); |
494 | } | 491 | } |
495 | 492 | ||
496 | static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai) | 493 | static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai) |
@@ -672,7 +669,7 @@ static void gfs2_write_blocks(struct gfs2_sbd *sdp, struct buffer_head *bh, | |||
672 | ptr = bh_log_ptr(bh); | 669 | ptr = bh_log_ptr(bh); |
673 | 670 | ||
674 | get_bh(bh); | 671 | get_bh(bh); |
675 | submit_bh(WRITE_SYNC, bh); | 672 | submit_bh(WRITE, bh); |
676 | gfs2_log_lock(sdp); | 673 | gfs2_log_lock(sdp); |
677 | while(!list_empty(list)) { | 674 | while(!list_empty(list)) { |
678 | bd = list_entry(list->next, struct gfs2_bufdata, bd_le.le_list); | 675 | bd = list_entry(list->next, struct gfs2_bufdata, bd_le.le_list); |
@@ -695,10 +692,10 @@ static void gfs2_write_blocks(struct gfs2_sbd *sdp, struct buffer_head *bh, | |||
695 | clear_buffer_escaped(bd->bd_bh); | 692 | clear_buffer_escaped(bd->bd_bh); |
696 | unlock_buffer(bd->bd_bh); | 693 | unlock_buffer(bd->bd_bh); |
697 | brelse(bd->bd_bh); | 694 | brelse(bd->bd_bh); |
695 | submit_bh(WRITE, bh1); | ||
698 | } else { | 696 | } else { |
699 | bh1 = gfs2_log_fake_buf(sdp, bd->bd_bh); | 697 | gfs2_log_write_buf(sdp, bd->bd_bh); |
700 | } | 698 | } |
701 | submit_bh(WRITE_SYNC, bh1); | ||
702 | gfs2_log_lock(sdp); | 699 | gfs2_log_lock(sdp); |
703 | ptr += 2; | 700 | ptr += 2; |
704 | } | 701 | } |