aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/meta_io.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-10-03 11:10:41 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-10-03 11:10:41 -0400
commitddacfaf76dd620af9b73343a975749778321b51c (patch)
tree1199c2a78b5e2cdd6efc6965dd4cd8caa00ec482 /fs/gfs2/meta_io.c
parentf92a0b6ff43e8e07bbd5b1d2dd1cff130014f3c7 (diff)
[GFS2] Move logging code into log.c (mostly)
This moves the logging code from meta_io.c into log.c and glops.c. As a result the routines can now be static and all the logging code is together in log.c, leaving meta_io.c with just metadata i/o code in it. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/meta_io.c')
-rw-r--r--fs/gfs2/meta_io.c164
1 files changed, 0 insertions, 164 deletions
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index d0d981dac4cd..3912d6a4b1e6 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -34,11 +34,6 @@
34#include "util.h" 34#include "util.h"
35#include "ops_address.h" 35#include "ops_address.h"
36 36
37#define buffer_busy(bh) \
38((bh)->b_state & ((1ul << BH_Dirty) | (1ul << BH_Lock) | (1ul << BH_Pinned)))
39#define buffer_in_io(bh) \
40((bh)->b_state & ((1ul << BH_Dirty) | (1ul << BH_Lock)))
41
42static int aspace_get_block(struct inode *inode, sector_t lblock, 37static int aspace_get_block(struct inode *inode, sector_t lblock,
43 struct buffer_head *bh_result, int create) 38 struct buffer_head *bh_result, int create)
44{ 39{
@@ -92,165 +87,6 @@ void gfs2_aspace_put(struct inode *aspace)
92} 87}
93 88
94/** 89/**
95 * gfs2_ail1_start_one - Start I/O on a part of the AIL
96 * @sdp: the filesystem
97 * @tr: the part of the AIL
98 *
99 */
100
101void gfs2_ail1_start_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
102{
103 struct gfs2_bufdata *bd, *s;
104 struct buffer_head *bh;
105 int retry;
106
107 BUG_ON(!spin_is_locked(&sdp->sd_log_lock));
108
109 do {
110 retry = 0;
111
112 list_for_each_entry_safe_reverse(bd, s, &ai->ai_ail1_list,
113 bd_ail_st_list) {
114 bh = bd->bd_bh;
115
116 gfs2_assert(sdp, bd->bd_ail == ai);
117
118 if (!buffer_busy(bh)) {
119 if (!buffer_uptodate(bh)) {
120 gfs2_log_unlock(sdp);
121 gfs2_io_error_bh(sdp, bh);
122 gfs2_log_lock(sdp);
123 }
124 list_move(&bd->bd_ail_st_list, &ai->ai_ail2_list);
125 continue;
126 }
127
128 if (!buffer_dirty(bh))
129 continue;
130
131 list_move(&bd->bd_ail_st_list, &ai->ai_ail1_list);
132
133 gfs2_log_unlock(sdp);
134 wait_on_buffer(bh);
135 ll_rw_block(WRITE, 1, &bh);
136 gfs2_log_lock(sdp);
137
138 retry = 1;
139 break;
140 }
141 } while (retry);
142}
143
144/**
145 * gfs2_ail1_empty_one - Check whether or not a trans in the AIL has been synced
146 * @sdp: the filesystem
147 * @ai: the AIL entry
148 *
149 */
150
151int gfs2_ail1_empty_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai, int flags)
152{
153 struct gfs2_bufdata *bd, *s;
154 struct buffer_head *bh;
155
156 list_for_each_entry_safe_reverse(bd, s, &ai->ai_ail1_list,
157 bd_ail_st_list) {
158 bh = bd->bd_bh;
159
160 gfs2_assert(sdp, bd->bd_ail == ai);
161
162 if (buffer_busy(bh)) {
163 if (flags & DIO_ALL)
164 continue;
165 else
166 break;
167 }
168
169 if (!buffer_uptodate(bh))
170 gfs2_io_error_bh(sdp, bh);
171
172 list_move(&bd->bd_ail_st_list, &ai->ai_ail2_list);
173 }
174
175 return list_empty(&ai->ai_ail1_list);
176}
177
178/**
179 * gfs2_ail2_empty_one - Check whether or not a trans in the AIL has been synced
180 * @sdp: the filesystem
181 * @ai: the AIL entry
182 *
183 */
184
185void gfs2_ail2_empty_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
186{
187 struct list_head *head = &ai->ai_ail2_list;
188 struct gfs2_bufdata *bd;
189
190 while (!list_empty(head)) {
191 bd = list_entry(head->prev, struct gfs2_bufdata,
192 bd_ail_st_list);
193 gfs2_assert(sdp, bd->bd_ail == ai);
194 bd->bd_ail = NULL;
195 list_del(&bd->bd_ail_st_list);
196 list_del(&bd->bd_ail_gl_list);
197 atomic_dec(&bd->bd_gl->gl_ail_count);
198 brelse(bd->bd_bh);
199 }
200}
201
202/**
203 * ail_empty_gl - remove all buffers for a given lock from the AIL
204 * @gl: the glock
205 *
206 * None of the buffers should be dirty, locked, or pinned.
207 */
208
209void gfs2_ail_empty_gl(struct gfs2_glock *gl)
210{
211 struct gfs2_sbd *sdp = gl->gl_sbd;
212 unsigned int blocks;
213 struct list_head *head = &gl->gl_ail_list;
214 struct gfs2_bufdata *bd;
215 struct buffer_head *bh;
216 u64 blkno;
217 int error;
218
219 blocks = atomic_read(&gl->gl_ail_count);
220 if (!blocks)
221 return;
222
223 error = gfs2_trans_begin(sdp, 0, blocks);
224 if (gfs2_assert_withdraw(sdp, !error))
225 return;
226
227 gfs2_log_lock(sdp);
228 while (!list_empty(head)) {
229 bd = list_entry(head->next, struct gfs2_bufdata,
230 bd_ail_gl_list);
231 bh = bd->bd_bh;
232 blkno = bh->b_blocknr;
233 gfs2_assert_withdraw(sdp, !buffer_busy(bh));
234
235 bd->bd_ail = NULL;
236 list_del(&bd->bd_ail_st_list);
237 list_del(&bd->bd_ail_gl_list);
238 atomic_dec(&gl->gl_ail_count);
239 brelse(bh);
240 gfs2_log_unlock(sdp);
241
242 gfs2_trans_add_revoke(sdp, blkno);
243
244 gfs2_log_lock(sdp);
245 }
246 gfs2_assert_withdraw(sdp, !atomic_read(&gl->gl_ail_count));
247 gfs2_log_unlock(sdp);
248
249 gfs2_trans_end(sdp);
250 gfs2_log_flush(sdp, NULL);
251}
252
253/**
254 * gfs2_meta_inval - Invalidate all buffers associated with a glock 90 * gfs2_meta_inval - Invalidate all buffers associated with a glock
255 * @gl: the glock 91 * @gl: the glock
256 * 92 *