Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Uwe Kleine-König | 5886269 | 2007-05-09 07:51:49 +0200 | [diff] [blame] | 2 | * linux/fs/jbd/checkpoint.c |
Mingming Cao | ae6ddcc | 2006-09-27 01:49:27 -0700 | [diff] [blame] | 3 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * Written by Stephen C. Tweedie <sct@redhat.com>, 1999 |
| 5 | * |
| 6 | * Copyright 1999 Red Hat Software --- All Rights Reserved |
| 7 | * |
| 8 | * This file is part of the Linux kernel and is made available under |
| 9 | * the terms of the GNU General Public License, version 2, or at your |
| 10 | * option, any later version, incorporated herein by reference. |
| 11 | * |
Mingming Cao | ae6ddcc | 2006-09-27 01:49:27 -0700 | [diff] [blame] | 12 | * Checkpoint routines for the generic filesystem journaling code. |
| 13 | * Part of the ext2fs journaling system. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | * |
| 15 | * Checkpointing is the process of ensuring that a section of the log is |
| 16 | * committed fully to disk, so that that portion of the log can be |
| 17 | * reused. |
| 18 | */ |
| 19 | |
| 20 | #include <linux/time.h> |
| 21 | #include <linux/fs.h> |
| 22 | #include <linux/jbd.h> |
| 23 | #include <linux/errno.h> |
| 24 | #include <linux/slab.h> |
| 25 | |
| 26 | /* |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 27 | * Unlink a buffer from a transaction checkpoint list. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | * |
| 29 | * Called with j_list_lock held. |
| 30 | */ |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 31 | static inline void __buffer_unlink_first(struct journal_head *jh) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | { |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 33 | transaction_t *transaction = jh->b_cp_transaction; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Mark Fasheh | 7c8903f | 2006-02-14 13:53:03 -0800 | [diff] [blame] | 35 | jh->b_cpnext->b_cpprev = jh->b_cpprev; |
| 36 | jh->b_cpprev->b_cpnext = jh->b_cpnext; |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 37 | if (transaction->t_checkpoint_list == jh) { |
Mark Fasheh | 7c8903f | 2006-02-14 13:53:03 -0800 | [diff] [blame] | 38 | transaction->t_checkpoint_list = jh->b_cpnext; |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 39 | if (transaction->t_checkpoint_list == jh) |
| 40 | transaction->t_checkpoint_list = NULL; |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | /* |
| 45 | * Unlink a buffer from a transaction checkpoint(io) list. |
| 46 | * |
| 47 | * Called with j_list_lock held. |
| 48 | */ |
| 49 | static inline void __buffer_unlink(struct journal_head *jh) |
| 50 | { |
| 51 | transaction_t *transaction = jh->b_cp_transaction; |
| 52 | |
| 53 | __buffer_unlink_first(jh); |
| 54 | if (transaction->t_checkpoint_io_list == jh) { |
| 55 | transaction->t_checkpoint_io_list = jh->b_cpnext; |
| 56 | if (transaction->t_checkpoint_io_list == jh) |
| 57 | transaction->t_checkpoint_io_list = NULL; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | /* |
| 62 | * Move a buffer from the checkpoint list to the checkpoint io list |
| 63 | * |
| 64 | * Called with j_list_lock held |
| 65 | */ |
| 66 | static inline void __buffer_relink_io(struct journal_head *jh) |
| 67 | { |
| 68 | transaction_t *transaction = jh->b_cp_transaction; |
| 69 | |
| 70 | __buffer_unlink_first(jh); |
| 71 | |
| 72 | if (!transaction->t_checkpoint_io_list) { |
| 73 | jh->b_cpnext = jh->b_cpprev = jh; |
| 74 | } else { |
| 75 | jh->b_cpnext = transaction->t_checkpoint_io_list; |
| 76 | jh->b_cpprev = transaction->t_checkpoint_io_list->b_cpprev; |
| 77 | jh->b_cpprev->b_cpnext = jh; |
| 78 | jh->b_cpnext->b_cpprev = jh; |
| 79 | } |
| 80 | transaction->t_checkpoint_io_list = jh; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | /* |
| 84 | * Try to release a checkpointed buffer from its transaction. |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 85 | * Returns 1 if we released it and 2 if we also released the |
| 86 | * whole transaction. |
| 87 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | * Requires j_list_lock |
| 89 | * Called under jbd_lock_bh_state(jh2bh(jh)), and drops it |
| 90 | */ |
| 91 | static int __try_to_free_cp_buf(struct journal_head *jh) |
| 92 | { |
| 93 | int ret = 0; |
| 94 | struct buffer_head *bh = jh2bh(jh); |
| 95 | |
Hidehiro Kawai | 4afe978 | 2008-10-22 14:15:00 -0700 | [diff] [blame^] | 96 | if (jh->b_jlist == BJ_None && !buffer_locked(bh) && |
| 97 | !buffer_dirty(bh) && buffer_uptodate(bh)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | JBUFFER_TRACE(jh, "remove from checkpoint list"); |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 99 | ret = __journal_remove_checkpoint(jh) + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | jbd_unlock_bh_state(bh); |
| 101 | journal_remove_journal_head(bh); |
| 102 | BUFFER_TRACE(bh, "release"); |
| 103 | __brelse(bh); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | } else { |
| 105 | jbd_unlock_bh_state(bh); |
| 106 | } |
| 107 | return ret; |
| 108 | } |
| 109 | |
| 110 | /* |
| 111 | * __log_wait_for_space: wait until there is space in the journal. |
| 112 | * |
| 113 | * Called under j-state_lock *only*. It will be unlocked if we have to wait |
| 114 | * for a checkpoint to free up some space in the log. |
| 115 | */ |
| 116 | void __log_wait_for_space(journal_t *journal) |
| 117 | { |
| 118 | int nblocks; |
| 119 | assert_spin_locked(&journal->j_state_lock); |
| 120 | |
| 121 | nblocks = jbd_space_needed(journal); |
| 122 | while (__log_space_left(journal) < nblocks) { |
| 123 | if (journal->j_flags & JFS_ABORT) |
| 124 | return; |
| 125 | spin_unlock(&journal->j_state_lock); |
Arjan van de Ven | 2c68ee7 | 2006-03-23 03:00:35 -0800 | [diff] [blame] | 126 | mutex_lock(&journal->j_checkpoint_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | |
| 128 | /* |
| 129 | * Test again, another process may have checkpointed while we |
| 130 | * were waiting for the checkpoint lock |
| 131 | */ |
| 132 | spin_lock(&journal->j_state_lock); |
| 133 | nblocks = jbd_space_needed(journal); |
| 134 | if (__log_space_left(journal) < nblocks) { |
| 135 | spin_unlock(&journal->j_state_lock); |
| 136 | log_do_checkpoint(journal); |
| 137 | spin_lock(&journal->j_state_lock); |
| 138 | } |
Arjan van de Ven | 2c68ee7 | 2006-03-23 03:00:35 -0800 | [diff] [blame] | 139 | mutex_unlock(&journal->j_checkpoint_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | } |
| 141 | } |
| 142 | |
| 143 | /* |
| 144 | * We were unable to perform jbd_trylock_bh_state() inside j_list_lock. |
| 145 | * The caller must restart a list walk. Wait for someone else to run |
| 146 | * jbd_unlock_bh_state(). |
| 147 | */ |
| 148 | static void jbd_sync_bh(journal_t *journal, struct buffer_head *bh) |
Josh Triplett | e7ab8d6 | 2006-09-27 01:49:26 -0700 | [diff] [blame] | 149 | __releases(journal->j_list_lock) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | { |
| 151 | get_bh(bh); |
| 152 | spin_unlock(&journal->j_list_lock); |
| 153 | jbd_lock_bh_state(bh); |
| 154 | jbd_unlock_bh_state(bh); |
| 155 | put_bh(bh); |
| 156 | } |
| 157 | |
| 158 | /* |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 159 | * Clean up transaction's list of buffers submitted for io. |
| 160 | * We wait for any pending IO to complete and remove any clean |
| 161 | * buffers. Note that we take the buffers in the opposite ordering |
| 162 | * from the one in which they were submitted for IO. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | * |
Hidehiro Kawai | 4afe978 | 2008-10-22 14:15:00 -0700 | [diff] [blame^] | 164 | * Return 0 on success, and return <0 if some buffers have failed |
| 165 | * to be written out. |
| 166 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | * Called with j_list_lock held. |
| 168 | */ |
Hidehiro Kawai | 4afe978 | 2008-10-22 14:15:00 -0700 | [diff] [blame^] | 169 | static int __wait_cp_io(journal_t *journal, transaction_t *transaction) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | { |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 171 | struct journal_head *jh; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | struct buffer_head *bh; |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 173 | tid_t this_tid; |
| 174 | int released = 0; |
Hidehiro Kawai | 4afe978 | 2008-10-22 14:15:00 -0700 | [diff] [blame^] | 175 | int ret = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 | |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 177 | this_tid = transaction->t_tid; |
| 178 | restart: |
| 179 | /* Did somebody clean up the transaction in the meanwhile? */ |
| 180 | if (journal->j_checkpoint_transactions != transaction || |
| 181 | transaction->t_tid != this_tid) |
Hidehiro Kawai | 4afe978 | 2008-10-22 14:15:00 -0700 | [diff] [blame^] | 182 | return ret; |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 183 | while (!released && transaction->t_checkpoint_io_list) { |
| 184 | jh = transaction->t_checkpoint_io_list; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | bh = jh2bh(jh); |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 186 | if (!jbd_trylock_bh_state(bh)) { |
| 187 | jbd_sync_bh(journal, bh); |
| 188 | spin_lock(&journal->j_list_lock); |
| 189 | goto restart; |
| 190 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 | if (buffer_locked(bh)) { |
| 192 | atomic_inc(&bh->b_count); |
| 193 | spin_unlock(&journal->j_list_lock); |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 194 | jbd_unlock_bh_state(bh); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 195 | wait_on_buffer(bh); |
| 196 | /* the journal_head may have gone by now */ |
| 197 | BUFFER_TRACE(bh, "brelse"); |
| 198 | __brelse(bh); |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 199 | spin_lock(&journal->j_list_lock); |
| 200 | goto restart; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 201 | } |
Hidehiro Kawai | 4afe978 | 2008-10-22 14:15:00 -0700 | [diff] [blame^] | 202 | if (unlikely(!buffer_uptodate(bh))) |
| 203 | ret = -EIO; |
| 204 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | /* |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 206 | * Now in whatever state the buffer currently is, we know that |
| 207 | * it has been written out and so we can drop it from the list |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | */ |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 209 | released = __journal_remove_checkpoint(jh); |
| 210 | jbd_unlock_bh_state(bh); |
| 211 | journal_remove_journal_head(bh); |
| 212 | __brelse(bh); |
| 213 | } |
Hidehiro Kawai | 4afe978 | 2008-10-22 14:15:00 -0700 | [diff] [blame^] | 214 | |
| 215 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | } |
| 217 | |
| 218 | #define NR_BATCH 64 |
| 219 | |
| 220 | static void |
| 221 | __flush_batch(journal_t *journal, struct buffer_head **bhs, int *batch_count) |
| 222 | { |
| 223 | int i; |
| 224 | |
Jan Kara | 2670769 | 2005-09-06 15:19:12 -0700 | [diff] [blame] | 225 | ll_rw_block(SWRITE, *batch_count, bhs); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | for (i = 0; i < *batch_count; i++) { |
| 227 | struct buffer_head *bh = bhs[i]; |
| 228 | clear_buffer_jwrite(bh); |
| 229 | BUFFER_TRACE(bh, "brelse"); |
| 230 | __brelse(bh); |
| 231 | } |
| 232 | *batch_count = 0; |
| 233 | } |
| 234 | |
| 235 | /* |
| 236 | * Try to flush one buffer from the checkpoint list to disk. |
| 237 | * |
| 238 | * Return 1 if something happened which requires us to abort the current |
Hidehiro Kawai | 4afe978 | 2008-10-22 14:15:00 -0700 | [diff] [blame^] | 239 | * scan of the checkpoint list. Return <0 if the buffer has failed to |
| 240 | * be written out. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | * |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 242 | * Called with j_list_lock held and drops it if 1 is returned |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | * Called under jbd_lock_bh_state(jh2bh(jh)), and drops it |
| 244 | */ |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 245 | static int __process_buffer(journal_t *journal, struct journal_head *jh, |
| 246 | struct buffer_head **bhs, int *batch_count) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | { |
| 248 | struct buffer_head *bh = jh2bh(jh); |
| 249 | int ret = 0; |
| 250 | |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 251 | if (buffer_locked(bh)) { |
| 252 | atomic_inc(&bh->b_count); |
| 253 | spin_unlock(&journal->j_list_lock); |
| 254 | jbd_unlock_bh_state(bh); |
| 255 | wait_on_buffer(bh); |
| 256 | /* the journal_head may have gone by now */ |
| 257 | BUFFER_TRACE(bh, "brelse"); |
| 258 | __brelse(bh); |
| 259 | ret = 1; |
| 260 | } else if (jh->b_transaction != NULL) { |
| 261 | transaction_t *t = jh->b_transaction; |
| 262 | tid_t tid = t->t_tid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 263 | |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 264 | spin_unlock(&journal->j_list_lock); |
| 265 | jbd_unlock_bh_state(bh); |
| 266 | log_start_commit(journal, tid); |
| 267 | log_wait_commit(journal, tid); |
| 268 | ret = 1; |
| 269 | } else if (!buffer_dirty(bh)) { |
Hidehiro Kawai | 4afe978 | 2008-10-22 14:15:00 -0700 | [diff] [blame^] | 270 | ret = 1; |
| 271 | if (unlikely(!buffer_uptodate(bh))) |
| 272 | ret = -EIO; |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 273 | J_ASSERT_JH(jh, !buffer_jbddirty(bh)); |
| 274 | BUFFER_TRACE(bh, "remove from checkpoint"); |
| 275 | __journal_remove_checkpoint(jh); |
| 276 | spin_unlock(&journal->j_list_lock); |
| 277 | jbd_unlock_bh_state(bh); |
| 278 | journal_remove_journal_head(bh); |
| 279 | __brelse(bh); |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 280 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | /* |
| 282 | * Important: we are about to write the buffer, and |
| 283 | * possibly block, while still holding the journal lock. |
| 284 | * We cannot afford to let the transaction logic start |
| 285 | * messing around with this buffer before we write it to |
Mingming Cao | ae6ddcc | 2006-09-27 01:49:27 -0700 | [diff] [blame] | 286 | * disk, as that would break recoverability. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | */ |
| 288 | BUFFER_TRACE(bh, "queue"); |
| 289 | get_bh(bh); |
| 290 | J_ASSERT_BH(bh, !buffer_jwrite(bh)); |
| 291 | set_buffer_jwrite(bh); |
| 292 | bhs[*batch_count] = bh; |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 293 | __buffer_relink_io(jh); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | jbd_unlock_bh_state(bh); |
| 295 | (*batch_count)++; |
| 296 | if (*batch_count == NR_BATCH) { |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 297 | spin_unlock(&journal->j_list_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | __flush_batch(journal, bhs, batch_count); |
| 299 | ret = 1; |
| 300 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | } |
| 302 | return ret; |
| 303 | } |
| 304 | |
| 305 | /* |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 306 | * Perform an actual checkpoint. We take the first transaction on the |
| 307 | * list of transactions to be checkpointed and send all its buffers |
| 308 | * to disk. We submit larger chunks of data at once. |
Mingming Cao | ae6ddcc | 2006-09-27 01:49:27 -0700 | [diff] [blame] | 309 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | * The journal should be locked before calling this function. |
Hidehiro Kawai | 4afe978 | 2008-10-22 14:15:00 -0700 | [diff] [blame^] | 311 | * Called with j_checkpoint_mutex held. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | */ |
| 313 | int log_do_checkpoint(journal_t *journal) |
| 314 | { |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 315 | transaction_t *transaction; |
| 316 | tid_t this_tid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | int result; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | |
| 319 | jbd_debug(1, "Start checkpoint\n"); |
| 320 | |
Mingming Cao | ae6ddcc | 2006-09-27 01:49:27 -0700 | [diff] [blame] | 321 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | * First thing: if there are any transactions in the log which |
| 323 | * don't need checkpointing, just eliminate them from the |
Mingming Cao | ae6ddcc | 2006-09-27 01:49:27 -0700 | [diff] [blame] | 324 | * journal straight away. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | */ |
| 326 | result = cleanup_journal_tail(journal); |
| 327 | jbd_debug(1, "cleanup_journal_tail returned %d\n", result); |
| 328 | if (result <= 0) |
| 329 | return result; |
| 330 | |
| 331 | /* |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 332 | * OK, we need to start writing disk blocks. Take one transaction |
| 333 | * and write it. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | */ |
Hidehiro Kawai | 4afe978 | 2008-10-22 14:15:00 -0700 | [diff] [blame^] | 335 | result = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | spin_lock(&journal->j_list_lock); |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 337 | if (!journal->j_checkpoint_transactions) |
| 338 | goto out; |
| 339 | transaction = journal->j_checkpoint_transactions; |
| 340 | this_tid = transaction->t_tid; |
| 341 | restart: |
| 342 | /* |
| 343 | * If someone cleaned up this transaction while we slept, we're |
| 344 | * done (maybe it's a new transaction, but it fell at the same |
| 345 | * address). |
| 346 | */ |
| 347 | if (journal->j_checkpoint_transactions == transaction && |
| 348 | transaction->t_tid == this_tid) { |
| 349 | int batch_count = 0; |
| 350 | struct buffer_head *bhs[NR_BATCH]; |
| 351 | struct journal_head *jh; |
Hidehiro Kawai | 4afe978 | 2008-10-22 14:15:00 -0700 | [diff] [blame^] | 352 | int retry = 0, err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 354 | while (!retry && transaction->t_checkpoint_list) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | struct buffer_head *bh; |
| 356 | |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 357 | jh = transaction->t_checkpoint_list; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | bh = jh2bh(jh); |
| 359 | if (!jbd_trylock_bh_state(bh)) { |
| 360 | jbd_sync_bh(journal, bh); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | retry = 1; |
| 362 | break; |
| 363 | } |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 364 | retry = __process_buffer(journal, jh, bhs,&batch_count); |
Hidehiro Kawai | 4afe978 | 2008-10-22 14:15:00 -0700 | [diff] [blame^] | 365 | if (retry < 0 && !result) |
| 366 | result = retry; |
Nick Piggin | 95c354f | 2008-01-30 13:31:20 +0100 | [diff] [blame] | 367 | if (!retry && (need_resched() || |
| 368 | spin_needbreak(&journal->j_list_lock))) { |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 369 | spin_unlock(&journal->j_list_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 370 | retry = 1; |
| 371 | break; |
| 372 | } |
Jan Kara | f93ea41 | 2006-01-06 00:19:55 -0800 | [diff] [blame] | 373 | } |
| 374 | |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 375 | if (batch_count) { |
| 376 | if (!retry) { |
| 377 | spin_unlock(&journal->j_list_lock); |
| 378 | retry = 1; |
| 379 | } |
| 380 | __flush_batch(journal, bhs, &batch_count); |
| 381 | } |
| 382 | |
| 383 | if (retry) { |
| 384 | spin_lock(&journal->j_list_lock); |
| 385 | goto restart; |
| 386 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 387 | /* |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 388 | * Now we have cleaned up the first transaction's checkpoint |
| 389 | * list. Let's clean up the second one |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | */ |
Hidehiro Kawai | 4afe978 | 2008-10-22 14:15:00 -0700 | [diff] [blame^] | 391 | err = __wait_cp_io(journal, transaction); |
| 392 | if (!result) |
| 393 | result = err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 394 | } |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 395 | out: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | spin_unlock(&journal->j_list_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 397 | if (result < 0) |
Hidehiro Kawai | 4afe978 | 2008-10-22 14:15:00 -0700 | [diff] [blame^] | 398 | journal_abort(journal, result); |
| 399 | else |
| 400 | result = cleanup_journal_tail(journal); |
| 401 | |
| 402 | return (result < 0) ? result : 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | } |
| 404 | |
| 405 | /* |
| 406 | * Check the list of checkpoint transactions for the journal to see if |
| 407 | * we have already got rid of any since the last update of the log tail |
| 408 | * in the journal superblock. If so, we can instantly roll the |
| 409 | * superblock forward to remove those transactions from the log. |
Mingming Cao | ae6ddcc | 2006-09-27 01:49:27 -0700 | [diff] [blame] | 410 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 411 | * Return <0 on error, 0 on success, 1 if there was nothing to clean up. |
Mingming Cao | ae6ddcc | 2006-09-27 01:49:27 -0700 | [diff] [blame] | 412 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 413 | * Called with the journal lock held. |
| 414 | * |
| 415 | * This is the only part of the journaling code which really needs to be |
| 416 | * aware of transaction aborts. Checkpointing involves writing to the |
| 417 | * main filesystem area rather than to the journal, so it can proceed |
Hidehiro Kawai | 4afe978 | 2008-10-22 14:15:00 -0700 | [diff] [blame^] | 418 | * even in abort state, but we must not update the super block if |
| 419 | * checkpointing may have failed. Otherwise, we would lose some metadata |
| 420 | * buffers which should be written-back to the filesystem. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 421 | */ |
| 422 | |
| 423 | int cleanup_journal_tail(journal_t *journal) |
| 424 | { |
| 425 | transaction_t * transaction; |
| 426 | tid_t first_tid; |
| 427 | unsigned long blocknr, freed; |
| 428 | |
Hidehiro Kawai | 4afe978 | 2008-10-22 14:15:00 -0700 | [diff] [blame^] | 429 | if (is_journal_aborted(journal)) |
| 430 | return 1; |
| 431 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 432 | /* OK, work out the oldest transaction remaining in the log, and |
Mingming Cao | ae6ddcc | 2006-09-27 01:49:27 -0700 | [diff] [blame] | 433 | * the log block it starts at. |
| 434 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 435 | * If the log is now empty, we need to work out which is the |
| 436 | * next transaction ID we will write, and where it will |
| 437 | * start. */ |
| 438 | |
| 439 | spin_lock(&journal->j_state_lock); |
| 440 | spin_lock(&journal->j_list_lock); |
| 441 | transaction = journal->j_checkpoint_transactions; |
| 442 | if (transaction) { |
| 443 | first_tid = transaction->t_tid; |
| 444 | blocknr = transaction->t_log_start; |
| 445 | } else if ((transaction = journal->j_committing_transaction) != NULL) { |
| 446 | first_tid = transaction->t_tid; |
| 447 | blocknr = transaction->t_log_start; |
| 448 | } else if ((transaction = journal->j_running_transaction) != NULL) { |
| 449 | first_tid = transaction->t_tid; |
| 450 | blocknr = journal->j_head; |
| 451 | } else { |
| 452 | first_tid = journal->j_transaction_sequence; |
| 453 | blocknr = journal->j_head; |
| 454 | } |
| 455 | spin_unlock(&journal->j_list_lock); |
| 456 | J_ASSERT(blocknr != 0); |
| 457 | |
| 458 | /* If the oldest pinned transaction is at the tail of the log |
| 459 | already then there's not much we can do right now. */ |
| 460 | if (journal->j_tail_sequence == first_tid) { |
| 461 | spin_unlock(&journal->j_state_lock); |
| 462 | return 1; |
| 463 | } |
| 464 | |
| 465 | /* OK, update the superblock to recover the freed space. |
| 466 | * Physical blocks come first: have we wrapped beyond the end of |
| 467 | * the log? */ |
| 468 | freed = blocknr - journal->j_tail; |
| 469 | if (blocknr < journal->j_tail) |
| 470 | freed = freed + journal->j_last - journal->j_first; |
| 471 | |
| 472 | jbd_debug(1, |
| 473 | "Cleaning journal tail from %d to %d (offset %lu), " |
| 474 | "freeing %lu\n", |
| 475 | journal->j_tail_sequence, first_tid, blocknr, freed); |
| 476 | |
| 477 | journal->j_free += freed; |
| 478 | journal->j_tail_sequence = first_tid; |
| 479 | journal->j_tail = blocknr; |
| 480 | spin_unlock(&journal->j_state_lock); |
| 481 | if (!(journal->j_flags & JFS_ABORT)) |
| 482 | journal_update_superblock(journal, 1); |
| 483 | return 0; |
| 484 | } |
| 485 | |
| 486 | |
| 487 | /* Checkpoint list management */ |
| 488 | |
| 489 | /* |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 490 | * journal_clean_one_cp_list |
Jan Kara | f93ea41 | 2006-01-06 00:19:55 -0800 | [diff] [blame] | 491 | * |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 492 | * Find all the written-back checkpoint buffers in the given list and release them. |
Jan Kara | f93ea41 | 2006-01-06 00:19:55 -0800 | [diff] [blame] | 493 | * |
| 494 | * Called with the journal locked. |
| 495 | * Called with j_list_lock held. |
Mark Fasheh | 7c8903f | 2006-02-14 13:53:03 -0800 | [diff] [blame] | 496 | * Returns number of bufers reaped (for debug) |
Jan Kara | f93ea41 | 2006-01-06 00:19:55 -0800 | [diff] [blame] | 497 | */ |
| 498 | |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 499 | static int journal_clean_one_cp_list(struct journal_head *jh, int *released) |
| 500 | { |
| 501 | struct journal_head *last_jh; |
| 502 | struct journal_head *next_jh = jh; |
| 503 | int ret, freed = 0; |
| 504 | |
| 505 | *released = 0; |
| 506 | if (!jh) |
| 507 | return 0; |
| 508 | |
Dave Kleikamp | e9ad562 | 2006-09-27 01:49:35 -0700 | [diff] [blame] | 509 | last_jh = jh->b_cpprev; |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 510 | do { |
| 511 | jh = next_jh; |
| 512 | next_jh = jh->b_cpnext; |
| 513 | /* Use trylock because of the ranking */ |
| 514 | if (jbd_trylock_bh_state(jh2bh(jh))) { |
| 515 | ret = __try_to_free_cp_buf(jh); |
| 516 | if (ret) { |
| 517 | freed++; |
| 518 | if (ret == 2) { |
| 519 | *released = 1; |
| 520 | return freed; |
| 521 | } |
| 522 | } |
| 523 | } |
| 524 | /* |
| 525 | * This function only frees up some memory |
| 526 | * if possible so we dont have an obligation |
| 527 | * to finish processing. Bail out if preemption |
| 528 | * requested: |
| 529 | */ |
| 530 | if (need_resched()) |
| 531 | return freed; |
| 532 | } while (jh != last_jh); |
| 533 | |
| 534 | return freed; |
| 535 | } |
| 536 | |
| 537 | /* |
| 538 | * journal_clean_checkpoint_list |
| 539 | * |
| 540 | * Find all the written-back checkpoint buffers in the journal and release them. |
| 541 | * |
| 542 | * Called with the journal locked. |
| 543 | * Called with j_list_lock held. |
| 544 | * Returns number of buffers reaped (for debug) |
| 545 | */ |
| 546 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 547 | int __journal_clean_checkpoint_list(journal_t *journal) |
| 548 | { |
| 549 | transaction_t *transaction, *last_transaction, *next_transaction; |
Mark Fasheh | 7c8903f | 2006-02-14 13:53:03 -0800 | [diff] [blame] | 550 | int ret = 0; |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 551 | int released; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 552 | |
| 553 | transaction = journal->j_checkpoint_transactions; |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 554 | if (!transaction) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 555 | goto out; |
| 556 | |
| 557 | last_transaction = transaction->t_cpprev; |
| 558 | next_transaction = transaction; |
| 559 | do { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 560 | transaction = next_transaction; |
| 561 | next_transaction = transaction->t_cpnext; |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 562 | ret += journal_clean_one_cp_list(transaction-> |
| 563 | t_checkpoint_list, &released); |
| 564 | /* |
| 565 | * This function only frees up some memory if possible so we |
| 566 | * dont have an obligation to finish processing. Bail out if |
| 567 | * preemption requested: |
| 568 | */ |
| 569 | if (need_resched()) |
| 570 | goto out; |
| 571 | if (released) |
| 572 | continue; |
| 573 | /* |
| 574 | * It is essential that we are as careful as in the case of |
| 575 | * t_checkpoint_list with removing the buffer from the list as |
| 576 | * we can possibly see not yet submitted buffers on io_list |
| 577 | */ |
| 578 | ret += journal_clean_one_cp_list(transaction-> |
| 579 | t_checkpoint_io_list, &released); |
| 580 | if (need_resched()) |
| 581 | goto out; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 582 | } while (transaction != last_transaction); |
| 583 | out: |
| 584 | return ret; |
| 585 | } |
| 586 | |
Mingming Cao | ae6ddcc | 2006-09-27 01:49:27 -0700 | [diff] [blame] | 587 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 588 | * journal_remove_checkpoint: called after a buffer has been committed |
| 589 | * to disk (either by being write-back flushed to disk, or being |
| 590 | * committed to the log). |
| 591 | * |
| 592 | * We cannot safely clean a transaction out of the log until all of the |
| 593 | * buffer updates committed in that transaction have safely been stored |
| 594 | * elsewhere on disk. To achieve this, all of the buffers in a |
| 595 | * transaction need to be maintained on the transaction's checkpoint |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 596 | * lists until they have been rewritten, at which point this function is |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 597 | * called to remove the buffer from the existing transaction's |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 598 | * checkpoint lists. |
| 599 | * |
| 600 | * The function returns 1 if it frees the transaction, 0 otherwise. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 601 | * |
| 602 | * This function is called with the journal locked. |
| 603 | * This function is called with j_list_lock held. |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 604 | * This function is called with jbd_lock_bh_state(jh2bh(jh)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 605 | */ |
| 606 | |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 607 | int __journal_remove_checkpoint(struct journal_head *jh) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 608 | { |
| 609 | transaction_t *transaction; |
| 610 | journal_t *journal; |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 611 | int ret = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 612 | |
| 613 | JBUFFER_TRACE(jh, "entry"); |
| 614 | |
| 615 | if ((transaction = jh->b_cp_transaction) == NULL) { |
| 616 | JBUFFER_TRACE(jh, "not on transaction"); |
| 617 | goto out; |
| 618 | } |
| 619 | journal = transaction->t_journal; |
| 620 | |
| 621 | __buffer_unlink(jh); |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 622 | jh->b_cp_transaction = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 623 | |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 624 | if (transaction->t_checkpoint_list != NULL || |
| 625 | transaction->t_checkpoint_io_list != NULL) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 626 | goto out; |
| 627 | JBUFFER_TRACE(jh, "transaction has no more buffers"); |
| 628 | |
| 629 | /* |
| 630 | * There is one special case to worry about: if we have just pulled the |
Jan Kara | d4beaf4 | 2007-12-04 23:45:27 -0800 | [diff] [blame] | 631 | * buffer off a running or committing transaction's checkpoing list, |
| 632 | * then even if the checkpoint list is empty, the transaction obviously |
| 633 | * cannot be dropped! |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 634 | * |
Jan Kara | d4beaf4 | 2007-12-04 23:45:27 -0800 | [diff] [blame] | 635 | * The locking here around t_state is a bit sleazy. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 636 | * See the comment at the end of journal_commit_transaction(). |
| 637 | */ |
Jan Kara | d4beaf4 | 2007-12-04 23:45:27 -0800 | [diff] [blame] | 638 | if (transaction->t_state != T_FINISHED) { |
| 639 | JBUFFER_TRACE(jh, "belongs to running/committing transaction"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 640 | goto out; |
| 641 | } |
| 642 | |
| 643 | /* OK, that was the last buffer for the transaction: we can now |
| 644 | safely remove this transaction from the log */ |
| 645 | |
| 646 | __journal_drop_transaction(journal, transaction); |
| 647 | |
| 648 | /* Just in case anybody was waiting for more transactions to be |
| 649 | checkpointed... */ |
| 650 | wake_up(&journal->j_wait_logspace); |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 651 | ret = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 652 | out: |
| 653 | JBUFFER_TRACE(jh, "exit"); |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 654 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 655 | } |
| 656 | |
| 657 | /* |
| 658 | * journal_insert_checkpoint: put a committed buffer onto a checkpoint |
| 659 | * list so that we know when it is safe to clean the transaction out of |
| 660 | * the log. |
| 661 | * |
| 662 | * Called with the journal locked. |
| 663 | * Called with j_list_lock held. |
| 664 | */ |
Mingming Cao | ae6ddcc | 2006-09-27 01:49:27 -0700 | [diff] [blame] | 665 | void __journal_insert_checkpoint(struct journal_head *jh, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 666 | transaction_t *transaction) |
| 667 | { |
| 668 | JBUFFER_TRACE(jh, "entry"); |
| 669 | J_ASSERT_JH(jh, buffer_dirty(jh2bh(jh)) || buffer_jbddirty(jh2bh(jh))); |
| 670 | J_ASSERT_JH(jh, jh->b_cp_transaction == NULL); |
| 671 | |
| 672 | jh->b_cp_transaction = transaction; |
| 673 | |
| 674 | if (!transaction->t_checkpoint_list) { |
| 675 | jh->b_cpnext = jh->b_cpprev = jh; |
| 676 | } else { |
| 677 | jh->b_cpnext = transaction->t_checkpoint_list; |
| 678 | jh->b_cpprev = transaction->t_checkpoint_list->b_cpprev; |
| 679 | jh->b_cpprev->b_cpnext = jh; |
| 680 | jh->b_cpnext->b_cpprev = jh; |
| 681 | } |
| 682 | transaction->t_checkpoint_list = jh; |
| 683 | } |
| 684 | |
| 685 | /* |
| 686 | * We've finished with this transaction structure: adios... |
Mingming Cao | ae6ddcc | 2006-09-27 01:49:27 -0700 | [diff] [blame] | 687 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 688 | * The transaction must have no links except for the checkpoint by this |
| 689 | * point. |
| 690 | * |
| 691 | * Called with the journal locked. |
| 692 | * Called with j_list_lock held. |
| 693 | */ |
| 694 | |
| 695 | void __journal_drop_transaction(journal_t *journal, transaction_t *transaction) |
| 696 | { |
| 697 | assert_spin_locked(&journal->j_list_lock); |
| 698 | if (transaction->t_cpnext) { |
| 699 | transaction->t_cpnext->t_cpprev = transaction->t_cpprev; |
| 700 | transaction->t_cpprev->t_cpnext = transaction->t_cpnext; |
| 701 | if (journal->j_checkpoint_transactions == transaction) |
| 702 | journal->j_checkpoint_transactions = |
| 703 | transaction->t_cpnext; |
| 704 | if (journal->j_checkpoint_transactions == transaction) |
| 705 | journal->j_checkpoint_transactions = NULL; |
| 706 | } |
| 707 | |
| 708 | J_ASSERT(transaction->t_state == T_FINISHED); |
| 709 | J_ASSERT(transaction->t_buffers == NULL); |
| 710 | J_ASSERT(transaction->t_sync_datalist == NULL); |
| 711 | J_ASSERT(transaction->t_forget == NULL); |
| 712 | J_ASSERT(transaction->t_iobuf_list == NULL); |
| 713 | J_ASSERT(transaction->t_shadow_list == NULL); |
| 714 | J_ASSERT(transaction->t_log_list == NULL); |
| 715 | J_ASSERT(transaction->t_checkpoint_list == NULL); |
Jan Kara | 78ce89c | 2006-06-23 02:06:05 -0700 | [diff] [blame] | 716 | J_ASSERT(transaction->t_checkpoint_io_list == NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 717 | J_ASSERT(transaction->t_updates == 0); |
| 718 | J_ASSERT(journal->j_committing_transaction != transaction); |
| 719 | J_ASSERT(journal->j_running_transaction != transaction); |
| 720 | |
| 721 | jbd_debug(1, "Dropping transaction %d, all done\n", transaction->t_tid); |
| 722 | kfree(transaction); |
| 723 | } |