aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 710fed2377d4..f3c667091618 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -59,6 +59,7 @@ static struct kset *ext4_kset;
59static struct ext4_lazy_init *ext4_li_info; 59static struct ext4_lazy_init *ext4_li_info;
60static struct mutex ext4_li_mtx; 60static struct mutex ext4_li_mtx;
61static struct ext4_features *ext4_feat; 61static struct ext4_features *ext4_feat;
62static int ext4_mballoc_ready;
62 63
63static int ext4_load_journal(struct super_block *, struct ext4_super_block *, 64static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
64 unsigned long journal_devnum); 65 unsigned long journal_devnum);
@@ -845,6 +846,10 @@ static void ext4_put_super(struct super_block *sb)
845 invalidate_bdev(sbi->journal_bdev); 846 invalidate_bdev(sbi->journal_bdev);
846 ext4_blkdev_remove(sbi); 847 ext4_blkdev_remove(sbi);
847 } 848 }
849 if (sbi->s_mb_cache) {
850 ext4_xattr_destroy_cache(sbi->s_mb_cache);
851 sbi->s_mb_cache = NULL;
852 }
848 if (sbi->s_mmp_tsk) 853 if (sbi->s_mmp_tsk)
849 kthread_stop(sbi->s_mmp_tsk); 854 kthread_stop(sbi->s_mmp_tsk);
850 sb->s_fs_info = NULL; 855 sb->s_fs_info = NULL;
@@ -940,7 +945,7 @@ static void init_once(void *foo)
940 inode_init_once(&ei->vfs_inode); 945 inode_init_once(&ei->vfs_inode);
941} 946}
942 947
943static int init_inodecache(void) 948static int __init init_inodecache(void)
944{ 949{
945 ext4_inode_cachep = kmem_cache_create("ext4_inode_cache", 950 ext4_inode_cachep = kmem_cache_create("ext4_inode_cache",
946 sizeof(struct ext4_inode_info), 951 sizeof(struct ext4_inode_info),
@@ -3575,6 +3580,16 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3575 "feature flags set on rev 0 fs, " 3580 "feature flags set on rev 0 fs, "
3576 "running e2fsck is recommended"); 3581 "running e2fsck is recommended");
3577 3582
3583 if (es->s_creator_os == cpu_to_le32(EXT4_OS_HURD)) {
3584 set_opt2(sb, HURD_COMPAT);
3585 if (EXT4_HAS_INCOMPAT_FEATURE(sb,
3586 EXT4_FEATURE_INCOMPAT_64BIT)) {
3587 ext4_msg(sb, KERN_ERR,
3588 "The Hurd can't support 64-bit file systems");
3589 goto failed_mount;
3590 }
3591 }
3592
3578 if (IS_EXT2_SB(sb)) { 3593 if (IS_EXT2_SB(sb)) {
3579 if (ext2_feature_set_ok(sb)) 3594 if (ext2_feature_set_ok(sb))
3580 ext4_msg(sb, KERN_INFO, "mounting ext2 file system " 3595 ext4_msg(sb, KERN_INFO, "mounting ext2 file system "
@@ -4010,6 +4025,14 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
4010 percpu_counter_set(&sbi->s_dirtyclusters_counter, 0); 4025 percpu_counter_set(&sbi->s_dirtyclusters_counter, 0);
4011 4026
4012no_journal: 4027no_journal:
4028 if (ext4_mballoc_ready) {
4029 sbi->s_mb_cache = ext4_xattr_create_cache(sb->s_id);
4030 if (!sbi->s_mb_cache) {
4031 ext4_msg(sb, KERN_ERR, "Failed to create an mb_cache");
4032 goto failed_mount_wq;
4033 }
4034 }
4035
4013 /* 4036 /*
4014 * Get the # of file system overhead blocks from the 4037 * Get the # of file system overhead blocks from the
4015 * superblock if present. 4038 * superblock if present.
@@ -4835,6 +4858,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
4835 } 4858 }
4836 4859
4837 if (*flags & MS_RDONLY) { 4860 if (*flags & MS_RDONLY) {
4861 err = sync_filesystem(sb);
4862 if (err < 0)
4863 goto restore_opts;
4838 err = dquot_suspend(sb, -1); 4864 err = dquot_suspend(sb, -1);
4839 if (err < 0) 4865 if (err < 0)
4840 goto restore_opts; 4866 goto restore_opts;
@@ -5516,11 +5542,9 @@ static int __init ext4_init_fs(void)
5516 5542
5517 err = ext4_init_mballoc(); 5543 err = ext4_init_mballoc();
5518 if (err) 5544 if (err)
5519 goto out3;
5520
5521 err = ext4_init_xattr();
5522 if (err)
5523 goto out2; 5545 goto out2;
5546 else
5547 ext4_mballoc_ready = 1;
5524 err = init_inodecache(); 5548 err = init_inodecache();
5525 if (err) 5549 if (err)
5526 goto out1; 5550 goto out1;
@@ -5536,10 +5560,9 @@ out:
5536 unregister_as_ext3(); 5560 unregister_as_ext3();
5537 destroy_inodecache(); 5561 destroy_inodecache();
5538out1: 5562out1:
5539 ext4_exit_xattr(); 5563 ext4_mballoc_ready = 0;
5540out2:
5541 ext4_exit_mballoc(); 5564 ext4_exit_mballoc();
5542out3: 5565out2:
5543 ext4_exit_feat_adverts(); 5566 ext4_exit_feat_adverts();
5544out4: 5567out4:
5545 if (ext4_proc_root) 5568 if (ext4_proc_root)
@@ -5562,7 +5585,6 @@ static void __exit ext4_exit_fs(void)
5562 unregister_as_ext3(); 5585 unregister_as_ext3();
5563 unregister_filesystem(&ext4_fs_type); 5586 unregister_filesystem(&ext4_fs_type);
5564 destroy_inodecache(); 5587 destroy_inodecache();
5565 ext4_exit_xattr();
5566 ext4_exit_mballoc(); 5588 ext4_exit_mballoc();
5567 ext4_exit_feat_adverts(); 5589 ext4_exit_feat_adverts();
5568 remove_proc_entry("fs/ext4", NULL); 5590 remove_proc_entry("fs/ext4", NULL);