diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2007-11-08 09:25:12 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-01-25 03:07:52 -0500 |
commit | 2bcd610d2fdea608a8fdac32788fc35a32a2327c (patch) | |
tree | 5b3753ff18c1da54bb860dbd67211e6abea78ca7 /fs/gfs2/lops.c | |
parent | 8cbc4342478311c2a85260a7ca54d96cb7f71f7b (diff) |
[GFS2] Don't add glocks to the journal
The only reason for adding glocks to the journal was to keep track
of which locks required a log flush prior to release. We add a
flag to the glock to allow this check to be made in a simpler way.
This reduces the size of a glock (by 12 bytes on i386, 24 on x86_64)
and means that we can avoid extra work during the journal flush.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/lops.c')
-rw-r--r-- | fs/gfs2/lops.c | 58 |
1 files changed, 5 insertions, 53 deletions
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, |