VFS: Convert sb->s_flags & MS_RDONLY to sb_rdonly(sb)

Firstly by applying the following with coccinelle's spatch:

@@ expression SB; @@
-SB->s_flags & MS_RDONLY
+sb_rdonly(SB)

to effect the conversion to sb_rdonly(sb), then by applying:

@@ expression A, SB; @@
(
-(!sb_rdonly(SB)) && A
+!sb_rdonly(SB) && A
|
-A != (sb_rdonly(SB))
+A != sb_rdonly(SB)
|
-A == (sb_rdonly(SB))
+A == sb_rdonly(SB)
|
-!(sb_rdonly(SB))
+!sb_rdonly(SB)
|
-A && (sb_rdonly(SB))
+A && sb_rdonly(SB)
|
-A || (sb_rdonly(SB))
+A || sb_rdonly(SB)
|
-(sb_rdonly(SB)) != A
+sb_rdonly(SB) != A
|
-(sb_rdonly(SB)) == A
+sb_rdonly(SB) == A
|
-(sb_rdonly(SB)) && A
+sb_rdonly(SB) && A
|
-(sb_rdonly(SB)) || A
+sb_rdonly(SB) || A
)

@@ expression A, B, SB; @@
(
-(sb_rdonly(SB)) ? 1 : 0
+sb_rdonly(SB)
|
-(sb_rdonly(SB)) ? A : B
+sb_rdonly(SB) ? A : B
)

to remove left over excess bracketage and finally by applying:

@@ expression A, SB; @@
(
-(A & MS_RDONLY) != sb_rdonly(SB)
+(bool)(A & MS_RDONLY) != sb_rdonly(SB)
|
-(A & MS_RDONLY) == sb_rdonly(SB)
+(bool)(A & MS_RDONLY) == sb_rdonly(SB)
)

to make comparisons against the result of sb_rdonly() (which is a bool)
work correctly.

Signed-off-by: David Howells <dhowells@redhat.com>

+210 -226
+2 -2
drivers/staging/lustre/lustre/llite/llite_lib.c
··· 210 210 data->ocd_ibits_known = MDS_INODELOCK_FULL; 211 211 data->ocd_version = LUSTRE_VERSION_CODE; 212 212 213 - if (sb->s_flags & MS_RDONLY) 213 + if (sb_rdonly(sb)) 214 214 data->ocd_connect_flags |= OBD_CONNECT_RDONLY; 215 215 if (sbi->ll_flags & LL_SBI_USER_XATTR) 216 216 data->ocd_connect_flags |= OBD_CONNECT_XATTR; ··· 2033 2033 int err; 2034 2034 __u32 read_only; 2035 2035 2036 - if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { 2036 + if ((bool)(*flags & MS_RDONLY) != sb_rdonly(sb)) { 2037 2037 read_only = *flags & MS_RDONLY; 2038 2038 err = obd_set_info_async(NULL, sbi->ll_md_exp, 2039 2039 sizeof(KEY_READ_ONLY),
+1 -2
drivers/staging/lustre/lustre/llite/namei.c
··· 562 562 } 563 563 } 564 564 565 - if (it->it_op & IT_OPEN && it->it_flags & FMODE_WRITE && 566 - dentry->d_sb->s_flags & MS_RDONLY) 565 + if (it->it_op & IT_OPEN && it->it_flags & FMODE_WRITE && sb_rdonly(dentry->d_sb)) 567 566 return ERR_PTR(-EROFS); 568 567 569 568 if (it->it_op & IT_CREAT)
+1 -1
fs/affs/amigaffs.c
··· 450 450 vaf.fmt = fmt; 451 451 vaf.va = &args; 452 452 pr_crit("error (device %s): %s(): %pV\n", sb->s_id, function, &vaf); 453 - if (!(sb->s_flags & MS_RDONLY)) 453 + if (!sb_rdonly(sb)) 454 454 pr_warn("Remounting filesystem read-only\n"); 455 455 sb->s_flags |= MS_RDONLY; 456 456 va_end(args);
+1 -1
fs/affs/bitmap.c
··· 19 19 20 20 pr_debug("%s()\n", __func__); 21 21 22 - if (sb->s_flags & MS_RDONLY) 22 + if (sb_rdonly(sb)) 23 23 return 0; 24 24 25 25 mutex_lock(&AFFS_SB(sb)->s_bmlock);
+3 -3
fs/affs/super.c
··· 80 80 struct affs_sb_info *sbi = AFFS_SB(sb); 81 81 unsigned long delay; 82 82 83 - if (sb->s_flags & MS_RDONLY) 83 + if (sb_rdonly(sb)) 84 84 return; 85 85 86 86 spin_lock(&sbi->work_lock); ··· 464 464 * not recommended. 465 465 */ 466 466 if ((chksum == FS_DCFFS || chksum == MUFS_DCFFS || chksum == FS_DCOFS 467 - || chksum == MUFS_DCOFS) && !(sb->s_flags & MS_RDONLY)) { 467 + || chksum == MUFS_DCOFS) && !sb_rdonly(sb)) { 468 468 pr_notice("Dircache FS - mounting %s read only\n", sb->s_id); 469 469 sb->s_flags |= MS_RDONLY; 470 470 } ··· 596 596 memcpy(sbi->s_volume, volume, 32); 597 597 spin_unlock(&sbi->symlink_lock); 598 598 599 - if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) 599 + if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) 600 600 return 0; 601 601 602 602 if (*flags & MS_RDONLY)
+1 -1
fs/befs/linuxvfs.c
··· 838 838 839 839 befs_debug(sb, "---> %s", __func__); 840 840 841 - if (!(sb->s_flags & MS_RDONLY)) { 841 + if (!sb_rdonly(sb)) { 842 842 befs_warning(sb, 843 843 "No write support. Marking filesystem read-only"); 844 844 sb->s_flags |= MS_RDONLY;
+1 -1
fs/btrfs/dev-replace.c
··· 690 690 u64 result; 691 691 int ret; 692 692 693 - if (fs_info->sb->s_flags & MS_RDONLY) 693 + if (sb_rdonly(fs_info->sb)) 694 694 return -EROFS; 695 695 696 696 mutex_lock(&dev_replace->lock_finishing_cancel_unmount);
+6 -6
fs/btrfs/disk-io.c
··· 2478 2478 return ret; 2479 2479 } 2480 2480 2481 - if (fs_info->sb->s_flags & MS_RDONLY) { 2481 + if (sb_rdonly(fs_info->sb)) { 2482 2482 ret = btrfs_commit_super(fs_info); 2483 2483 if (ret) 2484 2484 return ret; ··· 2874 2874 2875 2875 features = btrfs_super_compat_ro_flags(disk_super) & 2876 2876 ~BTRFS_FEATURE_COMPAT_RO_SUPP; 2877 - if (!(sb->s_flags & MS_RDONLY) && features) { 2877 + if (!sb_rdonly(sb) && features) { 2878 2878 btrfs_err(fs_info, 2879 2879 "cannot mount read-write because of unsupported optional features (%llx)", 2880 2880 features); ··· 3039 3039 btrfs_calc_num_tolerated_disk_barrier_failures(fs_info); 3040 3040 if (fs_info->fs_devices->missing_devices > 3041 3041 fs_info->num_tolerated_disk_barrier_failures && 3042 - !(sb->s_flags & MS_RDONLY)) { 3042 + !sb_rdonly(sb)) { 3043 3043 btrfs_warn(fs_info, 3044 3044 "missing devices (%llu) exceeds the limit (%d), writeable mount is not allowed", 3045 3045 fs_info->fs_devices->missing_devices, ··· 3102 3102 if (ret) 3103 3103 goto fail_qgroup; 3104 3104 3105 - if (!(sb->s_flags & MS_RDONLY)) { 3105 + if (!sb_rdonly(sb)) { 3106 3106 ret = btrfs_cleanup_fs_roots(fs_info); 3107 3107 if (ret) 3108 3108 goto fail_qgroup; ··· 3128 3128 goto fail_qgroup; 3129 3129 } 3130 3130 3131 - if (sb->s_flags & MS_RDONLY) 3131 + if (sb_rdonly(sb)) 3132 3132 return 0; 3133 3133 3134 3134 if (btrfs_test_opt(fs_info, CLEAR_CACHE) && ··· 3928 3928 3929 3929 cancel_work_sync(&fs_info->async_reclaim_work); 3930 3930 3931 - if (!(fs_info->sb->s_flags & MS_RDONLY)) { 3931 + if (!sb_rdonly(fs_info->sb)) { 3932 3932 /* 3933 3933 * If the cleaner thread is stopped and there are 3934 3934 * block groups queued for removal, the deletion will be
+2 -2
fs/btrfs/extent_io.c
··· 2061 2061 unsigned long i, num_pages = num_extent_pages(eb->start, eb->len); 2062 2062 int ret = 0; 2063 2063 2064 - if (fs_info->sb->s_flags & MS_RDONLY) 2064 + if (sb_rdonly(fs_info->sb)) 2065 2065 return -EROFS; 2066 2066 2067 2067 for (i = 0; i < num_pages; i++) { ··· 2111 2111 failrec->start); 2112 2112 goto out; 2113 2113 } 2114 - if (fs_info->sb->s_flags & MS_RDONLY) 2114 + if (sb_rdonly(fs_info->sb)) 2115 2115 goto out; 2116 2116 2117 2117 spin_lock(&io_tree->lock);
+1 -1
fs/btrfs/inode.c
··· 5817 5817 5818 5818 if (!IS_ERR(inode) && root != sub_root) { 5819 5819 down_read(&fs_info->cleanup_work_sem); 5820 - if (!(inode->i_sb->s_flags & MS_RDONLY)) 5820 + if (!sb_rdonly(inode->i_sb)) 5821 5821 ret = btrfs_orphan_cleanup(sub_root); 5822 5822 up_read(&fs_info->cleanup_work_sem); 5823 5823 if (ret) {
+1 -1
fs/btrfs/ioctl.c
··· 4438 4438 4439 4439 switch (p->cmd) { 4440 4440 case BTRFS_IOCTL_DEV_REPLACE_CMD_START: 4441 - if (fs_info->sb->s_flags & MS_RDONLY) { 4441 + if (sb_rdonly(fs_info->sb)) { 4442 4442 ret = -EROFS; 4443 4443 goto out; 4444 4444 }
+1 -1
fs/btrfs/root-tree.c
··· 228 228 int ret; 229 229 bool can_recover = true; 230 230 231 - if (fs_info->sb->s_flags & MS_RDONLY) 231 + if (sb_rdonly(fs_info->sb)) 232 232 can_recover = false; 233 233 234 234 path = btrfs_alloc_path();
+5 -6
fs/btrfs/super.c
··· 102 102 { 103 103 struct super_block *sb = fs_info->sb; 104 104 105 - if (sb->s_flags & MS_RDONLY) 105 + if (sb_rdonly(sb)) 106 106 return; 107 107 108 108 if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) { ··· 138 138 * Special case: if the error is EROFS, and we're already 139 139 * under MS_RDONLY, then it is safe here. 140 140 */ 141 - if (errno == -EROFS && (sb->s_flags & MS_RDONLY)) 141 + if (errno == -EROFS && sb_rdonly(sb)) 142 142 return; 143 143 144 144 #ifdef CONFIG_PRINTK ··· 1687 1687 * close or the filesystem is read only. 1688 1688 */ 1689 1689 if (btrfs_raw_test_opt(old_opts, AUTO_DEFRAG) && 1690 - (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || 1691 - (fs_info->sb->s_flags & MS_RDONLY))) { 1690 + (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || sb_rdonly(fs_info->sb))) { 1692 1691 btrfs_cleanup_defrag_inodes(fs_info); 1693 1692 } 1694 1693 ··· 1734 1735 btrfs_resize_thread_pool(fs_info, 1735 1736 fs_info->thread_pool_size, old_thread_pool_size); 1736 1737 1737 - if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) 1738 + if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) 1738 1739 goto out; 1739 1740 1740 1741 if (*flags & MS_RDONLY) { ··· 1834 1835 1835 1836 restore: 1836 1837 /* We've hit an error - don't reset MS_RDONLY */ 1837 - if (sb->s_flags & MS_RDONLY) 1838 + if (sb_rdonly(sb)) 1838 1839 old_flags |= MS_RDONLY; 1839 1840 sb->s_flags = old_flags; 1840 1841 fs_info->mount_opt = old_opts;
+2 -2
fs/btrfs/sysfs.c
··· 120 120 if (!fs_info) 121 121 return -EPERM; 122 122 123 - if (fs_info->sb->s_flags & MS_RDONLY) 123 + if (sb_rdonly(fs_info->sb)) 124 124 return -EROFS; 125 125 126 126 ret = kstrtoul(skip_spaces(buf), 0, &val); ··· 388 388 if (!fs_info) 389 389 return -EPERM; 390 390 391 - if (fs_info->sb->s_flags & MS_RDONLY) 391 + if (sb_rdonly(fs_info->sb)) 392 392 return -EROFS; 393 393 394 394 /*
+2 -2
fs/btrfs/volumes.c
··· 2337 2337 int seeding_dev = 0; 2338 2338 int ret = 0; 2339 2339 2340 - if ((sb->s_flags & MS_RDONLY) && !fs_info->fs_devices->seeding) 2340 + if (sb_rdonly(sb) && !fs_info->fs_devices->seeding) 2341 2341 return -EROFS; 2342 2342 2343 2343 bdev = blkdev_get_by_path(device_path, FMODE_WRITE | FMODE_EXCL, ··· 4085 4085 4086 4086 int btrfs_cancel_balance(struct btrfs_fs_info *fs_info) 4087 4087 { 4088 - if (fs_info->sb->s_flags & MS_RDONLY) 4088 + if (sb_rdonly(fs_info->sb)) 4089 4089 return -EROFS; 4090 4090 4091 4091 mutex_lock(&fs_info->balance_mutex);
+1 -1
fs/cachefiles/bind.c
··· 133 133 goto error_unsupported; 134 134 135 135 ret = -EROFS; 136 - if (root->d_sb->s_flags & MS_RDONLY) 136 + if (sb_rdonly(root->d_sb)) 137 137 goto error_unsupported; 138 138 139 139 /* determine the security of the on-disk cache as this governs
+1 -2
fs/ecryptfs/main.c
··· 568 568 * 1) The lower mount is ro 569 569 * 2) The ecryptfs_encrypted_view mount option is specified 570 570 */ 571 - if (path.dentry->d_sb->s_flags & MS_RDONLY || 572 - mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) 571 + if (sb_rdonly(path.dentry->d_sb) || mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) 573 572 s->s_flags |= MS_RDONLY; 574 573 575 574 s->s_maxbytes = path.dentry->d_sb->s_maxbytes;
+1 -1
fs/efs/super.c
··· 306 306 } 307 307 brelse(bh); 308 308 309 - if (!(s->s_flags & MS_RDONLY)) { 309 + if (!sb_rdonly(s)) { 310 310 #ifdef DEBUG 311 311 pr_info("forcing read-only mode\n"); 312 312 #endif
+6 -7
fs/ext2/super.c
··· 52 52 struct ext2_sb_info *sbi = EXT2_SB(sb); 53 53 struct ext2_super_block *es = sbi->s_es; 54 54 55 - if (!(sb->s_flags & MS_RDONLY)) { 55 + if (!sb_rdonly(sb)) { 56 56 spin_lock(&sbi->s_lock); 57 57 sbi->s_mount_state |= EXT2_ERROR_FS; 58 58 es->s_state |= cpu_to_le16(EXT2_ERROR_FS); ··· 151 151 ext2_xattr_destroy_cache(sbi->s_ea_block_cache); 152 152 sbi->s_ea_block_cache = NULL; 153 153 } 154 - if (!(sb->s_flags & MS_RDONLY)) { 154 + if (!sb_rdonly(sb)) { 155 155 struct ext2_super_block *es = sbi->s_es; 156 156 157 157 spin_lock(&sbi->s_lock); ··· 940 940 le32_to_cpu(features)); 941 941 goto failed_mount; 942 942 } 943 - if (!(sb->s_flags & MS_RDONLY) && 944 - (features = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){ 943 + if (!sb_rdonly(sb) && (features = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){ 945 944 ext2_msg(sb, KERN_ERR, "error: couldn't mount RDWR because of " 946 945 "unsupported optional features (%x)", 947 946 le32_to_cpu(features)); ··· 1169 1170 if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) 1170 1171 ext2_msg(sb, KERN_WARNING, 1171 1172 "warning: mounting ext3 filesystem as ext2"); 1172 - if (ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY)) 1173 + if (ext2_setup_super (sb, es, sb_rdonly(sb))) 1173 1174 sb->s_flags |= MS_RDONLY; 1174 1175 ext2_write_super(sb); 1175 1176 return 0; ··· 1300 1301 1301 1302 static void ext2_write_super(struct super_block *sb) 1302 1303 { 1303 - if (!(sb->s_flags & MS_RDONLY)) 1304 + if (!sb_rdonly(sb)) 1304 1305 ext2_sync_fs(sb, 1); 1305 1306 } 1306 1307 ··· 1338 1339 "dax flag with busy inodes while remounting"); 1339 1340 sbi->s_mount_opt ^= EXT2_MOUNT_DAX; 1340 1341 } 1341 - if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { 1342 + if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) { 1342 1343 spin_unlock(&sbi->s_lock); 1343 1344 return 0; 1344 1345 }
+1 -1
fs/ext4/ext4_jbd2.c
··· 47 47 if (unlikely(ext4_forced_shutdown(EXT4_SB(sb)))) 48 48 return -EIO; 49 49 50 - if (sb->s_flags & MS_RDONLY) 50 + if (sb_rdonly(sb)) 51 51 return -EROFS; 52 52 WARN_ON(sb->s_writers.frozen == SB_FREEZE_COMPLETE); 53 53 journal = EXT4_SB(sb)->s_journal;
+1 -1
fs/ext4/file.c
··· 388 388 return -EIO; 389 389 390 390 if (unlikely(!(sbi->s_mount_flags & EXT4_MF_MNTDIR_SAMPLED) && 391 - !(sb->s_flags & MS_RDONLY))) { 391 + !sb_rdonly(sb))) { 392 392 sbi->s_mount_flags |= EXT4_MF_MNTDIR_SAMPLED; 393 393 /* 394 394 * Sample where the filesystem has been mounted and
+1 -1
fs/ext4/fsync.c
··· 107 107 108 108 trace_ext4_sync_file_enter(file, datasync); 109 109 110 - if (inode->i_sb->s_flags & MS_RDONLY) { 110 + if (sb_rdonly(inode->i_sb)) { 111 111 /* Make sure that we read updated s_mount_flags value */ 112 112 smp_rmb(); 113 113 if (EXT4_SB(inode->i_sb)->s_mount_flags & EXT4_MF_FS_ABORTED)
+1 -1
fs/ext4/ialloc.c
··· 1355 1355 int num, ret = 0, used_blks = 0; 1356 1356 1357 1357 /* This should not happen, but just to be sure check this */ 1358 - if (sb->s_flags & MS_RDONLY) { 1358 + if (sb_rdonly(sb)) { 1359 1359 ret = 1; 1360 1360 goto out; 1361 1361 }
+1 -1
fs/ext4/mmp.c
··· 185 185 goto exit_thread; 186 186 } 187 187 188 - if (sb->s_flags & MS_RDONLY) { 188 + if (sb_rdonly(sb)) { 189 189 ext4_warning(sb, "kmmpd being stopped since filesystem " 190 190 "has been remounted as readonly."); 191 191 goto exit_thread;
+25 -28
fs/ext4/super.c
··· 405 405 406 406 static void ext4_handle_error(struct super_block *sb) 407 407 { 408 - if (sb->s_flags & MS_RDONLY) 408 + if (sb_rdonly(sb)) 409 409 return; 410 410 411 411 if (!test_opt(sb, ERRORS_CONT)) { ··· 587 587 /* Special case: if the error is EROFS, and we're not already 588 588 * inside a transaction, then there's really no point in logging 589 589 * an error. */ 590 - if (errno == -EROFS && journal_current_handle() == NULL && 591 - (sb->s_flags & MS_RDONLY)) 590 + if (errno == -EROFS && journal_current_handle() == NULL && sb_rdonly(sb)) 592 591 return; 593 592 594 593 if (ext4_error_ratelimit(sb)) { ··· 627 628 sb->s_id, function, line, &vaf); 628 629 va_end(args); 629 630 630 - if ((sb->s_flags & MS_RDONLY) == 0) { 631 + if (sb_rdonly(sb) == 0) { 631 632 ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only"); 632 633 EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED; 633 634 /* ··· 888 889 ext4_mb_release(sb); 889 890 ext4_ext_release(sb); 890 891 891 - if (!(sb->s_flags & MS_RDONLY) && !aborted) { 892 + if (!sb_rdonly(sb) && !aborted) { 892 893 ext4_clear_feature_journal_needs_recovery(sb); 893 894 es->s_state = cpu_to_le16(sbi->s_mount_state); 894 895 } 895 - if (!(sb->s_flags & MS_RDONLY)) 896 + if (!sb_rdonly(sb)) 896 897 ext4_commit_super(sb, 1); 897 898 898 899 for (i = 0; i < sbi->s_gdb_count; i++) ··· 2100 2101 struct super_block *sb = seq->private; 2101 2102 int rc; 2102 2103 2103 - seq_puts(seq, (sb->s_flags & MS_RDONLY) ? "ro" : "rw"); 2104 + seq_puts(seq, sb_rdonly(sb) ? "ro" : "rw"); 2104 2105 rc = _ext4_show_options(seq, sb, 1); 2105 2106 seq_puts(seq, "\n"); 2106 2107 return rc; ··· 2368 2369 "Checksum for group %u failed (%u!=%u)", 2369 2370 i, le16_to_cpu(ext4_group_desc_csum(sb, i, 2370 2371 gdp)), le16_to_cpu(gdp->bg_checksum)); 2371 - if (!(sb->s_flags & MS_RDONLY)) { 2372 + if (!sb_rdonly(sb)) { 2372 2373 ext4_unlock_group(sb, i); 2373 2374 return 0; 2374 2375 } ··· 3115 3116 goto out; 3116 3117 } 3117 3118 3118 - if (first_not_zeroed == ngroups || 3119 - (sb->s_flags & MS_RDONLY) || 3119 + if (first_not_zeroed == ngroups || sb_rdonly(sb) || 3120 3120 !test_opt(sb, INIT_INODE_TABLE)) 3121 3121 goto out; 3122 3122 ··· 3659 3661 * previously didn't change the revision level when setting the flags, 3660 3662 * so there is a chance incompat flags are set on a rev 0 filesystem. 3661 3663 */ 3662 - if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY))) 3664 + if (!ext4_feature_set_ok(sb, (sb_rdonly(sb)))) 3663 3665 goto failed_mount; 3664 3666 3665 3667 blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); ··· 3788 3790 sbi->s_hash_unsigned = 3; 3789 3791 else if ((i & EXT2_FLAGS_SIGNED_HASH) == 0) { 3790 3792 #ifdef __CHAR_UNSIGNED__ 3791 - if (!(sb->s_flags & MS_RDONLY)) 3793 + if (!sb_rdonly(sb)) 3792 3794 es->s_flags |= 3793 3795 cpu_to_le32(EXT2_FLAGS_UNSIGNED_HASH); 3794 3796 sbi->s_hash_unsigned = 3; 3795 3797 #else 3796 - if (!(sb->s_flags & MS_RDONLY)) 3798 + if (!sb_rdonly(sb)) 3797 3799 es->s_flags |= 3798 3800 cpu_to_le32(EXT2_FLAGS_SIGNED_HASH); 3799 3801 #endif ··· 3993 3995 needs_recovery = (es->s_last_orphan != 0 || 3994 3996 ext4_has_feature_journal_needs_recovery(sb)); 3995 3997 3996 - if (ext4_has_feature_mmp(sb) && !(sb->s_flags & MS_RDONLY)) 3998 + if (ext4_has_feature_mmp(sb) && !sb_rdonly(sb)) 3997 3999 if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block))) 3998 4000 goto failed_mount3a; 3999 4001 ··· 4005 4007 err = ext4_load_journal(sb, es, journal_devnum); 4006 4008 if (err) 4007 4009 goto failed_mount3a; 4008 - } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) && 4010 + } else if (test_opt(sb, NOLOAD) && !sb_rdonly(sb) && 4009 4011 ext4_has_feature_journal_needs_recovery(sb)) { 4010 4012 ext4_msg(sb, KERN_ERR, "required journal recovery " 4011 4013 "suppressed and not mounted read-only"); ··· 4119 4121 goto failed_mount_wq; 4120 4122 } 4121 4123 4122 - if (DUMMY_ENCRYPTION_ENABLED(sbi) && !(sb->s_flags & MS_RDONLY) && 4124 + if (DUMMY_ENCRYPTION_ENABLED(sbi) && !sb_rdonly(sb) && 4123 4125 !ext4_has_feature_encrypt(sb)) { 4124 4126 ext4_set_feature_encrypt(sb); 4125 4127 ext4_commit_super(sb, 1); ··· 4173 4175 goto failed_mount4; 4174 4176 } 4175 4177 4176 - if (ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY)) 4178 + if (ext4_setup_super(sb, es, sb_rdonly(sb))) 4177 4179 sb->s_flags |= MS_RDONLY; 4178 4180 4179 4181 /* determine the minimum size of new large inodes, if present */ ··· 4261 4263 4262 4264 #ifdef CONFIG_QUOTA 4263 4265 /* Enable quota usage during mount. */ 4264 - if (ext4_has_feature_quota(sb) && !(sb->s_flags & MS_RDONLY)) { 4266 + if (ext4_has_feature_quota(sb) && !sb_rdonly(sb)) { 4265 4267 err = ext4_enable_quotas(sb); 4266 4268 if (err) 4267 4269 goto failed_mount8; ··· 4584 4586 * can get read-write access to the device. 4585 4587 */ 4586 4588 if (ext4_has_feature_journal_needs_recovery(sb)) { 4587 - if (sb->s_flags & MS_RDONLY) { 4589 + if (sb_rdonly(sb)) { 4588 4590 ext4_msg(sb, KERN_INFO, "INFO: recovery " 4589 4591 "required on readonly filesystem"); 4590 4592 if (really_read_only) { ··· 4739 4741 if (jbd2_journal_flush(journal) < 0) 4740 4742 goto out; 4741 4743 4742 - if (ext4_has_feature_journal_needs_recovery(sb) && 4743 - sb->s_flags & MS_RDONLY) { 4744 + if (ext4_has_feature_journal_needs_recovery(sb) && sb_rdonly(sb)) { 4744 4745 ext4_clear_feature_journal_needs_recovery(sb); 4745 4746 ext4_commit_super(sb, 1); 4746 4747 } ··· 4795 4798 { 4796 4799 journal_t *journal; 4797 4800 4798 - if (sb->s_flags & MS_RDONLY) 4801 + if (sb_rdonly(sb)) 4799 4802 return 0; 4800 4803 4801 4804 journal = EXT4_SB(sb)->s_journal; ··· 4860 4863 int error = 0; 4861 4864 journal_t *journal; 4862 4865 4863 - if (sb->s_flags & MS_RDONLY) 4866 + if (sb_rdonly(sb)) 4864 4867 return 0; 4865 4868 4866 4869 journal = EXT4_SB(sb)->s_journal; ··· 4895 4898 */ 4896 4899 static int ext4_unfreeze(struct super_block *sb) 4897 4900 { 4898 - if ((sb->s_flags & MS_RDONLY) || ext4_forced_shutdown(EXT4_SB(sb))) 4901 + if (sb_rdonly(sb) || ext4_forced_shutdown(EXT4_SB(sb))) 4899 4902 return 0; 4900 4903 4901 4904 if (EXT4_SB(sb)->s_journal) { ··· 5033 5036 if (*flags & MS_LAZYTIME) 5034 5037 sb->s_flags |= MS_LAZYTIME; 5035 5038 5036 - if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { 5039 + if ((bool)(*flags & MS_RDONLY) != sb_rdonly(sb)) { 5037 5040 if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) { 5038 5041 err = -EROFS; 5039 5042 goto restore_opts; ··· 5128 5131 * Reinitialize lazy itable initialization thread based on 5129 5132 * current settings 5130 5133 */ 5131 - if ((sb->s_flags & MS_RDONLY) || !test_opt(sb, INIT_INODE_TABLE)) 5134 + if (sb_rdonly(sb) || !test_opt(sb, INIT_INODE_TABLE)) 5132 5135 ext4_unregister_li_request(sb); 5133 5136 else { 5134 5137 ext4_group_t first_not_zeroed; ··· 5700 5703 { 5701 5704 if (ext4_has_unknown_ext2_incompat_features(sb)) 5702 5705 return 0; 5703 - if (sb->s_flags & MS_RDONLY) 5706 + if (sb_rdonly(sb)) 5704 5707 return 1; 5705 5708 if (ext4_has_unknown_ext2_ro_compat_features(sb)) 5706 5709 return 0; ··· 5731 5734 return 0; 5732 5735 if (!ext4_has_feature_journal(sb)) 5733 5736 return 0; 5734 - if (sb->s_flags & MS_RDONLY) 5737 + if (sb_rdonly(sb)) 5735 5738 return 1; 5736 5739 if (ext4_has_unknown_ext3_ro_compat_features(sb)) 5737 5740 return 0;
+1 -1
fs/fat/fatent.c
··· 309 309 { 310 310 struct msdos_sb_info *sbi = MSDOS_SB(sb); 311 311 312 - if (sb->s_flags & MS_RDONLY || sbi->fat_bits != 32) 312 + if (sb_rdonly(sb) || sbi->fat_bits != 32) 313 313 return; 314 314 315 315 __mark_inode_dirty(sbi->fsinfo_inode, I_DIRTY_SYNC);
+2 -2
fs/fat/inode.c
··· 657 657 struct msdos_sb_info *sbi = MSDOS_SB(sb); 658 658 659 659 /* do not change any thing if mounted read only */ 660 - if ((sb->s_flags & MS_RDONLY) && !force) 660 + if (sb_rdonly(sb) && !force) 661 661 return; 662 662 663 663 /* do not change state if fs was dirty */ ··· 787 787 788 788 /* make sure we update state on remount. */ 789 789 new_rdonly = *flags & MS_RDONLY; 790 - if (new_rdonly != (sb->s_flags & MS_RDONLY)) { 790 + if (new_rdonly != sb_rdonly(sb)) { 791 791 if (new_rdonly) 792 792 fat_set_state(sb, 0, 0); 793 793 else
+1 -1
fs/fat/misc.c
··· 32 32 33 33 if (opts->errors == FAT_ERRORS_PANIC) 34 34 panic("FAT-fs (%s): fs panic from previous error\n", sb->s_id); 35 - else if (opts->errors == FAT_ERRORS_RO && !(sb->s_flags & MS_RDONLY)) { 35 + else if (opts->errors == FAT_ERRORS_RO && !sb_rdonly(sb)) { 36 36 sb->s_flags |= MS_RDONLY; 37 37 fat_msg(sb, KERN_ERR, "Filesystem has been set read-only"); 38 38 }
+1 -1
fs/gfs2/glops.c
··· 580 580 struct gfs2_inode *ip = gl->gl_object; 581 581 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; 582 582 583 - if (!remote || (sdp->sd_vfs->s_flags & MS_RDONLY)) 583 + if (!remote || sb_rdonly(sdp->sd_vfs)) 584 584 return; 585 585 586 586 if (gl->gl_demote_state == LM_ST_UNLOCKED &&
+2 -2
fs/gfs2/ops_fstype.c
··· 1037 1037 char ro[20]; 1038 1038 char spectator[20]; 1039 1039 char *envp[] = { ro, spectator, NULL }; 1040 - sprintf(ro, "RDONLY=%d", (sb->s_flags & MS_RDONLY) ? 1 : 0); 1040 + sprintf(ro, "RDONLY=%d", sb_rdonly(sb)); 1041 1041 sprintf(spectator, "SPECTATOR=%d", sdp->sd_args.ar_spectator ? 1 : 0); 1042 1042 kobject_uevent_env(&sdp->sd_kobj, KOBJ_ONLINE, envp); 1043 1043 } ··· 1179 1179 goto fail_per_node; 1180 1180 } 1181 1181 1182 - if (!(sb->s_flags & MS_RDONLY)) { 1182 + if (!sb_rdonly(sb)) { 1183 1183 error = gfs2_make_fs_rw(sdp); 1184 1184 if (error) { 1185 1185 fs_err(sdp, "can't make FS RW: %d\n", error);
+1 -1
fs/gfs2/quota.c
··· 452 452 453 453 *qdp = NULL; 454 454 455 - if (sdp->sd_vfs->s_flags & MS_RDONLY) 455 + if (sb_rdonly(sdp->sd_vfs)) 456 456 return 0; 457 457 458 458 spin_lock(&qd_lock);
+1 -1
fs/gfs2/recovery.c
··· 522 522 if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) 523 523 ro = 1; 524 524 } else { 525 - if (sdp->sd_vfs->s_flags & MS_RDONLY) { 525 + if (sb_rdonly(sdp->sd_vfs)) { 526 526 /* check if device itself is read-only */ 527 527 ro = bdev_read_only(sdp->sd_vfs->s_bdev); 528 528 if (!ro) {
+2 -2
fs/gfs2/super.c
··· 893 893 } 894 894 spin_unlock(&sdp->sd_jindex_spin); 895 895 896 - if (!(sb->s_flags & MS_RDONLY)) { 896 + if (!sb_rdonly(sb)) { 897 897 error = gfs2_make_fs_ro(sdp); 898 898 if (error) 899 899 gfs2_io_error(sdp); ··· 1535 1535 return; 1536 1536 } 1537 1537 1538 - if (inode->i_nlink || (sb->s_flags & MS_RDONLY)) 1538 + if (inode->i_nlink || sb_rdonly(sb)) 1539 1539 goto out; 1540 1540 1541 1541 if (test_bit(GIF_ALLOC_FAILED, &ip->i_flags)) {
+1 -1
fs/gfs2/sys.c
··· 645 645 char *envp[] = { ro, spectator, NULL }; 646 646 int sysfs_frees_sdp = 0; 647 647 648 - sprintf(ro, "RDONLY=%d", (sb->s_flags & MS_RDONLY) ? 1 : 0); 648 + sprintf(ro, "RDONLY=%d", sb_rdonly(sb)); 649 649 sprintf(spectator, "SPECTATOR=%d", sdp->sd_args.ar_spectator ? 1 : 0); 650 650 651 651 sdp->sd_kobj.kset = gfs2_kset;
+3 -3
fs/hfs/mdb.c
··· 210 210 pr_warn("filesystem is marked locked, mounting read-only.\n"); 211 211 sb->s_flags |= MS_RDONLY; 212 212 } 213 - if (!(sb->s_flags & MS_RDONLY)) { 213 + if (!sb_rdonly(sb)) { 214 214 /* Mark the volume uncleanly unmounted in case we crash */ 215 215 attrib &= cpu_to_be16(~HFS_SB_ATTRIB_UNMNT); 216 216 attrib |= cpu_to_be16(HFS_SB_ATTRIB_INCNSTNT); ··· 259 259 { 260 260 struct hfs_mdb *mdb = HFS_SB(sb)->mdb; 261 261 262 - if (sb->s_flags & MS_RDONLY) 262 + if (sb_rdonly(sb)) 263 263 return; 264 264 265 265 lock_buffer(HFS_SB(sb)->mdb_bh); ··· 334 334 void hfs_mdb_close(struct super_block *sb) 335 335 { 336 336 /* update volume attributes */ 337 - if (sb->s_flags & MS_RDONLY) 337 + if (sb_rdonly(sb)) 338 338 return; 339 339 HFS_SB(sb)->mdb->drAtrb |= cpu_to_be16(HFS_SB_ATTRIB_UNMNT); 340 340 HFS_SB(sb)->mdb->drAtrb &= cpu_to_be16(~HFS_SB_ATTRIB_INCNSTNT);
+2 -2
fs/hfs/super.c
··· 71 71 struct hfs_sb_info *sbi = HFS_SB(sb); 72 72 unsigned long delay; 73 73 74 - if (sb->s_flags & MS_RDONLY) 74 + if (sb_rdonly(sb)) 75 75 return; 76 76 77 77 spin_lock(&sbi->work_lock); ··· 115 115 { 116 116 sync_filesystem(sb); 117 117 *flags |= MS_NODIRATIME; 118 - if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) 118 + if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) 119 119 return 0; 120 120 if (!(*flags & MS_RDONLY)) { 121 121 if (!(HFS_SB(sb)->mdb->drAtrb & cpu_to_be16(HFS_SB_ATTRIB_UNMNT))) {
+5 -5
fs/hfsplus/super.c
··· 264 264 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); 265 265 unsigned long delay; 266 266 267 - if (sb->s_flags & MS_RDONLY) 267 + if (sb_rdonly(sb)) 268 268 return; 269 269 270 270 spin_lock(&sbi->work_lock); ··· 284 284 285 285 cancel_delayed_work_sync(&sbi->sync_work); 286 286 287 - if (!(sb->s_flags & MS_RDONLY) && sbi->s_vhdr) { 287 + if (!sb_rdonly(sb) && sbi->s_vhdr) { 288 288 struct hfsplus_vh *vhdr = sbi->s_vhdr; 289 289 290 290 vhdr->modify_date = hfsp_now2mt(); ··· 329 329 static int hfsplus_remount(struct super_block *sb, int *flags, char *data) 330 330 { 331 331 sync_filesystem(sb); 332 - if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) 332 + if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) 333 333 return 0; 334 334 if (!(*flags & MS_RDONLY)) { 335 335 struct hfsplus_vh *vhdr = HFSPLUS_SB(sb)->s_vhdr; ··· 462 462 pr_warn("Filesystem is marked locked, mounting read-only.\n"); 463 463 sb->s_flags |= MS_RDONLY; 464 464 } else if ((vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) && 465 - !(sb->s_flags & MS_RDONLY)) { 465 + !sb_rdonly(sb)) { 466 466 pr_warn("write access to a journaled filesystem is not supported, use the force option at your own risk, mounting read-only.\n"); 467 467 sb->s_flags |= MS_RDONLY; 468 468 } ··· 535 535 } else 536 536 hfs_find_exit(&fd); 537 537 538 - if (!(sb->s_flags & MS_RDONLY)) { 538 + if (!sb_rdonly(sb)) { 539 539 /* 540 540 * H+LX == hfsplusutils, H+Lx == this driver, H+lx is unused 541 541 * all three are registered with Apple for our use
+2 -2
fs/hpfs/alloc.c
··· 538 538 return 0; 539 539 if (start < sbi->sb_dirband_start + sbi->sb_dirband_size && end > sbi->sb_dirband_start) { 540 540 hpfs_lock(s); 541 - if (s->s_flags & MS_RDONLY) { 541 + if (sb_rdonly(s)) { 542 542 err = -EROFS; 543 543 goto unlock_1; 544 544 } ··· 559 559 end_bmp = (end + 0x3fff) >> 14; 560 560 while (start_bmp < end_bmp && !err) { 561 561 hpfs_lock(s); 562 - if (s->s_flags & MS_RDONLY) { 562 + if (sb_rdonly(s)) { 563 563 err = -EROFS; 564 564 goto unlock_2; 565 565 }
+1 -1
fs/hpfs/dir.c
··· 264 264 hpfs_result = hpfs_i(result); 265 265 if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino; 266 266 267 - if (de->has_acl || de->has_xtd_perm) if (!(dir->i_sb->s_flags & MS_RDONLY)) { 267 + if (de->has_acl || de->has_xtd_perm) if (!sb_rdonly(dir->i_sb)) { 268 268 hpfs_error(result->i_sb, "ACLs or XPERM found. This is probably HPFS386. This driver doesn't support it now. Send me some info on these structures"); 269 269 goto bail1; 270 270 }
+6 -7
fs/hpfs/super.c
··· 21 21 22 22 static void mark_dirty(struct super_block *s, int remount) 23 23 { 24 - if (hpfs_sb(s)->sb_chkdsk && (remount || !(s->s_flags & MS_RDONLY))) { 24 + if (hpfs_sb(s)->sb_chkdsk && (remount || !sb_rdonly(s))) { 25 25 struct buffer_head *bh; 26 26 struct hpfs_spare_block *sb; 27 27 if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { ··· 41 41 { 42 42 struct buffer_head *bh; 43 43 struct hpfs_spare_block *sb; 44 - if (s->s_flags & MS_RDONLY) return; 44 + if (sb_rdonly(s)) return; 45 45 sync_blockdev(s->s_bdev); 46 46 if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { 47 47 sb->dirty = hpfs_sb(s)->sb_chkdsk > 1 - hpfs_sb(s)->sb_was_error; ··· 73 73 mark_dirty(s, 0); 74 74 panic("HPFS panic"); 75 75 } else if (hpfs_sb(s)->sb_err == 1) { 76 - if (s->s_flags & MS_RDONLY) 76 + if (sb_rdonly(s)) 77 77 pr_cont("; already mounted read-only\n"); 78 78 else { 79 79 pr_cont("; remounting read-only\n"); 80 80 mark_dirty(s, 0); 81 81 s->s_flags |= MS_RDONLY; 82 82 } 83 - } else if (s->s_flags & MS_RDONLY) 83 + } else if (sb_rdonly(s)) 84 84 pr_cont("; going on - but anything won't be destroyed because it's read-only\n"); 85 85 else 86 86 pr_cont("; corrupted filesystem mounted read/write - your computer will explode within 20 seconds ... but you wanted it so!\n"); ··· 607 607 } 608 608 609 609 /* Check version */ 610 - if (!(s->s_flags & MS_RDONLY) && 611 - superblock->funcversion != 2 && superblock->funcversion != 3) { 610 + if (!sb_rdonly(s) && superblock->funcversion != 2 && superblock->funcversion != 3) { 612 611 pr_err("Bad version %d,%d. Mount readonly to go around\n", 613 612 (int)superblock->version, (int)superblock->funcversion); 614 613 pr_err("please try recent version of HPFS driver at http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi and if it still can't understand this format, contact author - mikulas@artax.karlin.mff.cuni.cz\n"); ··· 665 666 hpfs_error(s, "improperly stopped"); 666 667 } 667 668 668 - if (!(s->s_flags & MS_RDONLY)) { 669 + if (!sb_rdonly(s)) { 669 670 spareblock->dirty = 1; 670 671 spareblock->old_wrote = 0; 671 672 mark_buffer_dirty(bh2);
+1 -1
fs/isofs/inode.c
··· 733 733 734 734 root_found: 735 735 /* We don't support read-write mounts */ 736 - if (!(s->s_flags & MS_RDONLY)) { 736 + if (!sb_rdonly(s)) { 737 737 error = -EACCES; 738 738 goto out_freebh; 739 739 }
+3 -3
fs/jffs2/fs.c
··· 395 395 { 396 396 struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); 397 397 398 - if (c->flags & JFFS2_SB_FLAG_RO && !(sb->s_flags & MS_RDONLY)) 398 + if (c->flags & JFFS2_SB_FLAG_RO && !sb_rdonly(sb)) 399 399 return -EROFS; 400 400 401 401 /* We stop if it was running, then restart if it needs to. 402 402 This also catches the case where it was stopped and this 403 403 is just a remount to restart it. 404 404 Flush the writebuffer, if neccecary, else we loose it */ 405 - if (!(sb->s_flags & MS_RDONLY)) { 405 + if (!sb_rdonly(sb)) { 406 406 jffs2_stop_garbage_collect_thread(c); 407 407 mutex_lock(&c->alloc_sem); 408 408 jffs2_flush_wbuf_pad(c); ··· 590 590 sb->s_blocksize = PAGE_SIZE; 591 591 sb->s_blocksize_bits = PAGE_SHIFT; 592 592 sb->s_magic = JFFS2_SUPER_MAGIC; 593 - if (!(sb->s_flags & MS_RDONLY)) 593 + if (!sb_rdonly(sb)) 594 594 jffs2_start_garbage_collect_thread(c); 595 595 return 0; 596 596
+1 -1
fs/jffs2/super.c
··· 342 342 static void jffs2_kill_sb(struct super_block *sb) 343 343 { 344 344 struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); 345 - if (!(sb->s_flags & MS_RDONLY)) 345 + if (!sb_rdonly(sb)) 346 346 jffs2_stop_garbage_collect_thread(c); 347 347 kill_mtd_super(sb); 348 348 kfree(c);
+2 -2
fs/jffs2/wbuf.c
··· 1162 1162 struct jffs2_sb_info *c = work_to_sb(work); 1163 1163 struct super_block *sb = OFNI_BS_2SFFJ(c); 1164 1164 1165 - if (!(sb->s_flags & MS_RDONLY)) { 1165 + if (!sb_rdonly(sb)) { 1166 1166 jffs2_dbg(1, "%s()\n", __func__); 1167 1167 jffs2_flush_wbuf_gc(c, 0); 1168 1168 } ··· 1173 1173 struct super_block *sb = OFNI_BS_2SFFJ(c); 1174 1174 unsigned long delay; 1175 1175 1176 - if (sb->s_flags & MS_RDONLY) 1176 + if (sb_rdonly(sb)) 1177 1177 return; 1178 1178 1179 1179 delay = msecs_to_jiffies(dirty_writeback_interval * 10);
+1 -1
fs/jfs/jfs_mount.c
··· 362 362 363 363 /* validate fs state */ 364 364 if (j_sb->s_state != cpu_to_le32(FM_CLEAN) && 365 - !(sb->s_flags & MS_RDONLY)) { 365 + !sb_rdonly(sb)) { 366 366 jfs_err("jfs_mount: Mount Failure: File System Dirty."); 367 367 rc = -EINVAL; 368 368 goto out;
+8 -8
fs/jfs/super.c
··· 76 76 { 77 77 struct jfs_sb_info *sbi = JFS_SBI(sb); 78 78 79 - if (sb->s_flags & MS_RDONLY) 79 + if (sb_rdonly(sb)) 80 80 return; 81 81 82 82 updateSuper(sb, FM_DIRTY); ··· 468 468 return -EINVAL; 469 469 470 470 if (newLVSize) { 471 - if (sb->s_flags & MS_RDONLY) { 471 + if (sb_rdonly(sb)) { 472 472 pr_err("JFS: resize requires volume to be mounted read-write\n"); 473 473 return -EROFS; 474 474 } ··· 477 477 return rc; 478 478 } 479 479 480 - if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { 480 + if (sb_rdonly(sb) && !(*flags & MS_RDONLY)) { 481 481 /* 482 482 * Invalidate any previously read metadata. fsck may have 483 483 * changed the on-disk data since we mounted r/o ··· 493 493 dquot_resume(sb, -1); 494 494 return ret; 495 495 } 496 - if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) { 496 + if (!sb_rdonly(sb) && (*flags & MS_RDONLY)) { 497 497 rc = dquot_suspend(sb, -1); 498 498 if (rc < 0) 499 499 return rc; ··· 502 502 return rc; 503 503 } 504 504 if ((JFS_SBI(sb)->flag & JFS_NOINTEGRITY) != (flag & JFS_NOINTEGRITY)) 505 - if (!(sb->s_flags & MS_RDONLY)) { 505 + if (!sb_rdonly(sb)) { 506 506 rc = jfs_umount_rw(sb); 507 507 if (rc) 508 508 return rc; ··· 592 592 jfs_err("jfs_mount failed w/return code = %d", rc); 593 593 goto out_mount_failed; 594 594 } 595 - if (sb->s_flags & MS_RDONLY) 595 + if (sb_rdonly(sb)) 596 596 sbi->log = NULL; 597 597 else { 598 598 rc = jfs_mount_rw(sb, 0); ··· 658 658 struct jfs_log *log = sbi->log; 659 659 int rc = 0; 660 660 661 - if (!(sb->s_flags & MS_RDONLY)) { 661 + if (!sb_rdonly(sb)) { 662 662 txQuiesce(sb); 663 663 rc = lmLogShutdown(log); 664 664 if (rc) { ··· 688 688 struct jfs_log *log = sbi->log; 689 689 int rc = 0; 690 690 691 - if (!(sb->s_flags & MS_RDONLY)) { 691 + if (!sb_rdonly(sb)) { 692 692 rc = updateSuper(sb, FM_MOUNT); 693 693 if (rc) { 694 694 jfs_error(sb, "updateSuper failed\n");
+3 -3
fs/minix/inode.c
··· 42 42 int i; 43 43 struct minix_sb_info *sbi = minix_sb(sb); 44 44 45 - if (!(sb->s_flags & MS_RDONLY)) { 45 + if (!sb_rdonly(sb)) { 46 46 if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ 47 47 sbi->s_ms->s_state = sbi->s_mount_state; 48 48 mark_buffer_dirty(sbi->s_sbh); ··· 125 125 126 126 sync_filesystem(sb); 127 127 ms = sbi->s_ms; 128 - if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) 128 + if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) 129 129 return 0; 130 130 if (*flags & MS_RDONLY) { 131 131 if (ms->s_state & MINIX_VALID_FS || ··· 293 293 if (!s->s_root) 294 294 goto out_no_root; 295 295 296 - if (!(s->s_flags & MS_RDONLY)) { 296 + if (!sb_rdonly(s)) { 297 297 if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ 298 298 ms->s_state &= ~MINIX_VALID_FS; 299 299 mark_buffer_dirty(bh);
+1 -2
fs/namei.c
··· 447 447 umode_t mode = inode->i_mode; 448 448 449 449 /* Nobody gets write access to a read-only fs. */ 450 - if ((sb->s_flags & MS_RDONLY) && 451 - (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))) 450 + if (sb_rdonly(sb) && (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))) 452 451 return -EROFS; 453 452 } 454 453 return 0;
+3 -3
fs/namespace.c
··· 275 275 { 276 276 if (mnt->mnt_flags & MNT_READONLY) 277 277 return 1; 278 - if (mnt->mnt_sb->s_flags & MS_RDONLY) 278 + if (sb_rdonly(mnt->mnt_sb)) 279 279 return 1; 280 280 return 0; 281 281 } ··· 1534 1534 if (!capable(CAP_SYS_ADMIN)) 1535 1535 return -EPERM; 1536 1536 down_write(&sb->s_umount); 1537 - if (!(sb->s_flags & MS_RDONLY)) 1537 + if (!sb_rdonly(sb)) 1538 1538 retval = do_remount_sb(sb, MS_RDONLY, NULL, 0); 1539 1539 up_write(&sb->s_umount); 1540 1540 return retval; ··· 3300 3300 mnt_flags = mnt->mnt.mnt_flags; 3301 3301 3302 3302 /* Don't miss readonly hidden in the superblock flags */ 3303 - if (mnt->mnt.mnt_sb->s_flags & MS_RDONLY) 3303 + if (sb_rdonly(mnt->mnt.mnt_sb)) 3304 3304 mnt_flags |= MNT_LOCK_READONLY; 3305 3305 3306 3306 /* Verify the mount flags are equal to or more permissive
+1 -1
fs/nfs/super.c
··· 812 812 * Display all mount option settings 813 813 */ 814 814 seq_printf(m, "\n\topts:\t"); 815 - seq_puts(m, root->d_sb->s_flags & MS_RDONLY ? "ro" : "rw"); 815 + seq_puts(m, sb_rdonly(root->d_sb) ? "ro" : "rw"); 816 816 seq_puts(m, root->d_sb->s_flags & MS_SYNCHRONOUS ? ",sync" : ""); 817 817 seq_puts(m, root->d_sb->s_flags & MS_NOATIME ? ",noatime" : ""); 818 818 seq_puts(m, root->d_sb->s_flags & MS_NODIRATIME ? ",nodiratime" : "");
+2 -2
fs/nilfs2/inode.c
··· 174 174 struct inode *inode = mapping->host; 175 175 int err = 0; 176 176 177 - if (inode->i_sb->s_flags & MS_RDONLY) { 177 + if (sb_rdonly(inode->i_sb)) { 178 178 nilfs_clear_dirty_pages(mapping, false); 179 179 return -EROFS; 180 180 } ··· 191 191 struct inode *inode = page->mapping->host; 192 192 int err; 193 193 194 - if (inode->i_sb->s_flags & MS_RDONLY) { 194 + if (sb_rdonly(inode->i_sb)) { 195 195 /* 196 196 * It means that filesystem was remounted in read-only 197 197 * mode because of error or metadata corruption. But we
+1 -1
fs/nilfs2/mdt.c
··· 413 413 struct super_block *sb; 414 414 int err = 0; 415 415 416 - if (inode && (inode->i_sb->s_flags & MS_RDONLY)) { 416 + if (inode && sb_rdonly(inode->i_sb)) { 417 417 /* 418 418 * It means that filesystem was remounted in read-only 419 419 * mode because of error or metadata corruption. But we
+9 -10
fs/nilfs2/super.c
··· 136 136 137 137 va_end(args); 138 138 139 - if (!(sb->s_flags & MS_RDONLY)) { 139 + if (!sb_rdonly(sb)) { 140 140 nilfs_set_error(sb); 141 141 142 142 if (nilfs_test_opt(nilfs, ERRORS_RO)) { ··· 478 478 479 479 nilfs_detach_log_writer(sb); 480 480 481 - if (!(sb->s_flags & MS_RDONLY)) { 481 + if (!sb_rdonly(sb)) { 482 482 down_write(&nilfs->ns_sem); 483 483 nilfs_cleanup_super(sb); 484 484 up_write(&nilfs->ns_sem); ··· 578 578 struct the_nilfs *nilfs = sb->s_fs_info; 579 579 int err; 580 580 581 - if (sb->s_flags & MS_RDONLY) 581 + if (sb_rdonly(sb)) 582 582 return 0; 583 583 584 584 /* Mark super block clean */ ··· 592 592 { 593 593 struct the_nilfs *nilfs = sb->s_fs_info; 594 594 595 - if (sb->s_flags & MS_RDONLY) 595 + if (sb_rdonly(sb)) 596 596 return 0; 597 597 598 598 down_write(&nilfs->ns_sem); ··· 898 898 } 899 899 features = le64_to_cpu(sbp->s_feature_compat_ro) & 900 900 ~NILFS_FEATURE_COMPAT_RO_SUPP; 901 - if (!(sb->s_flags & MS_RDONLY) && features) { 901 + if (!sb_rdonly(sb) && features) { 902 902 nilfs_msg(sb, KERN_ERR, 903 903 "couldn't mount RDWR because of unsupported optional features (%llx)", 904 904 (unsigned long long)features); ··· 1083 1083 goto failed_unload; 1084 1084 } 1085 1085 1086 - if (!(sb->s_flags & MS_RDONLY)) { 1086 + if (!sb_rdonly(sb)) { 1087 1087 err = nilfs_attach_log_writer(sb, fsroot); 1088 1088 if (err) 1089 1089 goto failed_checkpoint; ··· 1095 1095 1096 1096 nilfs_put_root(fsroot); 1097 1097 1098 - if (!(sb->s_flags & MS_RDONLY)) { 1098 + if (!sb_rdonly(sb)) { 1099 1099 down_write(&nilfs->ns_sem); 1100 1100 nilfs_setup_super(sb, true); 1101 1101 up_write(&nilfs->ns_sem); ··· 1144 1144 goto restore_opts; 1145 1145 } 1146 1146 1147 - if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) 1147 + if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) 1148 1148 goto out; 1149 1149 if (*flags & MS_RDONLY) { 1150 1150 /* Shutting down log writer */ ··· 1338 1338 if ((flags ^ s->s_flags) & MS_RDONLY) { 1339 1339 nilfs_msg(s, KERN_ERR, 1340 1340 "the device already has a %s mount.", 1341 - (s->s_flags & MS_RDONLY) ? 1342 - "read-only" : "read/write"); 1341 + sb_rdonly(s) ? "read-only" : "read/write"); 1343 1342 err = -EBUSY; 1344 1343 goto failed_super; 1345 1344 }
+14 -17
fs/ntfs/super.c
··· 487 487 * When remounting read-only, mark the volume clean if no volume errors 488 488 * have occurred. 489 489 */ 490 - if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { 490 + if (sb_rdonly(sb) && !(*flags & MS_RDONLY)) { 491 491 static const char *es = ". Cannot remount read-write."; 492 492 493 493 /* Remounting read-write. */ ··· 548 548 NVolSetErrors(vol); 549 549 return -EROFS; 550 550 } 551 - } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) { 551 + } else if (!sb_rdonly(sb) && (*flags & MS_RDONLY)) { 552 552 /* Remounting read-only. */ 553 553 if (!NVolErrors(vol)) { 554 554 if (ntfs_clear_volume_flags(vol, VOLUME_IS_DIRTY)) ··· 732 732 * on a large sector device contains the whole boot loader or 733 733 * just the first 512 bytes). 734 734 */ 735 - if (!(sb->s_flags & MS_RDONLY)) { 735 + if (!sb_rdonly(sb)) { 736 736 ntfs_warning(sb, "Hot-fix: Recovering invalid primary " 737 737 "boot sector from backup copy."); 738 738 memcpy(bh_primary->b_data, bh_backup->b_data, ··· 1789 1789 static const char *es3 = ". Run ntfsfix and/or chkdsk."; 1790 1790 1791 1791 /* If a read-write mount, convert it to a read-only mount. */ 1792 - if (!(sb->s_flags & MS_RDONLY)) { 1792 + if (!sb_rdonly(sb)) { 1793 1793 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | 1794 1794 ON_ERRORS_CONTINUE))) { 1795 1795 ntfs_error(sb, "%s and neither on_errors=" ··· 1928 1928 (unsigned)le16_to_cpu(vol->vol_flags)); 1929 1929 } 1930 1930 /* If a read-write mount, convert it to a read-only mount. */ 1931 - if (!(sb->s_flags & MS_RDONLY)) { 1931 + if (!sb_rdonly(sb)) { 1932 1932 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | 1933 1933 ON_ERRORS_CONTINUE))) { 1934 1934 ntfs_error(sb, "%s and neither on_errors=" ··· 1961 1961 1962 1962 es1 = !vol->logfile_ino ? es1a : es1b; 1963 1963 /* If a read-write mount, convert it to a read-only mount. */ 1964 - if (!(sb->s_flags & MS_RDONLY)) { 1964 + if (!sb_rdonly(sb)) { 1965 1965 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | 1966 1966 ON_ERRORS_CONTINUE))) { 1967 1967 ntfs_error(sb, "%s and neither on_errors=" ··· 2010 2010 2011 2011 es1 = err < 0 ? es1a : es1b; 2012 2012 /* If a read-write mount, convert it to a read-only mount. */ 2013 - if (!(sb->s_flags & MS_RDONLY)) { 2013 + if (!sb_rdonly(sb)) { 2014 2014 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | 2015 2015 ON_ERRORS_CONTINUE))) { 2016 2016 ntfs_error(sb, "%s and neither on_errors=" ··· 2028 2028 NVolSetErrors(vol); 2029 2029 } 2030 2030 /* If (still) a read-write mount, mark the volume dirty. */ 2031 - if (!(sb->s_flags & MS_RDONLY) && 2032 - ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) { 2031 + if (!sb_rdonly(sb) && ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) { 2033 2032 static const char *es1 = "Failed to set dirty bit in volume " 2034 2033 "information flags"; 2035 2034 static const char *es2 = ". Run chkdsk."; ··· 2074 2075 } 2075 2076 #endif 2076 2077 /* If (still) a read-write mount, empty the logfile. */ 2077 - if (!(sb->s_flags & MS_RDONLY) && 2078 - !ntfs_empty_logfile(vol->logfile_ino)) { 2078 + if (!sb_rdonly(sb) && !ntfs_empty_logfile(vol->logfile_ino)) { 2079 2079 static const char *es1 = "Failed to empty $LogFile"; 2080 2080 static const char *es2 = ". Mount in Windows."; 2081 2081 ··· 2119 2121 static const char *es2 = ". Run chkdsk."; 2120 2122 2121 2123 /* If a read-write mount, convert it to a read-only mount. */ 2122 - if (!(sb->s_flags & MS_RDONLY)) { 2124 + if (!sb_rdonly(sb)) { 2123 2125 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | 2124 2126 ON_ERRORS_CONTINUE))) { 2125 2127 ntfs_error(sb, "%s and neither on_errors=" ··· 2137 2139 NVolSetErrors(vol); 2138 2140 } 2139 2141 /* If (still) a read-write mount, mark the quotas out of date. */ 2140 - if (!(sb->s_flags & MS_RDONLY) && 2141 - !ntfs_mark_quotas_out_of_date(vol)) { 2142 + if (!sb_rdonly(sb) && !ntfs_mark_quotas_out_of_date(vol)) { 2142 2143 static const char *es1 = "Failed to mark quotas out of date"; 2143 2144 static const char *es2 = ". Run chkdsk."; 2144 2145 ··· 2162 2165 static const char *es2 = ". Run chkdsk."; 2163 2166 2164 2167 /* If a read-write mount, convert it to a read-only mount. */ 2165 - if (!(sb->s_flags & MS_RDONLY)) { 2168 + if (!sb_rdonly(sb)) { 2166 2169 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | 2167 2170 ON_ERRORS_CONTINUE))) { 2168 2171 ntfs_error(sb, "%s and neither on_errors=" ··· 2180 2183 NVolSetErrors(vol); 2181 2184 } 2182 2185 /* If (still) a read-write mount, stamp the transaction log. */ 2183 - if (!(sb->s_flags & MS_RDONLY) && !ntfs_stamp_usnjrnl(vol)) { 2186 + if (!sb_rdonly(sb) && !ntfs_stamp_usnjrnl(vol)) { 2184 2187 static const char *es1 = "Failed to stamp transaction log " 2185 2188 "($UsnJrnl)"; 2186 2189 static const char *es2 = ". Run chkdsk."; ··· 2311 2314 * If a read-write mount and no volume errors have occurred, mark the 2312 2315 * volume clean. Also, re-commit all affected inodes. 2313 2316 */ 2314 - if (!(sb->s_flags & MS_RDONLY)) { 2317 + if (!sb_rdonly(sb)) { 2315 2318 if (!NVolErrors(vol)) { 2316 2319 if (ntfs_clear_volume_flags(vol, VOLUME_IS_DIRTY)) 2317 2320 ntfs_warning(sb, "Failed to clear dirty bit "
+6 -9
fs/ocfs2/super.c
··· 675 675 } 676 676 677 677 /* We're going to/from readonly mode. */ 678 - if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { 678 + if ((bool)(*flags & MS_RDONLY) != sb_rdonly(sb)) { 679 679 /* Disable quota accounting before remounting RO */ 680 680 if (*flags & MS_RDONLY) { 681 681 ret = ocfs2_susp_quotas(osb, 0); ··· 1063 1063 /* Hard readonly mode only if: bdev_read_only, MS_RDONLY, 1064 1064 * heartbeat=none */ 1065 1065 if (bdev_read_only(sb->s_bdev)) { 1066 - if (!(sb->s_flags & MS_RDONLY)) { 1066 + if (!sb_rdonly(sb)) { 1067 1067 status = -EACCES; 1068 1068 mlog(ML_ERROR, "Readonly device detected but readonly " 1069 1069 "mount was not specified.\n"); ··· 1098 1098 } 1099 1099 1100 1100 if (!ocfs2_is_hard_readonly(osb)) { 1101 - if (sb->s_flags & MS_RDONLY) 1101 + if (sb_rdonly(sb)) 1102 1102 ocfs2_set_ro_flag(osb, 0); 1103 1103 } 1104 1104 ··· 1179 1179 /* Now we can initialize quotas because we can afford to wait 1180 1180 * for cluster locks recovery now. That also means that truncation 1181 1181 * log recovery can happen but that waits for proper quota setup */ 1182 - if (!(sb->s_flags & MS_RDONLY)) { 1182 + if (!sb_rdonly(sb)) { 1183 1183 status = ocfs2_enable_quotas(osb); 1184 1184 if (status < 0) { 1185 1185 /* We have to err-out specially here because ··· 2180 2180 status = -EINVAL; 2181 2181 goto bail; 2182 2182 } 2183 - if (!(osb->sb->s_flags & MS_RDONLY) && 2184 - (i = OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, ~OCFS2_FEATURE_RO_COMPAT_SUPP))) { 2183 + if (!sb_rdonly(osb->sb) && (i = OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, ~OCFS2_FEATURE_RO_COMPAT_SUPP))) { 2185 2184 mlog(ML_ERROR, "couldn't mount RDWR because of " 2186 2185 "unsupported optional features (%x).\n", i); 2187 2186 status = -EINVAL; ··· 2567 2568 rv = -EIO; 2568 2569 } else { /* default option */ 2569 2570 rv = -EROFS; 2570 - if (sb->s_flags & MS_RDONLY && 2571 - (ocfs2_is_soft_readonly(osb) || 2572 - ocfs2_is_hard_readonly(osb))) 2571 + if (sb_rdonly(sb) && (ocfs2_is_soft_readonly(osb) || ocfs2_is_hard_readonly(osb))) 2573 2572 return rv; 2574 2573 2575 2574 pr_crit("OCFS2: File system is now read-only.\n");
+1 -1
fs/overlayfs/super.c
··· 869 869 goto out_free_config; 870 870 871 871 /* Upper fs should not be r/o */ 872 - if (upperpath.mnt->mnt_sb->s_flags & MS_RDONLY) { 872 + if (sb_rdonly(upperpath.mnt->mnt_sb)) { 873 873 pr_err("overlayfs: upper fs is r/o, try multi-lower layers mount\n"); 874 874 err = -EINVAL; 875 875 goto out_put_upperpath;
+1 -1
fs/proc_namespace.c
··· 178 178 } else { 179 179 mangle(m, r->mnt_devname ? r->mnt_devname : "none"); 180 180 } 181 - seq_puts(m, sb->s_flags & MS_RDONLY ? " ro" : " rw"); 181 + seq_puts(m, sb_rdonly(sb) ? " ro" : " rw"); 182 182 err = show_sb_opts(m, sb); 183 183 if (err) 184 184 goto out;
+1 -1
fs/quota/quota.c
··· 753 753 case Q_XGETNEXTQUOTA: 754 754 return quota_getnextxquota(sb, type, id, addr); 755 755 case Q_XQUOTASYNC: 756 - if (sb->s_flags & MS_RDONLY) 756 + if (sb_rdonly(sb)) 757 757 return -EROFS; 758 758 /* XFS quotas are fully coherent now, making this call a noop */ 759 759 return 0;
+1 -1
fs/reiserfs/inode.c
··· 1776 1776 struct reiserfs_transaction_handle th; 1777 1777 int jbegin_count = 1; 1778 1778 1779 - if (inode->i_sb->s_flags & MS_RDONLY) 1779 + if (sb_rdonly(inode->i_sb)) 1780 1780 return -EROFS; 1781 1781 /* 1782 1782 * memory pressure can sometimes initiate write_inode calls with
+1 -1
fs/reiserfs/journal.c
··· 1918 1918 * we only want to flush out transactions if we were 1919 1919 * called with error == 0 1920 1920 */ 1921 - if (!error && !(sb->s_flags & MS_RDONLY)) { 1921 + if (!error && !sb_rdonly(sb)) { 1922 1922 /* end the current trans */ 1923 1923 BUG_ON(!th->t_trans_id); 1924 1924 do_journal_end(th, FLUSH_ALL);
+1 -1
fs/reiserfs/prints.c
··· 386 386 printk(KERN_CRIT "REISERFS error (device %s): %s: %s\n", 387 387 sb->s_id, function, error_buf); 388 388 389 - if (sb->s_flags & MS_RDONLY) 389 + if (sb_rdonly(sb)) 390 390 return; 391 391 392 392 reiserfs_info(sb, "Remounting filesystem read-only\n");
+9 -9
fs/reiserfs/super.c
··· 121 121 * Avoid scheduling flush when sb is being shut down. It can race 122 122 * with journal shutdown and free still queued delayed work. 123 123 */ 124 - if (s->s_flags & MS_RDONLY || !(s->s_flags & MS_ACTIVE)) 124 + if (sb_rdonly(s) || !(s->s_flags & MS_ACTIVE)) 125 125 return; 126 126 127 127 spin_lock(&sbi->old_work_lock); ··· 151 151 reiserfs_cancel_old_flush(s); 152 152 153 153 reiserfs_write_lock(s); 154 - if (!(s->s_flags & MS_RDONLY)) { 154 + if (!sb_rdonly(s)) { 155 155 int err = journal_begin(&th, s, 1); 156 156 if (err) { 157 157 reiserfs_block_writes(&th); ··· 599 599 * change file system state to current state if it was mounted 600 600 * with read-write permissions 601 601 */ 602 - if (!(s->s_flags & MS_RDONLY)) { 602 + if (!sb_rdonly(s)) { 603 603 if (!journal_begin(&th, s, 10)) { 604 604 reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 605 605 1); ··· 700 700 701 701 int err = 0; 702 702 703 - if (inode->i_sb->s_flags & MS_RDONLY) { 703 + if (sb_rdonly(inode->i_sb)) { 704 704 reiserfs_warning(inode->i_sb, "clm-6006", 705 705 "writing inode %lu on readonly FS", 706 706 inode->i_ino); ··· 1525 1525 reiserfs_write_unlock(s); 1526 1526 reiserfs_xattr_init(s, *mount_flags); 1527 1527 /* remount read-only */ 1528 - if (s->s_flags & MS_RDONLY) 1528 + if (sb_rdonly(s)) 1529 1529 /* it is read-only already */ 1530 1530 goto out_ok_unlocked; 1531 1531 ··· 1551 1551 journal_mark_dirty(&th, SB_BUFFER_WITH_SB(s)); 1552 1552 } else { 1553 1553 /* remount read-write */ 1554 - if (!(s->s_flags & MS_RDONLY)) { 1554 + if (!sb_rdonly(s)) { 1555 1555 reiserfs_write_unlock(s); 1556 1556 reiserfs_xattr_init(s, *mount_flags); 1557 1557 goto out_ok_unlocked; /* We are read-write already */ ··· 1855 1855 * the super 1856 1856 */ 1857 1857 if (code != UNSET_HASH && 1858 - !(s->s_flags & MS_RDONLY) && 1858 + !sb_rdonly(s) && 1859 1859 code != sb_hash_function_code(SB_DISK_SUPER_BLOCK(s))) { 1860 1860 set_sb_hash_function_code(SB_DISK_SUPER_BLOCK(s), code); 1861 1861 } ··· 2052 2052 if (replay_only(s)) 2053 2053 goto error_unlocked; 2054 2054 2055 - if (bdev_read_only(s->s_bdev) && !(s->s_flags & MS_RDONLY)) { 2055 + if (bdev_read_only(s->s_bdev) && !sb_rdonly(s)) { 2056 2056 SWARN(silent, s, "clm-7000", 2057 2057 "Detected readonly device, marking FS readonly"); 2058 2058 s->s_flags |= MS_RDONLY; ··· 2101 2101 else 2102 2102 set_bit(REISERFS_3_6, &sbi->s_properties); 2103 2103 2104 - if (!(s->s_flags & MS_RDONLY)) { 2104 + if (!sb_rdonly(s)) { 2105 2105 2106 2106 errval = journal_begin(&th, s, 1); 2107 2107 if (errval) {
+5 -5
fs/super.c
··· 820 820 return -EACCES; 821 821 #endif 822 822 823 - remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY); 823 + remount_ro = (flags & MS_RDONLY) && !sb_rdonly(sb); 824 824 825 825 if (remount_ro) { 826 826 if (!hlist_empty(&sb->s_pins)) { ··· 831 831 return 0; 832 832 if (sb->s_writers.frozen != SB_UNFROZEN) 833 833 return -EBUSY; 834 - remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY); 834 + remount_ro = (flags & MS_RDONLY) && !sb_rdonly(sb); 835 835 } 836 836 } 837 837 shrink_dcache_sb(sb); ··· 893 893 spin_unlock(&sb_lock); 894 894 down_write(&sb->s_umount); 895 895 if (sb->s_root && sb->s_bdev && (sb->s_flags & MS_BORN) && 896 - !(sb->s_flags & MS_RDONLY)) { 896 + !sb_rdonly(sb)) { 897 897 /* 898 898 * What lock protects sb->s_flags?? 899 899 */ ··· 1439 1439 return 0; /* sic - it's "nothing to do" */ 1440 1440 } 1441 1441 1442 - if (sb->s_flags & MS_RDONLY) { 1442 + if (sb_rdonly(sb)) { 1443 1443 /* Nothing to do really... */ 1444 1444 sb->s_writers.frozen = SB_FREEZE_COMPLETE; 1445 1445 up_write(&sb->s_umount); ··· 1502 1502 return -EINVAL; 1503 1503 } 1504 1504 1505 - if (sb->s_flags & MS_RDONLY) { 1505 + if (sb_rdonly(sb)) { 1506 1506 sb->s_writers.frozen = SB_UNFROZEN; 1507 1507 goto out; 1508 1508 }
+3 -3
fs/sync.c
··· 57 57 /* 58 58 * No point in syncing out anything if the filesystem is read-only. 59 59 */ 60 - if (sb->s_flags & MS_RDONLY) 60 + if (sb_rdonly(sb)) 61 61 return 0; 62 62 63 63 ret = __sync_filesystem(sb, 0); ··· 69 69 70 70 static void sync_inodes_one_sb(struct super_block *sb, void *arg) 71 71 { 72 - if (!(sb->s_flags & MS_RDONLY)) 72 + if (!sb_rdonly(sb)) 73 73 sync_inodes_sb(sb); 74 74 } 75 75 76 76 static void sync_fs_one_sb(struct super_block *sb, void *arg) 77 77 { 78 - if (!(sb->s_flags & MS_RDONLY) && sb->s_op->sync_fs) 78 + if (!sb_rdonly(sb) && sb->s_op->sync_fs) 79 79 sb->s_op->sync_fs(sb, *(int *)arg); 80 80 } 81 81
+1 -1
fs/sysv/balloc.c
··· 231 231 Ecount: 232 232 printk("sysv_count_free_blocks: free block count was %d, " 233 233 "correcting to %d\n", sb_count, count); 234 - if (!(sb->s_flags & MS_RDONLY)) { 234 + if (!sb_rdonly(sb)) { 235 235 *sbi->s_free_blocks = cpu_to_fs32(sbi, count); 236 236 dirty_sb(sb); 237 237 }
+1 -1
fs/sysv/ialloc.c
··· 220 220 printk("sysv_count_free_inodes: " 221 221 "free inode count was %d, correcting to %d\n", 222 222 sb_count, count); 223 - if (!(sb->s_flags & MS_RDONLY)) { 223 + if (!sb_rdonly(sb)) { 224 224 *sbi->s_sb_total_free_inodes = cpu_to_fs16(SYSV_SB(sb), count); 225 225 dirty_sb(sb); 226 226 }
+1 -1
fs/sysv/inode.c
··· 70 70 { 71 71 struct sysv_sb_info *sbi = SYSV_SB(sb); 72 72 73 - if (!(sb->s_flags & MS_RDONLY)) { 73 + if (!sb_rdonly(sb)) { 74 74 /* XXX ext2 also updates the state here */ 75 75 mark_buffer_dirty(sbi->s_bh1); 76 76 if (sbi->s_bh1 != sbi->s_bh2)
+1 -1
fs/sysv/super.c
··· 216 216 if (fs16_to_cpu(sbi, sbd->s_nfree) == 0xffff) { 217 217 sbi->s_type = FSTYPE_AFS; 218 218 sbi->s_forced_ro = 1; 219 - if (!(sb->s_flags & MS_RDONLY)) { 219 + if (!sb_rdonly(sb)) { 220 220 printk("SysV FS: SCO EAFS on %s detected, " 221 221 "forcing read-only mode.\n", 222 222 sb->s_id);
+1 -1
fs/ubifs/super.c
··· 1159 1159 long long x, y; 1160 1160 size_t sz; 1161 1161 1162 - c->ro_mount = !!(c->vfs_sb->s_flags & MS_RDONLY); 1162 + c->ro_mount = !!sb_rdonly(c->vfs_sb); 1163 1163 /* Suppress error messages while probing if MS_SILENT is set */ 1164 1164 c->probing = !!(c->vfs_sb->s_flags & MS_SILENT); 1165 1165
+7 -7
fs/udf/super.c
··· 675 675 sbi->s_dmode = uopt.dmode; 676 676 write_unlock(&sbi->s_cred_lock); 677 677 678 - if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) 678 + if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) 679 679 goto out_unlock; 680 680 681 681 if (*flags & MS_RDONLY) ··· 1019 1019 1020 1020 fe = udf_iget_special(sb, &addr); 1021 1021 if (IS_ERR(fe)) { 1022 - if (sb->s_flags & MS_RDONLY) 1022 + if (sb_rdonly(sb)) 1023 1023 udf_warn(sb, "bitmap inode efe not found but it's ok since the disc is mounted read-only\n"); 1024 1024 else { 1025 1025 udf_err(sb, "bitmap inode efe not found and attempted read-write mount\n"); ··· 1343 1343 * writing to it (we overwrite blocks instead of relocating 1344 1344 * them). 1345 1345 */ 1346 - if (!(sb->s_flags & MS_RDONLY)) { 1346 + if (!sb_rdonly(sb)) { 1347 1347 ret = -EACCES; 1348 1348 goto out_bh; 1349 1349 } ··· 2207 2207 ret = -EINVAL; 2208 2208 goto error_out; 2209 2209 } else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION && 2210 - !(sb->s_flags & MS_RDONLY)) { 2210 + !sb_rdonly(sb)) { 2211 2211 ret = -EACCES; 2212 2212 goto error_out; 2213 2213 } ··· 2228 2228 2229 2229 if (sbi->s_partmaps[sbi->s_partition].s_partition_flags & 2230 2230 UDF_PART_FLAG_READ_ONLY && 2231 - !(sb->s_flags & MS_RDONLY)) { 2231 + !sb_rdonly(sb)) { 2232 2232 ret = -EACCES; 2233 2233 goto error_out; 2234 2234 } ··· 2247 2247 le16_to_cpu(ts.year), ts.month, ts.day, 2248 2248 ts.hour, ts.minute, le16_to_cpu(ts.typeAndTimezone)); 2249 2249 } 2250 - if (!(sb->s_flags & MS_RDONLY)) { 2250 + if (!sb_rdonly(sb)) { 2251 2251 udf_open_lvid(sb); 2252 2252 lvid_open = true; 2253 2253 } ··· 2334 2334 if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) 2335 2335 unload_nls(sbi->s_nls_map); 2336 2336 #endif 2337 - if (!(sb->s_flags & MS_RDONLY)) 2337 + if (!sb_rdonly(sb)) 2338 2338 udf_close_lvid(sb); 2339 2339 brelse(sbi->s_lvid_bh); 2340 2340 udf_sb_free_partitions(sb);
+12 -12
fs/ufs/super.c
··· 278 278 uspi = UFS_SB(sb)->s_uspi; 279 279 usb1 = ubh_get_usb_first(uspi); 280 280 281 - if (!(sb->s_flags & MS_RDONLY)) { 281 + if (!sb_rdonly(sb)) { 282 282 usb1->fs_clean = UFS_FSBAD; 283 283 ubh_mark_buffer_dirty(USPI_UBH(uspi)); 284 284 ufs_mark_sb_dirty(sb); ··· 312 312 uspi = UFS_SB(sb)->s_uspi; 313 313 usb1 = ubh_get_usb_first(uspi); 314 314 315 - if (!(sb->s_flags & MS_RDONLY)) { 315 + if (!sb_rdonly(sb)) { 316 316 usb1->fs_clean = UFS_FSBAD; 317 317 ubh_mark_buffer_dirty(USPI_UBH(uspi)); 318 318 ufs_mark_sb_dirty(sb); ··· 742 742 743 743 UFSD("ENTER\n"); 744 744 745 - if (!(sb->s_flags & MS_RDONLY)) 745 + if (!sb_rdonly(sb)) 746 746 ufs_put_super_internal(sb); 747 747 cancel_delayed_work_sync(&sbi->sync_work); 748 748 ··· 793 793 UFSD("ENTER\n"); 794 794 795 795 #ifndef CONFIG_UFS_FS_WRITE 796 - if (!(sb->s_flags & MS_RDONLY)) { 796 + if (!sb_rdonly(sb)) { 797 797 pr_err("ufs was compiled with read-only support, can't be mounted as read-write\n"); 798 798 return -EROFS; 799 799 } ··· 805 805 sb->s_fs_info = sbi; 806 806 sbi->sb = sb; 807 807 808 - UFSD("flag %u\n", (int)(sb->s_flags & MS_RDONLY)); 808 + UFSD("flag %u\n", (int)(sb_rdonly(sb))); 809 809 810 810 mutex_init(&sbi->s_lock); 811 811 spin_lock_init(&sbi->work_lock); ··· 902 902 uspi->s_sbsize = super_block_size = 2048; 903 903 uspi->s_sbbase = 0; 904 904 flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; 905 - if (!(sb->s_flags & MS_RDONLY)) { 905 + if (!sb_rdonly(sb)) { 906 906 if (!silent) 907 907 pr_info("ufstype=old is supported read-only\n"); 908 908 sb->s_flags |= MS_RDONLY; ··· 918 918 uspi->s_sbbase = 0; 919 919 uspi->s_dirblksize = 1024; 920 920 flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; 921 - if (!(sb->s_flags & MS_RDONLY)) { 921 + if (!sb_rdonly(sb)) { 922 922 if (!silent) 923 923 pr_info("ufstype=nextstep is supported read-only\n"); 924 924 sb->s_flags |= MS_RDONLY; ··· 934 934 uspi->s_sbbase = 0; 935 935 uspi->s_dirblksize = 1024; 936 936 flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; 937 - if (!(sb->s_flags & MS_RDONLY)) { 937 + if (!sb_rdonly(sb)) { 938 938 if (!silent) 939 939 pr_info("ufstype=nextstep-cd is supported read-only\n"); 940 940 sb->s_flags |= MS_RDONLY; ··· 950 950 uspi->s_sbbase = 0; 951 951 uspi->s_dirblksize = 1024; 952 952 flags |= UFS_DE_44BSD | UFS_UID_44BSD | UFS_ST_44BSD | UFS_CG_44BSD; 953 - if (!(sb->s_flags & MS_RDONLY)) { 953 + if (!sb_rdonly(sb)) { 954 954 if (!silent) 955 955 pr_info("ufstype=openstep is supported read-only\n"); 956 956 sb->s_flags |= MS_RDONLY; ··· 965 965 uspi->s_sbsize = super_block_size = 2048; 966 966 uspi->s_sbbase = 0; 967 967 flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; 968 - if (!(sb->s_flags & MS_RDONLY)) { 968 + if (!sb_rdonly(sb)) { 969 969 if (!silent) 970 970 pr_info("ufstype=hp is supported read-only\n"); 971 971 sb->s_flags |= MS_RDONLY; ··· 1273 1273 /* 1274 1274 * Read cylinder group structures 1275 1275 */ 1276 - if (!(sb->s_flags & MS_RDONLY)) 1276 + if (!sb_rdonly(sb)) 1277 1277 if (!ufs_read_cylinder_structures(sb)) 1278 1278 goto failed; 1279 1279 ··· 1328 1328 return -EINVAL; 1329 1329 } 1330 1330 1331 - if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { 1331 + if ((bool)(*mount_flags & MS_RDONLY) == sb_rdonly(sb)) { 1332 1332 UFS_SB(sb)->s_mount_opt = new_mount_opt; 1333 1333 mutex_unlock(&UFS_SB(sb)->s_lock); 1334 1334 return 0;
+5 -5
fs/xfs/xfs_quotaops.c
··· 125 125 struct xfs_mount *mp = XFS_M(sb); 126 126 struct qc_dqblk newlim; 127 127 128 - if (sb->s_flags & MS_RDONLY) 128 + if (sb_rdonly(sb)) 129 129 return -EROFS; 130 130 if (!XFS_IS_QUOTA_RUNNING(mp)) 131 131 return -ENOSYS; ··· 175 175 { 176 176 struct xfs_mount *mp = XFS_M(sb); 177 177 178 - if (sb->s_flags & MS_RDONLY) 178 + if (sb_rdonly(sb)) 179 179 return -EROFS; 180 180 if (!XFS_IS_QUOTA_RUNNING(mp)) 181 181 return -ENOSYS; ··· 190 190 { 191 191 struct xfs_mount *mp = XFS_M(sb); 192 192 193 - if (sb->s_flags & MS_RDONLY) 193 + if (sb_rdonly(sb)) 194 194 return -EROFS; 195 195 if (!XFS_IS_QUOTA_RUNNING(mp)) 196 196 return -ENOSYS; ··· 208 208 struct xfs_mount *mp = XFS_M(sb); 209 209 unsigned int flags = 0; 210 210 211 - if (sb->s_flags & MS_RDONLY) 211 + if (sb_rdonly(sb)) 212 212 return -EROFS; 213 213 214 214 if (XFS_IS_QUOTA_ON(mp)) ··· 279 279 { 280 280 struct xfs_mount *mp = XFS_M(sb); 281 281 282 - if (sb->s_flags & MS_RDONLY) 282 + if (sb_rdonly(sb)) 283 283 return -EROFS; 284 284 if (!XFS_IS_QUOTA_RUNNING(mp)) 285 285 return -ENOSYS;
+1 -1
fs/xfs/xfs_super.c
··· 210 210 /* 211 211 * Copy binary VFS mount flags we are interested in. 212 212 */ 213 - if (sb->s_flags & MS_RDONLY) 213 + if (sb_rdonly(sb)) 214 214 mp->m_flags |= XFS_MOUNT_RDONLY; 215 215 if (sb->s_flags & MS_DIRSYNC) 216 216 mp->m_flags |= XFS_MOUNT_DIRSYNC;
+1 -1
init/do_mounts.c
··· 373 373 printk(KERN_INFO 374 374 "VFS: Mounted root (%s filesystem)%s on device %u:%u.\n", 375 375 s->s_type->name, 376 - s->s_flags & MS_RDONLY ? " readonly" : "", 376 + sb_rdonly(s) ? " readonly" : "", 377 377 MAJOR(ROOT_DEV), MINOR(ROOT_DEV)); 378 378 return 0; 379 379 }