]> Pileus Git - ~andy/linux/blobdiff - fs/ext4/super.c
Merge branch 'topic/isa' into topic/misc
[~andy/linux] / fs / ext4 / super.c
index e046eba247820ee57bee3cb2590bdd28555aefde..8d65575f8c8c38a32c3ab358a1cb9a49a2760dc6 100644 (file)
@@ -241,7 +241,7 @@ handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks)
        if (sb->s_flags & MS_RDONLY)
                return ERR_PTR(-EROFS);
 
-       vfs_check_frozen(sb, SB_FREEZE_WRITE);
+       vfs_check_frozen(sb, SB_FREEZE_TRANS);
        /* Special case here: if the journal has aborted behind our
         * backs (eg. EIO in the commit thread), then we still need to
         * take the FS itself readonly cleanly. */
@@ -1003,10 +1003,10 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
                seq_puts(seq, ",journal_checksum");
        if (test_opt(sb, I_VERSION))
                seq_puts(seq, ",i_version");
-       if (!test_opt(sb, DELALLOC))
+       if (!test_opt(sb, DELALLOC) &&
+           !(def_mount_opts & EXT4_DEFM_NODELALLOC))
                seq_puts(seq, ",nodelalloc");
 
-
        if (sbi->s_stripe)
                seq_printf(seq, ",stripe=%lu", sbi->s_stripe);
        /*
@@ -1030,7 +1030,7 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
        if (test_opt(sb, NO_AUTO_DA_ALLOC))
                seq_puts(seq, ",noauto_da_alloc");
 
-       if (test_opt(sb, DISCARD))
+       if (test_opt(sb, DISCARD) && !(def_mount_opts & EXT4_DEFM_DISCARD))
                seq_puts(seq, ",discard");
 
        if (test_opt(sb, NOLOAD))
@@ -1039,6 +1039,10 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
        if (test_opt(sb, DIOREAD_NOLOCK))
                seq_puts(seq, ",dioread_nolock");
 
+       if (test_opt(sb, BLOCK_VALIDITY) &&
+           !(def_mount_opts & EXT4_DEFM_BLOCK_VALIDITY))
+               seq_puts(seq, ",block_validity");
+
        ext4_show_quota_options(seq, sb);
 
        return 0;
@@ -1118,6 +1122,7 @@ static int ext4_mark_dquot_dirty(struct dquot *dquot);
 static int ext4_write_info(struct super_block *sb, int type);
 static int ext4_quota_on(struct super_block *sb, int type, int format_id,
                                char *path);
+static int ext4_quota_off(struct super_block *sb, int type);
 static int ext4_quota_on_mount(struct super_block *sb, int type);
 static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
                               size_t len, loff_t off);
@@ -1139,7 +1144,7 @@ static const struct dquot_operations ext4_quota_operations = {
 
 static const struct quotactl_ops ext4_qctl_operations = {
        .quota_on       = ext4_quota_on,
-       .quota_off      = dquot_quota_off,
+       .quota_off      = ext4_quota_off,
        .quota_sync     = dquot_quota_sync,
        .get_info       = dquot_get_dqinfo,
        .set_info       = dquot_set_dqinfo,
@@ -2654,6 +2659,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
                set_opt(sbi->s_mount_opt, ERRORS_CONT);
        else
                set_opt(sbi->s_mount_opt, ERRORS_RO);
+       if (def_mount_opts & EXT4_DEFM_BLOCK_VALIDITY)
+               set_opt(sbi->s_mount_opt, BLOCK_VALIDITY);
+       if (def_mount_opts & EXT4_DEFM_DISCARD)
+               set_opt(sbi->s_mount_opt, DISCARD);
 
        sbi->s_resuid = le16_to_cpu(es->s_def_resuid);
        sbi->s_resgid = le16_to_cpu(es->s_def_resgid);
@@ -2661,15 +2670,23 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
        sbi->s_min_batch_time = EXT4_DEF_MIN_BATCH_TIME;
        sbi->s_max_batch_time = EXT4_DEF_MAX_BATCH_TIME;
 
-       set_opt(sbi->s_mount_opt, BARRIER);
+       if ((def_mount_opts & EXT4_DEFM_NOBARRIER) == 0)
+               set_opt(sbi->s_mount_opt, BARRIER);
 
        /*
         * enable delayed allocation by default
         * Use -o nodelalloc to turn it off
         */
-       if (!IS_EXT3_SB(sb))
+       if (!IS_EXT3_SB(sb) &&
+           ((def_mount_opts & EXT4_DEFM_NODELALLOC) == 0))
                set_opt(sbi->s_mount_opt, DELALLOC);
 
+       if (!parse_options((char *) sbi->s_es->s_mount_opts, sb,
+                          &journal_devnum, &journal_ioprio, NULL, 0)) {
+               ext4_msg(sb, KERN_WARNING,
+                        "failed to parse options in superblock: %s",
+                        sbi->s_es->s_mount_opts);
+       }
        if (!parse_options((char *) data, sb, &journal_devnum,
                           &journal_ioprio, NULL, 0))
                goto failed_mount;
@@ -3107,7 +3124,7 @@ no_journal:
        ext4_ext_init(sb);
        err = ext4_mb_init(sb, needs_recovery);
        if (err) {
-               ext4_msg(sb, KERN_ERR, "failed to initalize mballoc (%d)",
+               ext4_msg(sb, KERN_ERR, "failed to initialize mballoc (%d)",
                         err);
                goto failed_mount4;
        }
@@ -3140,7 +3157,8 @@ no_journal:
                descr = "out journal";
 
        ext4_msg(sb, KERN_INFO, "mounted filesystem with%s. "
-               "Opts: %s", descr, orig_data);
+                "Opts: %s%s%s", descr, sbi->s_es->s_mount_opts,
+                *sbi->s_es->s_mount_opts ? "; " : "", orig_data);
 
        init_timer(&sbi->s_err_report);
        sbi->s_err_report.function = print_daily_error_info;
@@ -3214,7 +3232,7 @@ static void ext4_init_journal_params(struct super_block *sb, journal_t *journal)
        journal->j_min_batch_time = sbi->s_min_batch_time;
        journal->j_max_batch_time = sbi->s_max_batch_time;
 
-       spin_lock(&journal->j_state_lock);
+       write_lock(&journal->j_state_lock);
        if (test_opt(sb, BARRIER))
                journal->j_flags |= JBD2_BARRIER;
        else
@@ -3223,7 +3241,7 @@ static void ext4_init_journal_params(struct super_block *sb, journal_t *journal)
                journal->j_flags |= JBD2_ABORT_ON_SYNCDATA_ERR;
        else
                journal->j_flags &= ~JBD2_ABORT_ON_SYNCDATA_ERR;
-       spin_unlock(&journal->j_state_lock);
+       write_unlock(&journal->j_state_lock);
 }
 
 static journal_t *ext4_get_journal(struct super_block *sb,
@@ -3608,7 +3626,7 @@ int ext4_force_commit(struct super_block *sb)
 
        journal = EXT4_SB(sb)->s_journal;
        if (journal) {
-               vfs_check_frozen(sb, SB_FREEZE_WRITE);
+               vfs_check_frozen(sb, SB_FREEZE_TRANS);
                ret = ext4_journal_force_commit(journal);
        }
 
@@ -4098,6 +4116,18 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
        return err;
 }
 
+static int ext4_quota_off(struct super_block *sb, int type)
+{
+       /* Force all delayed allocation blocks to be allocated */
+       if (test_opt(sb, DELALLOC)) {
+               down_read(&sb->s_umount);
+               sync_filesystem(sb);
+               up_read(&sb->s_umount);
+       }
+
+       return dquot_quota_off(sb, type);
+}
+
 /* Read data from quotafile - avoid pagecache and such because we cannot afford
  * acquiring the locks... As quota files are never truncated and quota code
  * itself serializes the operations (and noone else should touch the files)