192
193
194
195
196
197
198
199
200
201
202
203static int __wait_cp_io(journal_t *journal, transaction_t *transaction)
204{
205 struct journal_head *jh;
206 struct buffer_head *bh;
207 tid_t this_tid;
208 int released = 0;
209 int ret = 0;
210
211 this_tid = transaction->t_tid;
212restart:
213
214 if (journal->j_checkpoint_transactions != transaction ||
215 transaction->t_tid != this_tid)
216 return ret;
217 while (!released && transaction->t_checkpoint_io_list) {
218 jh = transaction->t_checkpoint_io_list;
219 bh = jh2bh(jh);
220 if (!jbd_trylock_bh_state(bh)) {
221 jbd_sync_bh(journal, bh);
222 spin_lock(&journal->j_list_lock);
223 goto restart;
224 }
225 if (buffer_locked(bh)) {
226 atomic_inc(&bh->b_count);
227 spin_unlock(&journal->j_list_lock);
228 jbd_unlock_bh_state(bh);
229 wait_on_buffer(bh);
230
231 BUFFER_TRACE(bh, "brelse");
232 __brelse(bh);