| 545 | * journal structures from from scratch, or loaded them from disk. */ |
| 546 | |
| 547 | static journal_t * journal_init_common (void) |
| 548 | { |
| 549 | journal_t *journal; |
| 550 | int err; |
| 551 | |
| 552 | journal = kzalloc(sizeof(*journal), GFP_KERNEL); |
| 553 | if (!journal) |
| 554 | goto fail; |
| 555 | |
| 556 | init_waitqueue_head(&journal->j_wait_transaction_locked); |
| 557 | init_waitqueue_head(&journal->j_wait_logspace); |
| 558 | init_waitqueue_head(&journal->j_wait_done_commit); |
| 559 | init_waitqueue_head(&journal->j_wait_checkpoint); |
| 560 | init_waitqueue_head(&journal->j_wait_commit); |
| 561 | init_waitqueue_head(&journal->j_wait_updates); |
| 562 | mutex_init(&journal->j_barrier); |
| 563 | mutex_init(&journal->j_checkpoint_mutex); |
| 564 | jbd_lock_init(&journal->j_revoke_lock); |
| 565 | jbd_lock_init(&journal->j_list_lock); |
| 566 | jbd_lock_init(&journal->j_state_lock); |
| 567 | |
| 568 | journal->j_commit_interval = (HZ * JBD_DEFAULT_MAX_COMMIT_AGE); |
| 569 | |
| 570 | /* The journal is marked for error until we succeed with recovery! */ |
| 571 | journal->j_flags = JFS_ABORT; |
| 572 | |
| 573 | /* Set up a default-sized revoke table for the new mount. */ |
| 574 | err = journal_init_revoke(journal, JOURNAL_REVOKE_DEFAULT_HASH); |
| 575 | if (err) { |
| 576 | kfree(journal); |
| 577 | goto fail; |
| 578 | } |
| 579 | return journal; |
| 580 | fail: |
| 581 | return NULL; |
| 582 | } |
| 583 | |
| 584 | /** |
| 585 | * journal_t * journal_init_inode () - creates a journal which maps to a inode. |
no test coverage detected