diff options
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/glock.c | 3 | ||||
-rw-r--r-- | fs/gfs2/incore.h | 4 | ||||
-rw-r--r-- | fs/gfs2/inode.c | 3 | ||||
-rw-r--r-- | fs/gfs2/log.c | 15 | ||||
-rw-r--r-- | fs/gfs2/log.h | 9 | ||||
-rw-r--r-- | fs/gfs2/lops.c | 58 | ||||
-rw-r--r-- | fs/gfs2/ops_fstype.c | 1 | ||||
-rw-r--r-- | fs/gfs2/trans.c | 5 | ||||
-rw-r--r-- | fs/gfs2/trans.h | 1 |
9 files changed, 21 insertions, 78 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 5fbd9d34ce2..d83df688840 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -346,7 +346,6 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, | |||
346 | gl->gl_object = NULL; | 346 | gl->gl_object = NULL; |
347 | gl->gl_sbd = sdp; | 347 | gl->gl_sbd = sdp; |
348 | gl->gl_aspace = NULL; | 348 | gl->gl_aspace = NULL; |
349 | lops_init_le(&gl->gl_le, &gfs2_glock_lops); | ||
350 | INIT_DELAYED_WORK(&gl->gl_work, glock_work_func); | 349 | INIT_DELAYED_WORK(&gl->gl_work, glock_work_func); |
351 | 350 | ||
352 | /* If this glock protects actual on-disk data or metadata blocks, | 351 | /* If this glock protects actual on-disk data or metadata blocks, |
@@ -1900,8 +1899,6 @@ static int dump_glock(struct glock_iter *gi, struct gfs2_glock *gl) | |||
1900 | print_dbg(gi, " req_bh = %s\n", (gl->gl_req_bh) ? "yes" : "no"); | 1899 | print_dbg(gi, " req_bh = %s\n", (gl->gl_req_bh) ? "yes" : "no"); |
1901 | print_dbg(gi, " lvb_count = %d\n", atomic_read(&gl->gl_lvb_count)); | 1900 | print_dbg(gi, " lvb_count = %d\n", atomic_read(&gl->gl_lvb_count)); |
1902 | print_dbg(gi, " object = %s\n", (gl->gl_object) ? "yes" : "no"); | 1901 | print_dbg(gi, " object = %s\n", (gl->gl_object) ? "yes" : "no"); |
1903 | print_dbg(gi, " le = %s\n", | ||
1904 | (list_empty(&gl->gl_le.le_list)) ? "no" : "yes"); | ||
1905 | print_dbg(gi, " reclaim = %s\n", | 1902 | print_dbg(gi, " reclaim = %s\n", |
1906 | (list_empty(&gl->gl_reclaim)) ? "no" : "yes"); | 1903 | (list_empty(&gl->gl_reclaim)) ? "no" : "yes"); |
1907 | if (gl->gl_aspace) | 1904 | if (gl->gl_aspace) |
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 478023e9fda..911822d1e4c 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -168,6 +168,7 @@ enum { | |||
168 | GLF_PENDING_DEMOTE = 4, | 168 | GLF_PENDING_DEMOTE = 4, |
169 | GLF_DIRTY = 5, | 169 | GLF_DIRTY = 5, |
170 | GLF_DEMOTE_IN_PROGRESS = 6, | 170 | GLF_DEMOTE_IN_PROGRESS = 6, |
171 | GLF_LFLUSH = 7, | ||
171 | }; | 172 | }; |
172 | 173 | ||
173 | struct gfs2_glock { | 174 | struct gfs2_glock { |
@@ -208,7 +209,6 @@ struct gfs2_glock { | |||
208 | struct gfs2_sbd *gl_sbd; | 209 | struct gfs2_sbd *gl_sbd; |
209 | 210 | ||
210 | struct inode *gl_aspace; | 211 | struct inode *gl_aspace; |
211 | struct gfs2_log_element gl_le; | ||
212 | struct list_head gl_ail_list; | 212 | struct list_head gl_ail_list; |
213 | atomic_t gl_ail_count; | 213 | atomic_t gl_ail_count; |
214 | struct delayed_work gl_work; | 214 | struct delayed_work gl_work; |
@@ -584,13 +584,11 @@ struct gfs2_sbd { | |||
584 | unsigned int sd_log_commited_databuf; | 584 | unsigned int sd_log_commited_databuf; |
585 | unsigned int sd_log_commited_revoke; | 585 | unsigned int sd_log_commited_revoke; |
586 | 586 | ||
587 | unsigned int sd_log_num_gl; | ||
588 | unsigned int sd_log_num_buf; | 587 | unsigned int sd_log_num_buf; |
589 | unsigned int sd_log_num_revoke; | 588 | unsigned int sd_log_num_revoke; |
590 | unsigned int sd_log_num_rg; | 589 | unsigned int sd_log_num_rg; |
591 | unsigned int sd_log_num_databuf; | 590 | unsigned int sd_log_num_databuf; |
592 | 591 | ||
593 | struct list_head sd_log_le_gl; | ||
594 | struct list_head sd_log_le_buf; | 592 | struct list_head sd_log_le_buf; |
595 | struct list_head sd_log_le_revoke; | 593 | struct list_head sd_log_le_revoke; |
596 | struct list_head sd_log_le_rg; | 594 | struct list_head sd_log_le_rg; |
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 532784eb5ba..92959d093ad 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -362,7 +362,8 @@ int gfs2_dinode_dealloc(struct gfs2_inode *ip) | |||
362 | if (error) | 362 | if (error) |
363 | goto out_rg_gunlock; | 363 | goto out_rg_gunlock; |
364 | 364 | ||
365 | gfs2_trans_add_gl(ip->i_gl); | 365 | set_bit(GLF_DIRTY, &ip->i_gl->gl_flags); |
366 | set_bit(GLF_LFLUSH, &ip->i_gl->gl_flags); | ||
366 | 367 | ||
367 | gfs2_free_di(rgd, ip); | 368 | gfs2_free_di(rgd, ip); |
368 | 369 | ||
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 1e1fe8def37..d24684330bc 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c | |||
@@ -692,20 +692,16 @@ static void gfs2_ordered_wait(struct gfs2_sbd *sdp) | |||
692 | * | 692 | * |
693 | */ | 693 | */ |
694 | 694 | ||
695 | void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl) | 695 | void __gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl) |
696 | { | 696 | { |
697 | struct gfs2_ail *ai; | 697 | struct gfs2_ail *ai; |
698 | 698 | ||
699 | down_write(&sdp->sd_log_flush_lock); | 699 | down_write(&sdp->sd_log_flush_lock); |
700 | 700 | ||
701 | if (gl) { | 701 | /* Log might have been flushed while we waited for the flush lock */ |
702 | gfs2_log_lock(sdp); | 702 | if (gl && !test_bit(GLF_LFLUSH, &gl->gl_flags)) { |
703 | if (list_empty(&gl->gl_le.le_list)) { | 703 | up_write(&sdp->sd_log_flush_lock); |
704 | gfs2_log_unlock(sdp); | 704 | return; |
705 | up_write(&sdp->sd_log_flush_lock); | ||
706 | return; | ||
707 | } | ||
708 | gfs2_log_unlock(sdp); | ||
709 | } | 705 | } |
710 | 706 | ||
711 | ai = kzalloc(sizeof(struct gfs2_ail), GFP_NOFS | __GFP_NOFAIL); | 707 | ai = kzalloc(sizeof(struct gfs2_ail), GFP_NOFS | __GFP_NOFAIL); |
@@ -823,7 +819,6 @@ void gfs2_log_shutdown(struct gfs2_sbd *sdp) | |||
823 | down_write(&sdp->sd_log_flush_lock); | 819 | down_write(&sdp->sd_log_flush_lock); |
824 | 820 | ||
825 | gfs2_assert_withdraw(sdp, !sdp->sd_log_blks_reserved); | 821 | gfs2_assert_withdraw(sdp, !sdp->sd_log_blks_reserved); |
826 | gfs2_assert_withdraw(sdp, !sdp->sd_log_num_gl); | ||
827 | gfs2_assert_withdraw(sdp, !sdp->sd_log_num_buf); | 822 | gfs2_assert_withdraw(sdp, !sdp->sd_log_num_buf); |
828 | gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke); | 823 | gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke); |
829 | gfs2_assert_withdraw(sdp, !sdp->sd_log_num_rg); | 824 | gfs2_assert_withdraw(sdp, !sdp->sd_log_num_rg); |
diff --git a/fs/gfs2/log.h b/fs/gfs2/log.h index 24e7161486e..4babd430b72 100644 --- a/fs/gfs2/log.h +++ b/fs/gfs2/log.h | |||
@@ -57,7 +57,14 @@ void gfs2_log_incr_head(struct gfs2_sbd *sdp); | |||
57 | struct buffer_head *gfs2_log_get_buf(struct gfs2_sbd *sdp); | 57 | struct buffer_head *gfs2_log_get_buf(struct gfs2_sbd *sdp); |
58 | struct buffer_head *gfs2_log_fake_buf(struct gfs2_sbd *sdp, | 58 | struct buffer_head *gfs2_log_fake_buf(struct gfs2_sbd *sdp, |
59 | struct buffer_head *real); | 59 | struct buffer_head *real); |
60 | void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl); | 60 | void __gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl); |
61 | |||
62 | static inline void gfs2_log_flush(struct gfs2_sbd *sbd, struct gfs2_glock *gl) | ||
63 | { | ||
64 | if (!gl || test_bit(GLF_LFLUSH, &gl->gl_flags)) | ||
65 | __gfs2_log_flush(sbd, gl); | ||
66 | } | ||
67 | |||
61 | void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans); | 68 | void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans); |
62 | void gfs2_remove_from_ail(struct gfs2_bufdata *bd); | 69 | void gfs2_remove_from_ail(struct gfs2_bufdata *bd); |
63 | 70 | ||
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index e901f8f7d65..fae59d69d01 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c | |||
@@ -87,6 +87,7 @@ static void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh, | |||
87 | } | 87 | } |
88 | bd->bd_ail = ai; | 88 | bd->bd_ail = ai; |
89 | list_add(&bd->bd_ail_st_list, &ai->ai_ail1_list); | 89 | list_add(&bd->bd_ail_st_list, &ai->ai_ail1_list); |
90 | clear_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags); | ||
90 | gfs2_log_unlock(sdp); | 91 | gfs2_log_unlock(sdp); |
91 | unlock_buffer(bh); | 92 | unlock_buffer(bh); |
92 | } | 93 | } |
@@ -124,49 +125,6 @@ static struct buffer_head *gfs2_get_log_desc(struct gfs2_sbd *sdp, u32 ld_type) | |||
124 | return bh; | 125 | return bh; |
125 | } | 126 | } |
126 | 127 | ||
127 | static void __glock_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) | ||
128 | { | ||
129 | struct gfs2_glock *gl; | ||
130 | struct gfs2_trans *tr = current->journal_info; | ||
131 | |||
132 | tr->tr_touched = 1; | ||
133 | |||
134 | gl = container_of(le, struct gfs2_glock, gl_le); | ||
135 | if (gfs2_assert_withdraw(sdp, gfs2_glock_is_held_excl(gl))) | ||
136 | return; | ||
137 | |||
138 | if (!list_empty(&le->le_list)) | ||
139 | return; | ||
140 | |||
141 | gfs2_glock_hold(gl); | ||
142 | set_bit(GLF_DIRTY, &gl->gl_flags); | ||
143 | sdp->sd_log_num_gl++; | ||
144 | list_add(&le->le_list, &sdp->sd_log_le_gl); | ||
145 | } | ||
146 | |||
147 | static void glock_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) | ||
148 | { | ||
149 | gfs2_log_lock(sdp); | ||
150 | __glock_lo_add(sdp, le); | ||
151 | gfs2_log_unlock(sdp); | ||
152 | } | ||
153 | |||
154 | static void glock_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai) | ||
155 | { | ||
156 | struct list_head *head = &sdp->sd_log_le_gl; | ||
157 | struct gfs2_glock *gl; | ||
158 | |||
159 | while (!list_empty(head)) { | ||
160 | gl = list_entry(head->next, struct gfs2_glock, gl_le.le_list); | ||
161 | list_del_init(&gl->gl_le.le_list); | ||
162 | sdp->sd_log_num_gl--; | ||
163 | |||
164 | gfs2_assert_withdraw(sdp, gfs2_glock_is_held_excl(gl)); | ||
165 | gfs2_glock_put(gl); | ||
166 | } | ||
167 | gfs2_assert_warn(sdp, !sdp->sd_log_num_gl); | ||
168 | } | ||
169 | |||
170 | static void buf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) | 128 | static void buf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) |
171 | { | 129 | { |
172 | struct gfs2_bufdata *bd = container_of(le, struct gfs2_bufdata, bd_le); | 130 | struct gfs2_bufdata *bd = container_of(le, struct gfs2_bufdata, bd_le); |
@@ -182,7 +140,8 @@ static void buf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) | |||
182 | list_add(&bd->bd_list_tr, &tr->tr_list_buf); | 140 | list_add(&bd->bd_list_tr, &tr->tr_list_buf); |
183 | if (!list_empty(&le->le_list)) | 141 | if (!list_empty(&le->le_list)) |
184 | goto out; | 142 | goto out; |
185 | __glock_lo_add(sdp, &bd->bd_gl->gl_le); | 143 | set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags); |
144 | set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags); | ||
186 | gfs2_meta_check(sdp, bd->bd_bh); | 145 | gfs2_meta_check(sdp, bd->bd_bh); |
187 | gfs2_pin(sdp, bd->bd_bh); | 146 | gfs2_pin(sdp, bd->bd_bh); |
188 | sdp->sd_log_num_buf++; | 147 | sdp->sd_log_num_buf++; |
@@ -568,8 +527,8 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) | |||
568 | if (!list_empty(&le->le_list)) | 527 | if (!list_empty(&le->le_list)) |
569 | goto out; | 528 | goto out; |
570 | 529 | ||
571 | if (tr) | 530 | set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags); |
572 | __glock_lo_add(sdp, &bd->bd_gl->gl_le); | 531 | set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags); |
573 | if (gfs2_is_jdata(ip)) { | 532 | if (gfs2_is_jdata(ip)) { |
574 | gfs2_pin(sdp, bd->bd_bh); | 533 | gfs2_pin(sdp, bd->bd_bh); |
575 | tr->tr_num_databuf_new++; | 534 | tr->tr_num_databuf_new++; |
@@ -776,12 +735,6 @@ static void databuf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai) | |||
776 | } | 735 | } |
777 | 736 | ||
778 | 737 | ||
779 | const struct gfs2_log_operations gfs2_glock_lops = { | ||
780 | .lo_add = glock_lo_add, | ||
781 | .lo_after_commit = glock_lo_after_commit, | ||
782 | .lo_name = "glock", | ||
783 | }; | ||
784 | |||
785 | const struct gfs2_log_operations gfs2_buf_lops = { | 738 | const struct gfs2_log_operations gfs2_buf_lops = { |
786 | .lo_add = buf_lo_add, | 739 | .lo_add = buf_lo_add, |
787 | .lo_incore_commit = buf_lo_incore_commit, | 740 | .lo_incore_commit = buf_lo_incore_commit, |
@@ -819,7 +772,6 @@ const struct gfs2_log_operations gfs2_databuf_lops = { | |||
819 | }; | 772 | }; |
820 | 773 | ||
821 | const struct gfs2_log_operations *gfs2_log_ops[] = { | 774 | const struct gfs2_log_operations *gfs2_log_ops[] = { |
822 | &gfs2_glock_lops, | ||
823 | &gfs2_databuf_lops, | 775 | &gfs2_databuf_lops, |
824 | &gfs2_buf_lops, | 776 | &gfs2_buf_lops, |
825 | &gfs2_rg_lops, | 777 | &gfs2_rg_lops, |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 17de58e83d9..52aaba96d5d 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -77,7 +77,6 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb) | |||
77 | 77 | ||
78 | spin_lock_init(&sdp->sd_log_lock); | 78 | spin_lock_init(&sdp->sd_log_lock); |
79 | 79 | ||
80 | INIT_LIST_HEAD(&sdp->sd_log_le_gl); | ||
81 | INIT_LIST_HEAD(&sdp->sd_log_le_buf); | 80 | INIT_LIST_HEAD(&sdp->sd_log_le_buf); |
82 | INIT_LIST_HEAD(&sdp->sd_log_le_revoke); | 81 | INIT_LIST_HEAD(&sdp->sd_log_le_revoke); |
83 | INIT_LIST_HEAD(&sdp->sd_log_le_rg); | 82 | INIT_LIST_HEAD(&sdp->sd_log_le_rg); |
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c index 717983e2c2a..73e5d92a657 100644 --- a/fs/gfs2/trans.c +++ b/fs/gfs2/trans.c | |||
@@ -114,11 +114,6 @@ void gfs2_trans_end(struct gfs2_sbd *sdp) | |||
114 | gfs2_log_flush(sdp, NULL); | 114 | gfs2_log_flush(sdp, NULL); |
115 | } | 115 | } |
116 | 116 | ||
117 | void gfs2_trans_add_gl(struct gfs2_glock *gl) | ||
118 | { | ||
119 | lops_add(gl->gl_sbd, &gl->gl_le); | ||
120 | } | ||
121 | |||
122 | /** | 117 | /** |
123 | * gfs2_trans_add_bh - Add a to-be-modified buffer to the current transaction | 118 | * gfs2_trans_add_bh - Add a to-be-modified buffer to the current transaction |
124 | * @gl: the glock the buffer belongs to | 119 | * @gl: the glock the buffer belongs to |
diff --git a/fs/gfs2/trans.h b/fs/gfs2/trans.h index 043d5f4b9c4..e826f0dab80 100644 --- a/fs/gfs2/trans.h +++ b/fs/gfs2/trans.h | |||
@@ -30,7 +30,6 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks, | |||
30 | 30 | ||
31 | void gfs2_trans_end(struct gfs2_sbd *sdp); | 31 | void gfs2_trans_end(struct gfs2_sbd *sdp); |
32 | 32 | ||
33 | void gfs2_trans_add_gl(struct gfs2_glock *gl); | ||
34 | void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta); | 33 | void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta); |
35 | void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd); | 34 | void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd); |
36 | void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, u64 blkno); | 35 | void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, u64 blkno); |