diff options
author | Sunil Mushran <Sunil.Mushran@oracle.com> | 2006-12-05 20:56:35 -0500 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2006-12-07 20:37:53 -0500 |
commit | c271c5c22b0a7ca45fda15f1f4d258bca36a5b94 (patch) | |
tree | 9803af515ecf1c101c4a5921d7407c66184147e1 /fs/ocfs2/journal.c | |
parent | c99767974ebd2a719d849fdeaaa1674456f5283f (diff) |
ocfs2: local mounts
This allows users to format an ocfs2 file system with a special flag,
OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT. When the file system sees this flag, it
will not use any cluster services, nor will it require a cluster
configuration, thus acting like a 'local' file system.
Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/journal.c')
-rw-r--r-- | fs/ocfs2/journal.c | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 1d7f4ab1e5ed..825cb0ae1b4c 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -144,8 +144,10 @@ handle_t *ocfs2_start_trans(struct ocfs2_super *osb, int max_buffs) | |||
144 | ocfs2_abort(osb->sb, "Detected aborted journal"); | 144 | ocfs2_abort(osb->sb, "Detected aborted journal"); |
145 | handle = ERR_PTR(-EROFS); | 145 | handle = ERR_PTR(-EROFS); |
146 | } | 146 | } |
147 | } else | 147 | } else { |
148 | atomic_inc(&(osb->journal->j_num_trans)); | 148 | if (!ocfs2_mount_local(osb)) |
149 | atomic_inc(&(osb->journal->j_num_trans)); | ||
150 | } | ||
149 | 151 | ||
150 | return handle; | 152 | return handle; |
151 | } | 153 | } |
@@ -507,9 +509,23 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) | |||
507 | 509 | ||
508 | BUG_ON(atomic_read(&(osb->journal->j_num_trans)) != 0); | 510 | BUG_ON(atomic_read(&(osb->journal->j_num_trans)) != 0); |
509 | 511 | ||
510 | status = ocfs2_journal_toggle_dirty(osb, 0); | 512 | if (ocfs2_mount_local(osb)) { |
511 | if (status < 0) | 513 | journal_lock_updates(journal->j_journal); |
512 | mlog_errno(status); | 514 | status = journal_flush(journal->j_journal); |
515 | journal_unlock_updates(journal->j_journal); | ||
516 | if (status < 0) | ||
517 | mlog_errno(status); | ||
518 | } | ||
519 | |||
520 | if (status == 0) { | ||
521 | /* | ||
522 | * Do not toggle if flush was unsuccessful otherwise | ||
523 | * will leave dirty metadata in a "clean" journal | ||
524 | */ | ||
525 | status = ocfs2_journal_toggle_dirty(osb, 0); | ||
526 | if (status < 0) | ||
527 | mlog_errno(status); | ||
528 | } | ||
513 | 529 | ||
514 | /* Shutdown the kernel journal system */ | 530 | /* Shutdown the kernel journal system */ |
515 | journal_destroy(journal->j_journal); | 531 | journal_destroy(journal->j_journal); |
@@ -549,7 +565,7 @@ static void ocfs2_clear_journal_error(struct super_block *sb, | |||
549 | } | 565 | } |
550 | } | 566 | } |
551 | 567 | ||
552 | int ocfs2_journal_load(struct ocfs2_journal *journal) | 568 | int ocfs2_journal_load(struct ocfs2_journal *journal, int local) |
553 | { | 569 | { |
554 | int status = 0; | 570 | int status = 0; |
555 | struct ocfs2_super *osb; | 571 | struct ocfs2_super *osb; |
@@ -576,14 +592,18 @@ int ocfs2_journal_load(struct ocfs2_journal *journal) | |||
576 | } | 592 | } |
577 | 593 | ||
578 | /* Launch the commit thread */ | 594 | /* Launch the commit thread */ |
579 | osb->commit_task = kthread_run(ocfs2_commit_thread, osb, "ocfs2cmt"); | 595 | if (!local) { |
580 | if (IS_ERR(osb->commit_task)) { | 596 | osb->commit_task = kthread_run(ocfs2_commit_thread, osb, |
581 | status = PTR_ERR(osb->commit_task); | 597 | "ocfs2cmt"); |
598 | if (IS_ERR(osb->commit_task)) { | ||
599 | status = PTR_ERR(osb->commit_task); | ||
600 | osb->commit_task = NULL; | ||
601 | mlog(ML_ERROR, "unable to launch ocfs2commit thread, " | ||
602 | "error=%d", status); | ||
603 | goto done; | ||
604 | } | ||
605 | } else | ||
582 | osb->commit_task = NULL; | 606 | osb->commit_task = NULL; |
583 | mlog(ML_ERROR, "unable to launch ocfs2commit thread, error=%d", | ||
584 | status); | ||
585 | goto done; | ||
586 | } | ||
587 | 607 | ||
588 | done: | 608 | done: |
589 | mlog_exit(status); | 609 | mlog_exit(status); |