diff options
author | Dmitry Monakhov <dmonakhov@openvz.org> | 2010-02-02 08:05:51 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2010-03-04 18:20:20 -0500 |
commit | e3c9643597ac4bd6b5db62b5e7d915f8c8fa34b6 (patch) | |
tree | 6b48a883406072c3f22218544a8c679271f5e44d | |
parent | 9df93939b735dd273e49cbee290b9f4738500ef4 (diff) |
ext3: mount flags manipulation cleanup
Replace intermediate EXT3_MOUNT_XXX flags manipulation to
corresponding macro.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r-- | fs/ext3/super.c | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index afa2b569da10..7950ff6ec4e8 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -181,7 +181,7 @@ static void ext3_handle_error(struct super_block *sb) | |||
181 | if (!test_opt (sb, ERRORS_CONT)) { | 181 | if (!test_opt (sb, ERRORS_CONT)) { |
182 | journal_t *journal = EXT3_SB(sb)->s_journal; | 182 | journal_t *journal = EXT3_SB(sb)->s_journal; |
183 | 183 | ||
184 | EXT3_SB(sb)->s_mount_opt |= EXT3_MOUNT_ABORT; | 184 | set_opt(EXT3_SB(sb)->s_mount_opt, ABORT); |
185 | if (journal) | 185 | if (journal) |
186 | journal_abort(journal, -EIO); | 186 | journal_abort(journal, -EIO); |
187 | } | 187 | } |
@@ -296,7 +296,7 @@ void ext3_abort (struct super_block * sb, const char * function, | |||
296 | "error: remounting filesystem read-only"); | 296 | "error: remounting filesystem read-only"); |
297 | EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; | 297 | EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; |
298 | sb->s_flags |= MS_RDONLY; | 298 | sb->s_flags |= MS_RDONLY; |
299 | EXT3_SB(sb)->s_mount_opt |= EXT3_MOUNT_ABORT; | 299 | set_opt(EXT3_SB(sb)->s_mount_opt, ABORT); |
300 | if (EXT3_SB(sb)->s_journal) | 300 | if (EXT3_SB(sb)->s_journal) |
301 | journal_abort(EXT3_SB(sb)->s_journal, -EIO); | 301 | journal_abort(EXT3_SB(sb)->s_journal, -EIO); |
302 | } | 302 | } |
@@ -562,10 +562,10 @@ static inline void ext3_show_quota_options(struct seq_file *seq, struct super_bl | |||
562 | if (sbi->s_qf_names[GRPQUOTA]) | 562 | if (sbi->s_qf_names[GRPQUOTA]) |
563 | seq_printf(seq, ",grpjquota=%s", sbi->s_qf_names[GRPQUOTA]); | 563 | seq_printf(seq, ",grpjquota=%s", sbi->s_qf_names[GRPQUOTA]); |
564 | 564 | ||
565 | if (sbi->s_mount_opt & EXT3_MOUNT_USRQUOTA) | 565 | if (test_opt(sb, USRQUOTA)) |
566 | seq_puts(seq, ",usrquota"); | 566 | seq_puts(seq, ",usrquota"); |
567 | 567 | ||
568 | if (sbi->s_mount_opt & EXT3_MOUNT_GRPQUOTA) | 568 | if (test_opt(sb, GRPQUOTA)) |
569 | seq_puts(seq, ",grpquota"); | 569 | seq_puts(seq, ",grpquota"); |
570 | #endif | 570 | #endif |
571 | } | 571 | } |
@@ -656,8 +656,7 @@ static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
656 | if (test_opt(sb, NOBH)) | 656 | if (test_opt(sb, NOBH)) |
657 | seq_puts(seq, ",nobh"); | 657 | seq_puts(seq, ",nobh"); |
658 | 658 | ||
659 | seq_printf(seq, ",data=%s", data_mode_string(sbi->s_mount_opt & | 659 | seq_printf(seq, ",data=%s", data_mode_string(test_opt(sb, DATA_FLAGS))); |
660 | EXT3_MOUNT_DATA_FLAGS)); | ||
661 | if (test_opt(sb, DATA_ERR_ABORT)) | 660 | if (test_opt(sb, DATA_ERR_ABORT)) |
662 | seq_puts(seq, ",data_err=abort"); | 661 | seq_puts(seq, ",data_err=abort"); |
663 | 662 | ||
@@ -1065,20 +1064,19 @@ static int parse_options (char *options, struct super_block *sb, | |||
1065 | data_opt = EXT3_MOUNT_WRITEBACK_DATA; | 1064 | data_opt = EXT3_MOUNT_WRITEBACK_DATA; |
1066 | datacheck: | 1065 | datacheck: |
1067 | if (is_remount) { | 1066 | if (is_remount) { |
1068 | if ((sbi->s_mount_opt & EXT3_MOUNT_DATA_FLAGS) | 1067 | if (test_opt(sb, DATA_FLAGS) == data_opt) |
1069 | == data_opt) | ||
1070 | break; | 1068 | break; |
1071 | ext3_msg(sb, KERN_ERR, | 1069 | ext3_msg(sb, KERN_ERR, |
1072 | "error: cannot change " | 1070 | "error: cannot change " |
1073 | "data mode on remount. The filesystem " | 1071 | "data mode on remount. The filesystem " |
1074 | "is mounted in data=%s mode and you " | 1072 | "is mounted in data=%s mode and you " |
1075 | "try to remount it in data=%s mode.", | 1073 | "try to remount it in data=%s mode.", |
1076 | data_mode_string(sbi->s_mount_opt & | 1074 | data_mode_string(test_opt(sb, |
1077 | EXT3_MOUNT_DATA_FLAGS), | 1075 | DATA_FLAGS)), |
1078 | data_mode_string(data_opt)); | 1076 | data_mode_string(data_opt)); |
1079 | return 0; | 1077 | return 0; |
1080 | } else { | 1078 | } else { |
1081 | sbi->s_mount_opt &= ~EXT3_MOUNT_DATA_FLAGS; | 1079 | clear_opt(sbi->s_mount_opt, DATA_FLAGS); |
1082 | sbi->s_mount_opt |= data_opt; | 1080 | sbi->s_mount_opt |= data_opt; |
1083 | } | 1081 | } |
1084 | break; | 1082 | break; |
@@ -1244,18 +1242,13 @@ set_qf_format: | |||
1244 | } | 1242 | } |
1245 | #ifdef CONFIG_QUOTA | 1243 | #ifdef CONFIG_QUOTA |
1246 | if (sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) { | 1244 | if (sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) { |
1247 | if ((sbi->s_mount_opt & EXT3_MOUNT_USRQUOTA) && | 1245 | if (test_opt(sb, USRQUOTA) && sbi->s_qf_names[USRQUOTA]) |
1248 | sbi->s_qf_names[USRQUOTA]) | ||
1249 | clear_opt(sbi->s_mount_opt, USRQUOTA); | 1246 | clear_opt(sbi->s_mount_opt, USRQUOTA); |
1250 | 1247 | if (test_opt(sb, GRPQUOTA) && sbi->s_qf_names[GRPQUOTA]) | |
1251 | if ((sbi->s_mount_opt & EXT3_MOUNT_GRPQUOTA) && | ||
1252 | sbi->s_qf_names[GRPQUOTA]) | ||
1253 | clear_opt(sbi->s_mount_opt, GRPQUOTA); | 1248 | clear_opt(sbi->s_mount_opt, GRPQUOTA); |
1254 | 1249 | ||
1255 | if ((sbi->s_qf_names[USRQUOTA] && | 1250 | if ((sbi->s_qf_names[USRQUOTA] && test_opt(sb, GRPQUOTA)) || |
1256 | (sbi->s_mount_opt & EXT3_MOUNT_GRPQUOTA)) || | 1251 | (sbi->s_qf_names[GRPQUOTA] && test_opt(sb, USRQUOTA))) { |
1257 | (sbi->s_qf_names[GRPQUOTA] && | ||
1258 | (sbi->s_mount_opt & EXT3_MOUNT_USRQUOTA))) { | ||
1259 | ext3_msg(sb, KERN_ERR, "error: old and new quota " | 1252 | ext3_msg(sb, KERN_ERR, "error: old and new quota " |
1260 | "format mixing."); | 1253 | "format mixing."); |
1261 | return 0; | 1254 | return 0; |
@@ -1671,11 +1664,11 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1671 | set_opt(sbi->s_mount_opt, POSIX_ACL); | 1664 | set_opt(sbi->s_mount_opt, POSIX_ACL); |
1672 | #endif | 1665 | #endif |
1673 | if ((def_mount_opts & EXT3_DEFM_JMODE) == EXT3_DEFM_JMODE_DATA) | 1666 | if ((def_mount_opts & EXT3_DEFM_JMODE) == EXT3_DEFM_JMODE_DATA) |
1674 | sbi->s_mount_opt |= EXT3_MOUNT_JOURNAL_DATA; | 1667 | set_opt(sbi->s_mount_opt, JOURNAL_DATA); |
1675 | else if ((def_mount_opts & EXT3_DEFM_JMODE) == EXT3_DEFM_JMODE_ORDERED) | 1668 | else if ((def_mount_opts & EXT3_DEFM_JMODE) == EXT3_DEFM_JMODE_ORDERED) |
1676 | sbi->s_mount_opt |= EXT3_MOUNT_ORDERED_DATA; | 1669 | set_opt(sbi->s_mount_opt, ORDERED_DATA); |
1677 | else if ((def_mount_opts & EXT3_DEFM_JMODE) == EXT3_DEFM_JMODE_WBACK) | 1670 | else if ((def_mount_opts & EXT3_DEFM_JMODE) == EXT3_DEFM_JMODE_WBACK) |
1678 | sbi->s_mount_opt |= EXT3_MOUNT_WRITEBACK_DATA; | 1671 | set_opt(sbi->s_mount_opt, WRITEBACK_DATA); |
1679 | 1672 | ||
1680 | if (le16_to_cpu(sbi->s_es->s_errors) == EXT3_ERRORS_PANIC) | 1673 | if (le16_to_cpu(sbi->s_es->s_errors) == EXT3_ERRORS_PANIC) |
1681 | set_opt(sbi->s_mount_opt, ERRORS_PANIC); | 1674 | set_opt(sbi->s_mount_opt, ERRORS_PANIC); |
@@ -1694,7 +1687,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1694 | goto failed_mount; | 1687 | goto failed_mount; |
1695 | 1688 | ||
1696 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | | 1689 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | |
1697 | ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); | 1690 | (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); |
1698 | 1691 | ||
1699 | if (le32_to_cpu(es->s_rev_level) == EXT3_GOOD_OLD_REV && | 1692 | if (le32_to_cpu(es->s_rev_level) == EXT3_GOOD_OLD_REV && |
1700 | (EXT3_HAS_COMPAT_FEATURE(sb, ~0U) || | 1693 | (EXT3_HAS_COMPAT_FEATURE(sb, ~0U) || |
@@ -2561,11 +2554,11 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) | |||
2561 | goto restore_opts; | 2554 | goto restore_opts; |
2562 | } | 2555 | } |
2563 | 2556 | ||
2564 | if (sbi->s_mount_opt & EXT3_MOUNT_ABORT) | 2557 | if (test_opt(sb, ABORT)) |
2565 | ext3_abort(sb, __func__, "Abort forced by user"); | 2558 | ext3_abort(sb, __func__, "Abort forced by user"); |
2566 | 2559 | ||
2567 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | | 2560 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | |
2568 | ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); | 2561 | (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); |
2569 | 2562 | ||
2570 | es = sbi->s_es; | 2563 | es = sbi->s_es; |
2571 | 2564 | ||
@@ -2573,7 +2566,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) | |||
2573 | 2566 | ||
2574 | if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY) || | 2567 | if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY) || |
2575 | n_blocks_count > le32_to_cpu(es->s_blocks_count)) { | 2568 | n_blocks_count > le32_to_cpu(es->s_blocks_count)) { |
2576 | if (sbi->s_mount_opt & EXT3_MOUNT_ABORT) { | 2569 | if (test_opt(sb, ABORT)) { |
2577 | err = -EROFS; | 2570 | err = -EROFS; |
2578 | goto restore_opts; | 2571 | goto restore_opts; |
2579 | } | 2572 | } |