aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/lops.c
diff options
context:
space:
mode:
authorBenjamin Marzinski <bmarzins@redhat.com>2013-04-05 21:31:46 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2013-04-08 03:46:22 -0400
commit16ca9412d8018188bddda29c3fee88471b94e3cb (patch)
tree4fdd7fdd2ab7ea216e5120c5f484a24bcea01d83 /fs/gfs2/lops.c
parent20095218fb882139527c0e04b8e63869fa057b14 (diff)
GFS2: replace gfs2_ail structure with gfs2_trans
In order to allow transactions and log flushes to happen at the same time, gfs2 needs to move the transaction accounting and active items list code into the gfs2_trans structure. As a first step toward this, this patch removes the gfs2_ail structure, and handles the active items list in the gfs_trans structure. This keeps gfs2 from allocating an ail structure on log flushes, and gives us a struture that can later be used to store the transaction accounting outside of the gfs2 superblock structure. With this patch, at the end of a transaction, gfs2 will add the gfs2_trans structure to the superblock if there is not one already. This structure now has the active items fields that were previously in gfs2_ail. This is not necessary in the case where the transaction was simply used to add revokes, since these are never written outside of the journal, and thus, don't need an active items list. Also, in order to make sure that the transaction structure is not removed while it's still in use by gfs2_trans_end, unlocking the sd_log_flush_lock has to happen slightly later in ending the transaction. Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/lops.c')
-rw-r--r--fs/gfs2/lops.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index a5055977a214..7318abf9d0fb 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -53,8 +53,8 @@ void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh)
53 * to in-place disk block, remove it from the AIL. 53 * to in-place disk block, remove it from the AIL.
54 */ 54 */
55 spin_lock(&sdp->sd_ail_lock); 55 spin_lock(&sdp->sd_ail_lock);
56 if (bd->bd_ail) 56 if (bd->bd_tr)
57 list_move(&bd->bd_ail_st_list, &bd->bd_ail->ai_ail2_list); 57 list_move(&bd->bd_ail_st_list, &bd->bd_tr->tr_ail2_list);
58 spin_unlock(&sdp->sd_ail_lock); 58 spin_unlock(&sdp->sd_ail_lock);
59 get_bh(bh); 59 get_bh(bh);
60 atomic_inc(&sdp->sd_log_pinned); 60 atomic_inc(&sdp->sd_log_pinned);
@@ -94,7 +94,7 @@ static void maybe_release_space(struct gfs2_bufdata *bd)
94 */ 94 */
95 95
96static void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh, 96static void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh,
97 struct gfs2_ail *ai) 97 struct gfs2_trans *tr)
98{ 98{
99 struct gfs2_bufdata *bd = bh->b_private; 99 struct gfs2_bufdata *bd = bh->b_private;
100 100
@@ -109,7 +109,7 @@ static void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh,
109 maybe_release_space(bd); 109 maybe_release_space(bd);
110 110
111 spin_lock(&sdp->sd_ail_lock); 111 spin_lock(&sdp->sd_ail_lock);
112 if (bd->bd_ail) { 112 if (bd->bd_tr) {
113 list_del(&bd->bd_ail_st_list); 113 list_del(&bd->bd_ail_st_list);
114 brelse(bh); 114 brelse(bh);
115 } else { 115 } else {
@@ -117,8 +117,8 @@ static void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh,
117 list_add(&bd->bd_ail_gl_list, &gl->gl_ail_list); 117 list_add(&bd->bd_ail_gl_list, &gl->gl_ail_list);
118 atomic_inc(&gl->gl_ail_count); 118 atomic_inc(&gl->gl_ail_count);
119 } 119 }
120 bd->bd_ail = ai; 120 bd->bd_tr = tr;
121 list_add(&bd->bd_ail_st_list, &ai->ai_ail1_list); 121 list_add(&bd->bd_ail_st_list, &tr->tr_ail1_list);
122 spin_unlock(&sdp->sd_ail_lock); 122 spin_unlock(&sdp->sd_ail_lock);
123 123
124 clear_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags); 124 clear_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags);
@@ -480,17 +480,22 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp)
480 &sdp->sd_log_le_buf, 0); 480 &sdp->sd_log_le_buf, 0);
481} 481}
482 482
483static void buf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai) 483static void buf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
484{ 484{
485 struct list_head *head = &sdp->sd_log_le_buf; 485 struct list_head *head = &sdp->sd_log_le_buf;
486 struct gfs2_bufdata *bd; 486 struct gfs2_bufdata *bd;
487 487
488 if (tr == NULL) {
489 gfs2_assert(sdp, list_empty(head));
490 return;
491 }
492
488 while (!list_empty(head)) { 493 while (!list_empty(head)) {
489 bd = list_entry(head->next, struct gfs2_bufdata, bd_list); 494 bd = list_entry(head->next, struct gfs2_bufdata, bd_list);
490 list_del_init(&bd->bd_list); 495 list_del_init(&bd->bd_list);
491 sdp->sd_log_num_buf--; 496 sdp->sd_log_num_buf--;
492 497
493 gfs2_unpin(sdp, bd->bd_bh, ai); 498 gfs2_unpin(sdp, bd->bd_bh, tr);
494 } 499 }
495 gfs2_assert_warn(sdp, !sdp->sd_log_num_buf); 500 gfs2_assert_warn(sdp, !sdp->sd_log_num_buf);
496} 501}
@@ -613,7 +618,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
613 gfs2_log_write_page(sdp, page); 618 gfs2_log_write_page(sdp, page);
614} 619}
615 620
616static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai) 621static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
617{ 622{
618 struct list_head *head = &sdp->sd_log_le_revoke; 623 struct list_head *head = &sdp->sd_log_le_revoke;
619 struct gfs2_bufdata *bd; 624 struct gfs2_bufdata *bd;
@@ -791,16 +796,21 @@ static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
791 jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks); 796 jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks);
792} 797}
793 798
794static void databuf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai) 799static void databuf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
795{ 800{
796 struct list_head *head = &sdp->sd_log_le_databuf; 801 struct list_head *head = &sdp->sd_log_le_databuf;
797 struct gfs2_bufdata *bd; 802 struct gfs2_bufdata *bd;
798 803
804 if (tr == NULL) {
805 gfs2_assert(sdp, list_empty(head));
806 return;
807 }
808
799 while (!list_empty(head)) { 809 while (!list_empty(head)) {
800 bd = list_entry(head->next, struct gfs2_bufdata, bd_list); 810 bd = list_entry(head->next, struct gfs2_bufdata, bd_list);
801 list_del_init(&bd->bd_list); 811 list_del_init(&bd->bd_list);
802 sdp->sd_log_num_databuf--; 812 sdp->sd_log_num_databuf--;
803 gfs2_unpin(sdp, bd->bd_bh, ai); 813 gfs2_unpin(sdp, bd->bd_bh, tr);
804 } 814 }
805 gfs2_assert_warn(sdp, !sdp->sd_log_num_databuf); 815 gfs2_assert_warn(sdp, !sdp->sd_log_num_databuf);
806} 816}