diff options
Diffstat (limited to 'fs/jbd/checkpoint.c')
-rw-r--r-- | fs/jbd/checkpoint.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/fs/jbd/checkpoint.c b/fs/jbd/checkpoint.c index 47678a26c13b..0208cc7ac5d0 100644 --- a/fs/jbd/checkpoint.c +++ b/fs/jbd/checkpoint.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/checkpoint.c | 2 | * linux/fs/checkpoint.c |
3 | * | 3 | * |
4 | * Written by Stephen C. Tweedie <sct@redhat.com>, 1999 | 4 | * Written by Stephen C. Tweedie <sct@redhat.com>, 1999 |
5 | * | 5 | * |
6 | * Copyright 1999 Red Hat Software --- All Rights Reserved | 6 | * Copyright 1999 Red Hat Software --- All Rights Reserved |
@@ -9,8 +9,8 @@ | |||
9 | * the terms of the GNU General Public License, version 2, or at your | 9 | * the terms of the GNU General Public License, version 2, or at your |
10 | * option, any later version, incorporated herein by reference. | 10 | * option, any later version, incorporated herein by reference. |
11 | * | 11 | * |
12 | * Checkpoint routines for the generic filesystem journaling code. | 12 | * Checkpoint routines for the generic filesystem journaling code. |
13 | * Part of the ext2fs journaling system. | 13 | * Part of the ext2fs journaling system. |
14 | * | 14 | * |
15 | * Checkpointing is the process of ensuring that a section of the log is | 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 | 16 | * committed fully to disk, so that that portion of the log can be |
@@ -145,6 +145,7 @@ void __log_wait_for_space(journal_t *journal) | |||
145 | * jbd_unlock_bh_state(). | 145 | * jbd_unlock_bh_state(). |
146 | */ | 146 | */ |
147 | static void jbd_sync_bh(journal_t *journal, struct buffer_head *bh) | 147 | static void jbd_sync_bh(journal_t *journal, struct buffer_head *bh) |
148 | __releases(journal->j_list_lock) | ||
148 | { | 149 | { |
149 | get_bh(bh); | 150 | get_bh(bh); |
150 | spin_unlock(&journal->j_list_lock); | 151 | spin_unlock(&journal->j_list_lock); |
@@ -225,7 +226,7 @@ __flush_batch(journal_t *journal, struct buffer_head **bhs, int *batch_count) | |||
225 | * Try to flush one buffer from the checkpoint list to disk. | 226 | * Try to flush one buffer from the checkpoint list to disk. |
226 | * | 227 | * |
227 | * Return 1 if something happened which requires us to abort the current | 228 | * Return 1 if something happened which requires us to abort the current |
228 | * scan of the checkpoint list. | 229 | * scan of the checkpoint list. |
229 | * | 230 | * |
230 | * Called with j_list_lock held and drops it if 1 is returned | 231 | * Called with j_list_lock held and drops it if 1 is returned |
231 | * Called under jbd_lock_bh_state(jh2bh(jh)), and drops it | 232 | * Called under jbd_lock_bh_state(jh2bh(jh)), and drops it |
@@ -269,7 +270,7 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh, | |||
269 | * possibly block, while still holding the journal lock. | 270 | * possibly block, while still holding the journal lock. |
270 | * We cannot afford to let the transaction logic start | 271 | * We cannot afford to let the transaction logic start |
271 | * messing around with this buffer before we write it to | 272 | * messing around with this buffer before we write it to |
272 | * disk, as that would break recoverability. | 273 | * disk, as that would break recoverability. |
273 | */ | 274 | */ |
274 | BUFFER_TRACE(bh, "queue"); | 275 | BUFFER_TRACE(bh, "queue"); |
275 | get_bh(bh); | 276 | get_bh(bh); |
@@ -292,7 +293,7 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh, | |||
292 | * Perform an actual checkpoint. We take the first transaction on the | 293 | * Perform an actual checkpoint. We take the first transaction on the |
293 | * list of transactions to be checkpointed and send all its buffers | 294 | * list of transactions to be checkpointed and send all its buffers |
294 | * to disk. We submit larger chunks of data at once. | 295 | * to disk. We submit larger chunks of data at once. |
295 | * | 296 | * |
296 | * The journal should be locked before calling this function. | 297 | * The journal should be locked before calling this function. |
297 | */ | 298 | */ |
298 | int log_do_checkpoint(journal_t *journal) | 299 | int log_do_checkpoint(journal_t *journal) |
@@ -303,10 +304,10 @@ int log_do_checkpoint(journal_t *journal) | |||
303 | 304 | ||
304 | jbd_debug(1, "Start checkpoint\n"); | 305 | jbd_debug(1, "Start checkpoint\n"); |
305 | 306 | ||
306 | /* | 307 | /* |
307 | * First thing: if there are any transactions in the log which | 308 | * First thing: if there are any transactions in the log which |
308 | * don't need checkpointing, just eliminate them from the | 309 | * don't need checkpointing, just eliminate them from the |
309 | * journal straight away. | 310 | * journal straight away. |
310 | */ | 311 | */ |
311 | result = cleanup_journal_tail(journal); | 312 | result = cleanup_journal_tail(journal); |
312 | jbd_debug(1, "cleanup_journal_tail returned %d\n", result); | 313 | jbd_debug(1, "cleanup_journal_tail returned %d\n", result); |
@@ -384,9 +385,9 @@ out: | |||
384 | * we have already got rid of any since the last update of the log tail | 385 | * we have already got rid of any since the last update of the log tail |
385 | * in the journal superblock. If so, we can instantly roll the | 386 | * in the journal superblock. If so, we can instantly roll the |
386 | * superblock forward to remove those transactions from the log. | 387 | * superblock forward to remove those transactions from the log. |
387 | * | 388 | * |
388 | * Return <0 on error, 0 on success, 1 if there was nothing to clean up. | 389 | * Return <0 on error, 0 on success, 1 if there was nothing to clean up. |
389 | * | 390 | * |
390 | * Called with the journal lock held. | 391 | * Called with the journal lock held. |
391 | * | 392 | * |
392 | * This is the only part of the journaling code which really needs to be | 393 | * This is the only part of the journaling code which really needs to be |
@@ -403,8 +404,8 @@ int cleanup_journal_tail(journal_t *journal) | |||
403 | unsigned long blocknr, freed; | 404 | unsigned long blocknr, freed; |
404 | 405 | ||
405 | /* OK, work out the oldest transaction remaining in the log, and | 406 | /* OK, work out the oldest transaction remaining in the log, and |
406 | * the log block it starts at. | 407 | * the log block it starts at. |
407 | * | 408 | * |
408 | * If the log is now empty, we need to work out which is the | 409 | * If the log is now empty, we need to work out which is the |
409 | * next transaction ID we will write, and where it will | 410 | * next transaction ID we will write, and where it will |
410 | * start. */ | 411 | * start. */ |
@@ -479,7 +480,7 @@ static int journal_clean_one_cp_list(struct journal_head *jh, int *released) | |||
479 | if (!jh) | 480 | if (!jh) |
480 | return 0; | 481 | return 0; |
481 | 482 | ||
482 | last_jh = jh->b_cpprev; | 483 | last_jh = jh->b_cpprev; |
483 | do { | 484 | do { |
484 | jh = next_jh; | 485 | jh = next_jh; |
485 | next_jh = jh->b_cpnext; | 486 | next_jh = jh->b_cpnext; |
@@ -557,7 +558,7 @@ out: | |||
557 | return ret; | 558 | return ret; |
558 | } | 559 | } |
559 | 560 | ||
560 | /* | 561 | /* |
561 | * journal_remove_checkpoint: called after a buffer has been committed | 562 | * journal_remove_checkpoint: called after a buffer has been committed |
562 | * to disk (either by being write-back flushed to disk, or being | 563 | * to disk (either by being write-back flushed to disk, or being |
563 | * committed to the log). | 564 | * committed to the log). |
@@ -635,7 +636,7 @@ out: | |||
635 | * Called with the journal locked. | 636 | * Called with the journal locked. |
636 | * Called with j_list_lock held. | 637 | * Called with j_list_lock held. |
637 | */ | 638 | */ |
638 | void __journal_insert_checkpoint(struct journal_head *jh, | 639 | void __journal_insert_checkpoint(struct journal_head *jh, |
639 | transaction_t *transaction) | 640 | transaction_t *transaction) |
640 | { | 641 | { |
641 | JBUFFER_TRACE(jh, "entry"); | 642 | JBUFFER_TRACE(jh, "entry"); |
@@ -657,7 +658,7 @@ void __journal_insert_checkpoint(struct journal_head *jh, | |||
657 | 658 | ||
658 | /* | 659 | /* |
659 | * We've finished with this transaction structure: adios... | 660 | * We've finished with this transaction structure: adios... |
660 | * | 661 | * |
661 | * The transaction must have no links except for the checkpoint by this | 662 | * The transaction must have no links except for the checkpoint by this |
662 | * point. | 663 | * point. |
663 | * | 664 | * |