145 int chkpt = journal->j_checkpoint_transactions != NULL;
146 tid_t tid = 0;
147
148 if (journal->j_committing_transaction)
149 tid = journal->j_committing_transaction->t_tid;
150 spin_unlock(&journal->j_list_lock);
151 spin_unlock(&journal->j_state_lock);
152 if (chkpt) {
153 jbd2_log_do_checkpoint(journal);
154 } else if (jbd2_cleanup_journal_tail(journal) == 0) {
155
156 ;
157 } else if (tid) {
158 jbd2_log_wait_commit(journal, tid);
159 } else {
160 printk(KERN_ERR "%s: needed %d blocks and "
161 "only had %d space available\n",
162 __func__, nblocks, space_left);
163 printk(KERN_ERR "%s: no way to get more "
164 "journal space in %s\n", __func__,
165 journal->j_devname);
166 WARN_ON(1);
167 jbd2_journal_abort(journal, 0);
168 }
169 spin_lock(&journal->j_state_lock);
170 } else {
171 spin_unlock(&journal->j_list_lock);
172 }
173 mutex_unlock(&journal->j_checkpoint_mutex);
174 }
175}
176
177
178
179
180
181
182static void jbd_sync_bh(journal_t *journal, struct buffer_head *bh)
183 __releases(journal->j_list_lock)
184{
185 get_bh(bh);