diff options
author | Chengguang Xu <cgxu519@zoho.com.cn> | 2019-05-20 01:45:03 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2019-05-20 04:50:48 -0400 |
commit | 38fa0e8e4a3b932791443db033ca7c4ed1bace0e (patch) | |
tree | 3c15ccfd1f48286887a4340a190db5ba71385bcf | |
parent | e15d92bee8184048e7419193263e62a0830cf365 (diff) |
ext2: code cleanup by using test_opt() and clear_opt()
Using test_opt() and clear_opt() instead of directly
comparing flag bit of mount option.
Signed-off-by: Chengguang Xu <cgxu519@zoho.com.cn>
Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r-- | fs/ext2/super.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 3988633789cb..ca7229c38fce 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -302,16 +302,16 @@ static int ext2_show_options(struct seq_file *seq, struct dentry *root) | |||
302 | if (test_opt(sb, NOBH)) | 302 | if (test_opt(sb, NOBH)) |
303 | seq_puts(seq, ",nobh"); | 303 | seq_puts(seq, ",nobh"); |
304 | 304 | ||
305 | if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA) | 305 | if (test_opt(sb, USRQUOTA)) |
306 | seq_puts(seq, ",usrquota"); | 306 | seq_puts(seq, ",usrquota"); |
307 | 307 | ||
308 | if (sbi->s_mount_opt & EXT2_MOUNT_GRPQUOTA) | 308 | if (test_opt(sb, GRPQUOTA)) |
309 | seq_puts(seq, ",grpquota"); | 309 | seq_puts(seq, ",grpquota"); |
310 | 310 | ||
311 | if (sbi->s_mount_opt & EXT2_MOUNT_XIP) | 311 | if (test_opt(sb, XIP)) |
312 | seq_puts(seq, ",xip"); | 312 | seq_puts(seq, ",xip"); |
313 | 313 | ||
314 | if (sbi->s_mount_opt & EXT2_MOUNT_DAX) | 314 | if (test_opt(sb, DAX)) |
315 | seq_puts(seq, ",dax"); | 315 | seq_puts(seq, ",dax"); |
316 | 316 | ||
317 | if (!test_opt(sb, RESERVATION)) | 317 | if (!test_opt(sb, RESERVATION)) |
@@ -934,8 +934,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
934 | sbi->s_resgid = opts.s_resgid; | 934 | sbi->s_resgid = opts.s_resgid; |
935 | 935 | ||
936 | sb->s_flags = (sb->s_flags & ~SB_POSIXACL) | | 936 | sb->s_flags = (sb->s_flags & ~SB_POSIXACL) | |
937 | ((EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? | 937 | (test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0); |
938 | SB_POSIXACL : 0); | ||
939 | sb->s_iflags |= SB_I_CGROUPWB; | 938 | sb->s_iflags |= SB_I_CGROUPWB; |
940 | 939 | ||
941 | if (le32_to_cpu(es->s_rev_level) == EXT2_GOOD_OLD_REV && | 940 | if (le32_to_cpu(es->s_rev_level) == EXT2_GOOD_OLD_REV && |
@@ -966,11 +965,11 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
966 | 965 | ||
967 | blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); | 966 | blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); |
968 | 967 | ||
969 | if (sbi->s_mount_opt & EXT2_MOUNT_DAX) { | 968 | if (test_opt(sb, DAX)) { |
970 | if (!bdev_dax_supported(sb->s_bdev, blocksize)) { | 969 | if (!bdev_dax_supported(sb->s_bdev, blocksize)) { |
971 | ext2_msg(sb, KERN_ERR, | 970 | ext2_msg(sb, KERN_ERR, |
972 | "DAX unsupported by block device. Turning off DAX."); | 971 | "DAX unsupported by block device. Turning off DAX."); |
973 | sbi->s_mount_opt &= ~EXT2_MOUNT_DAX; | 972 | clear_opt(sbi->s_mount_opt, DAX); |
974 | } | 973 | } |
975 | } | 974 | } |
976 | 975 | ||
@@ -1403,7 +1402,7 @@ out_set: | |||
1403 | sbi->s_resuid = new_opts.s_resuid; | 1402 | sbi->s_resuid = new_opts.s_resuid; |
1404 | sbi->s_resgid = new_opts.s_resgid; | 1403 | sbi->s_resgid = new_opts.s_resgid; |
1405 | sb->s_flags = (sb->s_flags & ~SB_POSIXACL) | | 1404 | sb->s_flags = (sb->s_flags & ~SB_POSIXACL) | |
1406 | ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? SB_POSIXACL : 0); | 1405 | (test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0); |
1407 | spin_unlock(&sbi->s_lock); | 1406 | spin_unlock(&sbi->s_lock); |
1408 | 1407 | ||
1409 | return 0; | 1408 | return 0; |