diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-19 02:58:40 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-19 20:05:52 -0500 |
commit | f50a4c8149cc135921a8a0476bff8e622f59aef9 (patch) | |
tree | eba1d25b71d85daf34153ffc1b1e8eaf8b83cccc /fs/nilfs2/super.c | |
parent | 050b4142c9f3cb3a213f254bd1a1fa1476800585 (diff) |
nilfs2: move recovery completion into load_nilfs function
Although mount recovery of nilfs is integrated in load_nilfs()
procedure, the completion of recovery was isolated from the procedure
and performed at the end of the fill_super routine.
This was somewhat confusing since the recovery is needed for the nilfs
object, not for a super block instance.
To resolve the inconsistency, this will integrate the recovery
completion into load_nilfs().
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/super.c')
-rw-r--r-- | fs/nilfs2/super.c | 39 |
1 files changed, 5 insertions, 34 deletions
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index f52616977ea0..990ead43a833 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -414,22 +414,6 @@ void nilfs_detach_checkpoint(struct nilfs_sb_info *sbi) | |||
414 | up_write(&nilfs->ns_super_sem); | 414 | up_write(&nilfs->ns_super_sem); |
415 | } | 415 | } |
416 | 416 | ||
417 | static int nilfs_mark_recovery_complete(struct nilfs_sb_info *sbi) | ||
418 | { | ||
419 | struct the_nilfs *nilfs = sbi->s_nilfs; | ||
420 | int err = 0; | ||
421 | |||
422 | down_write(&nilfs->ns_sem); | ||
423 | if (!(nilfs->ns_mount_state & NILFS_VALID_FS)) { | ||
424 | nilfs->ns_mount_state |= NILFS_VALID_FS; | ||
425 | err = nilfs_commit_super(sbi, 1); | ||
426 | if (likely(!err)) | ||
427 | printk(KERN_INFO "NILFS: recovery complete.\n"); | ||
428 | } | ||
429 | up_write(&nilfs->ns_sem); | ||
430 | return err; | ||
431 | } | ||
432 | |||
433 | static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf) | 417 | static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
434 | { | 418 | { |
435 | struct super_block *sb = dentry->d_sb; | 419 | struct super_block *sb = dentry->d_sb; |
@@ -649,9 +633,7 @@ static int nilfs_setup_super(struct nilfs_sb_info *sbi) | |||
649 | int mnt_count = le16_to_cpu(sbp->s_mnt_count); | 633 | int mnt_count = le16_to_cpu(sbp->s_mnt_count); |
650 | 634 | ||
651 | /* nilfs->sem must be locked by the caller. */ | 635 | /* nilfs->sem must be locked by the caller. */ |
652 | if (!(nilfs->ns_mount_state & NILFS_VALID_FS)) { | 636 | if (nilfs->ns_mount_state & NILFS_ERROR_FS) { |
653 | printk(KERN_WARNING "NILFS warning: mounting unchecked fs\n"); | ||
654 | } else if (nilfs->ns_mount_state & NILFS_ERROR_FS) { | ||
655 | printk(KERN_WARNING | 637 | printk(KERN_WARNING |
656 | "NILFS warning: mounting fs with errors\n"); | 638 | "NILFS warning: mounting fs with errors\n"); |
657 | #if 0 | 639 | #if 0 |
@@ -759,11 +741,10 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent, | |||
759 | sb->s_root = NULL; | 741 | sb->s_root = NULL; |
760 | sb->s_time_gran = 1; | 742 | sb->s_time_gran = 1; |
761 | 743 | ||
762 | if (!nilfs_loaded(nilfs)) { | 744 | err = load_nilfs(nilfs, sbi); |
763 | err = load_nilfs(nilfs, sbi); | 745 | if (err) |
764 | if (err) | 746 | goto failed_sbi; |
765 | goto failed_sbi; | 747 | |
766 | } | ||
767 | cno = nilfs_last_cno(nilfs); | 748 | cno = nilfs_last_cno(nilfs); |
768 | 749 | ||
769 | if (sb->s_flags & MS_RDONLY) { | 750 | if (sb->s_flags & MS_RDONLY) { |
@@ -831,12 +812,6 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent, | |||
831 | up_write(&nilfs->ns_sem); | 812 | up_write(&nilfs->ns_sem); |
832 | } | 813 | } |
833 | 814 | ||
834 | err = nilfs_mark_recovery_complete(sbi); | ||
835 | if (unlikely(err)) { | ||
836 | printk(KERN_ERR "NILFS: recovery failed.\n"); | ||
837 | goto failed_root; | ||
838 | } | ||
839 | |||
840 | down_write(&nilfs->ns_super_sem); | 815 | down_write(&nilfs->ns_super_sem); |
841 | if (!nilfs_test_opt(sbi, SNAPSHOT)) | 816 | if (!nilfs_test_opt(sbi, SNAPSHOT)) |
842 | nilfs->ns_current = sbi; | 817 | nilfs->ns_current = sbi; |
@@ -844,10 +819,6 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent, | |||
844 | 819 | ||
845 | return 0; | 820 | return 0; |
846 | 821 | ||
847 | failed_root: | ||
848 | dput(sb->s_root); | ||
849 | sb->s_root = NULL; | ||
850 | |||
851 | failed_segctor: | 822 | failed_segctor: |
852 | nilfs_detach_segment_constructor(sbi); | 823 | nilfs_detach_segment_constructor(sbi); |
853 | 824 | ||