diff options
Diffstat (limited to 'fs/jbd/recovery.c')
-rw-r--r-- | fs/jbd/recovery.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/fs/jbd/recovery.c b/fs/jbd/recovery.c index de5bafb4e853..73bb64806ed3 100644 --- a/fs/jbd/recovery.c +++ b/fs/jbd/recovery.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/recovery.c | 2 | * linux/fs/recovery.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-2000 Red Hat Software --- All Rights Reserved | 6 | * Copyright 1999-2000 Red Hat Software --- All Rights Reserved |
@@ -10,7 +10,7 @@ | |||
10 | * option, any later version, incorporated herein by reference. | 10 | * option, any later version, incorporated herein by reference. |
11 | * | 11 | * |
12 | * Journal recovery routines for the generic filesystem journaling code; | 12 | * Journal recovery routines for the generic filesystem journaling code; |
13 | * part of the ext2fs journaling system. | 13 | * part of the ext2fs journaling system. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #ifndef __KERNEL__ | 16 | #ifndef __KERNEL__ |
@@ -25,9 +25,9 @@ | |||
25 | 25 | ||
26 | /* | 26 | /* |
27 | * Maintain information about the progress of the recovery job, so that | 27 | * Maintain information about the progress of the recovery job, so that |
28 | * the different passes can carry information between them. | 28 | * the different passes can carry information between them. |
29 | */ | 29 | */ |
30 | struct recovery_info | 30 | struct recovery_info |
31 | { | 31 | { |
32 | tid_t start_transaction; | 32 | tid_t start_transaction; |
33 | tid_t end_transaction; | 33 | tid_t end_transaction; |
@@ -116,7 +116,7 @@ static int do_readahead(journal_t *journal, unsigned int start) | |||
116 | err = 0; | 116 | err = 0; |
117 | 117 | ||
118 | failed: | 118 | failed: |
119 | if (nbufs) | 119 | if (nbufs) |
120 | journal_brelse_array(bufs, nbufs); | 120 | journal_brelse_array(bufs, nbufs); |
121 | return err; | 121 | return err; |
122 | } | 122 | } |
@@ -128,7 +128,7 @@ failed: | |||
128 | * Read a block from the journal | 128 | * Read a block from the journal |
129 | */ | 129 | */ |
130 | 130 | ||
131 | static int jread(struct buffer_head **bhp, journal_t *journal, | 131 | static int jread(struct buffer_head **bhp, journal_t *journal, |
132 | unsigned int offset) | 132 | unsigned int offset) |
133 | { | 133 | { |
134 | int err; | 134 | int err; |
@@ -212,14 +212,14 @@ do { \ | |||
212 | /** | 212 | /** |
213 | * journal_recover - recovers a on-disk journal | 213 | * journal_recover - recovers a on-disk journal |
214 | * @journal: the journal to recover | 214 | * @journal: the journal to recover |
215 | * | 215 | * |
216 | * The primary function for recovering the log contents when mounting a | 216 | * The primary function for recovering the log contents when mounting a |
217 | * journaled device. | 217 | * journaled device. |
218 | * | 218 | * |
219 | * Recovery is done in three passes. In the first pass, we look for the | 219 | * Recovery is done in three passes. In the first pass, we look for the |
220 | * end of the log. In the second, we assemble the list of revoke | 220 | * end of the log. In the second, we assemble the list of revoke |
221 | * blocks. In the third and final pass, we replay any un-revoked blocks | 221 | * blocks. In the third and final pass, we replay any un-revoked blocks |
222 | * in the log. | 222 | * in the log. |
223 | */ | 223 | */ |
224 | int journal_recover(journal_t *journal) | 224 | int journal_recover(journal_t *journal) |
225 | { | 225 | { |
@@ -231,10 +231,10 @@ int journal_recover(journal_t *journal) | |||
231 | memset(&info, 0, sizeof(info)); | 231 | memset(&info, 0, sizeof(info)); |
232 | sb = journal->j_superblock; | 232 | sb = journal->j_superblock; |
233 | 233 | ||
234 | /* | 234 | /* |
235 | * The journal superblock's s_start field (the current log head) | 235 | * The journal superblock's s_start field (the current log head) |
236 | * is always zero if, and only if, the journal was cleanly | 236 | * is always zero if, and only if, the journal was cleanly |
237 | * unmounted. | 237 | * unmounted. |
238 | */ | 238 | */ |
239 | 239 | ||
240 | if (!sb->s_start) { | 240 | if (!sb->s_start) { |
@@ -253,7 +253,7 @@ int journal_recover(journal_t *journal) | |||
253 | jbd_debug(0, "JBD: recovery, exit status %d, " | 253 | jbd_debug(0, "JBD: recovery, exit status %d, " |
254 | "recovered transactions %u to %u\n", | 254 | "recovered transactions %u to %u\n", |
255 | err, info.start_transaction, info.end_transaction); | 255 | err, info.start_transaction, info.end_transaction); |
256 | jbd_debug(0, "JBD: Replayed %d and revoked %d/%d blocks\n", | 256 | jbd_debug(0, "JBD: Replayed %d and revoked %d/%d blocks\n", |
257 | info.nr_replays, info.nr_revoke_hits, info.nr_revokes); | 257 | info.nr_replays, info.nr_revoke_hits, info.nr_revokes); |
258 | 258 | ||
259 | /* Restart the log at the next transaction ID, thus invalidating | 259 | /* Restart the log at the next transaction ID, thus invalidating |
@@ -268,15 +268,15 @@ int journal_recover(journal_t *journal) | |||
268 | /** | 268 | /** |
269 | * journal_skip_recovery - Start journal and wipe exiting records | 269 | * journal_skip_recovery - Start journal and wipe exiting records |
270 | * @journal: journal to startup | 270 | * @journal: journal to startup |
271 | * | 271 | * |
272 | * Locate any valid recovery information from the journal and set up the | 272 | * Locate any valid recovery information from the journal and set up the |
273 | * journal structures in memory to ignore it (presumably because the | 273 | * journal structures in memory to ignore it (presumably because the |
274 | * caller has evidence that it is out of date). | 274 | * caller has evidence that it is out of date). |
275 | * This function does'nt appear to be exorted.. | 275 | * This function does'nt appear to be exorted.. |
276 | * | 276 | * |
277 | * We perform one pass over the journal to allow us to tell the user how | 277 | * We perform one pass over the journal to allow us to tell the user how |
278 | * much recovery information is being erased, and to let us initialise | 278 | * much recovery information is being erased, and to let us initialise |
279 | * the journal transaction sequence numbers to the next unused ID. | 279 | * the journal transaction sequence numbers to the next unused ID. |
280 | */ | 280 | */ |
281 | int journal_skip_recovery(journal_t *journal) | 281 | int journal_skip_recovery(journal_t *journal) |
282 | { | 282 | { |
@@ -297,7 +297,7 @@ int journal_skip_recovery(journal_t *journal) | |||
297 | #ifdef CONFIG_JBD_DEBUG | 297 | #ifdef CONFIG_JBD_DEBUG |
298 | int dropped = info.end_transaction - be32_to_cpu(sb->s_sequence); | 298 | int dropped = info.end_transaction - be32_to_cpu(sb->s_sequence); |
299 | #endif | 299 | #endif |
300 | jbd_debug(0, | 300 | jbd_debug(0, |
301 | "JBD: ignoring %d transaction%s from the journal.\n", | 301 | "JBD: ignoring %d transaction%s from the journal.\n", |
302 | dropped, (dropped == 1) ? "" : "s"); | 302 | dropped, (dropped == 1) ? "" : "s"); |
303 | journal->j_transaction_sequence = ++info.end_transaction; | 303 | journal->j_transaction_sequence = ++info.end_transaction; |
@@ -324,10 +324,10 @@ static int do_one_pass(journal_t *journal, | |||
324 | MAX_BLOCKS_PER_DESC = ((journal->j_blocksize-sizeof(journal_header_t)) | 324 | MAX_BLOCKS_PER_DESC = ((journal->j_blocksize-sizeof(journal_header_t)) |
325 | / sizeof(journal_block_tag_t)); | 325 | / sizeof(journal_block_tag_t)); |
326 | 326 | ||
327 | /* | 327 | /* |
328 | * First thing is to establish what we expect to find in the log | 328 | * First thing is to establish what we expect to find in the log |
329 | * (in terms of transaction IDs), and where (in terms of log | 329 | * (in terms of transaction IDs), and where (in terms of log |
330 | * block offsets): query the superblock. | 330 | * block offsets): query the superblock. |
331 | */ | 331 | */ |
332 | 332 | ||
333 | sb = journal->j_superblock; | 333 | sb = journal->j_superblock; |
@@ -344,7 +344,7 @@ static int do_one_pass(journal_t *journal, | |||
344 | * Now we walk through the log, transaction by transaction, | 344 | * Now we walk through the log, transaction by transaction, |
345 | * making sure that each transaction has a commit block in the | 345 | * making sure that each transaction has a commit block in the |
346 | * expected place. Each complete transaction gets replayed back | 346 | * expected place. Each complete transaction gets replayed back |
347 | * into the main filesystem. | 347 | * into the main filesystem. |
348 | */ | 348 | */ |
349 | 349 | ||
350 | while (1) { | 350 | while (1) { |
@@ -379,8 +379,8 @@ static int do_one_pass(journal_t *journal, | |||
379 | next_log_block++; | 379 | next_log_block++; |
380 | wrap(journal, next_log_block); | 380 | wrap(journal, next_log_block); |
381 | 381 | ||
382 | /* What kind of buffer is it? | 382 | /* What kind of buffer is it? |
383 | * | 383 | * |
384 | * If it is a descriptor block, check that it has the | 384 | * If it is a descriptor block, check that it has the |
385 | * expected sequence number. Otherwise, we're all done | 385 | * expected sequence number. Otherwise, we're all done |
386 | * here. */ | 386 | * here. */ |
@@ -394,7 +394,7 @@ static int do_one_pass(journal_t *journal, | |||
394 | 394 | ||
395 | blocktype = be32_to_cpu(tmp->h_blocktype); | 395 | blocktype = be32_to_cpu(tmp->h_blocktype); |
396 | sequence = be32_to_cpu(tmp->h_sequence); | 396 | sequence = be32_to_cpu(tmp->h_sequence); |
397 | jbd_debug(3, "Found magic %d, sequence %d\n", | 397 | jbd_debug(3, "Found magic %d, sequence %d\n", |
398 | blocktype, sequence); | 398 | blocktype, sequence); |
399 | 399 | ||
400 | if (sequence != next_commit_ID) { | 400 | if (sequence != next_commit_ID) { |
@@ -438,7 +438,7 @@ static int do_one_pass(journal_t *journal, | |||
438 | /* Recover what we can, but | 438 | /* Recover what we can, but |
439 | * report failure at the end. */ | 439 | * report failure at the end. */ |
440 | success = err; | 440 | success = err; |
441 | printk (KERN_ERR | 441 | printk (KERN_ERR |
442 | "JBD: IO error %d recovering " | 442 | "JBD: IO error %d recovering " |
443 | "block %ld in log\n", | 443 | "block %ld in log\n", |
444 | err, io_block); | 444 | err, io_block); |
@@ -452,7 +452,7 @@ static int do_one_pass(journal_t *journal, | |||
452 | * revoked, then we're all done | 452 | * revoked, then we're all done |
453 | * here. */ | 453 | * here. */ |
454 | if (journal_test_revoke | 454 | if (journal_test_revoke |
455 | (journal, blocknr, | 455 | (journal, blocknr, |
456 | next_commit_ID)) { | 456 | next_commit_ID)) { |
457 | brelse(obh); | 457 | brelse(obh); |
458 | ++info->nr_revoke_hits; | 458 | ++info->nr_revoke_hits; |
@@ -465,7 +465,7 @@ static int do_one_pass(journal_t *journal, | |||
465 | blocknr, | 465 | blocknr, |
466 | journal->j_blocksize); | 466 | journal->j_blocksize); |
467 | if (nbh == NULL) { | 467 | if (nbh == NULL) { |
468 | printk(KERN_ERR | 468 | printk(KERN_ERR |
469 | "JBD: Out of memory " | 469 | "JBD: Out of memory " |
470 | "during recovery.\n"); | 470 | "during recovery.\n"); |
471 | err = -ENOMEM; | 471 | err = -ENOMEM; |
@@ -537,7 +537,7 @@ static int do_one_pass(journal_t *journal, | |||
537 | } | 537 | } |
538 | 538 | ||
539 | done: | 539 | done: |
540 | /* | 540 | /* |
541 | * We broke out of the log scan loop: either we came to the | 541 | * We broke out of the log scan loop: either we came to the |
542 | * known end of the log or we found an unexpected block in the | 542 | * known end of the log or we found an unexpected block in the |
543 | * log. If the latter happened, then we know that the "current" | 543 | * log. If the latter happened, then we know that the "current" |
@@ -567,7 +567,7 @@ static int do_one_pass(journal_t *journal, | |||
567 | 567 | ||
568 | /* Scan a revoke record, marking all blocks mentioned as revoked. */ | 568 | /* Scan a revoke record, marking all blocks mentioned as revoked. */ |
569 | 569 | ||
570 | static int scan_revoke_records(journal_t *journal, struct buffer_head *bh, | 570 | static int scan_revoke_records(journal_t *journal, struct buffer_head *bh, |
571 | tid_t sequence, struct recovery_info *info) | 571 | tid_t sequence, struct recovery_info *info) |
572 | { | 572 | { |
573 | journal_revoke_header_t *header; | 573 | journal_revoke_header_t *header; |