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>
This commit is contained in:
@@ -52,7 +52,7 @@ void ext2_error(struct super_block *sb, const char *function,
|
||||
struct ext2_sb_info *sbi = EXT2_SB(sb);
|
||||
struct ext2_super_block *es = sbi->s_es;
|
||||
|
||||
if (!(sb->s_flags & MS_RDONLY)) {
|
||||
if (!sb_rdonly(sb)) {
|
||||
spin_lock(&sbi->s_lock);
|
||||
sbi->s_mount_state |= EXT2_ERROR_FS;
|
||||
es->s_state |= cpu_to_le16(EXT2_ERROR_FS);
|
||||
@@ -151,7 +151,7 @@ static void ext2_put_super (struct super_block * sb)
|
||||
ext2_xattr_destroy_cache(sbi->s_ea_block_cache);
|
||||
sbi->s_ea_block_cache = NULL;
|
||||
}
|
||||
if (!(sb->s_flags & MS_RDONLY)) {
|
||||
if (!sb_rdonly(sb)) {
|
||||
struct ext2_super_block *es = sbi->s_es;
|
||||
|
||||
spin_lock(&sbi->s_lock);
|
||||
@@ -940,8 +940,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
|
||||
le32_to_cpu(features));
|
||||
goto failed_mount;
|
||||
}
|
||||
if (!(sb->s_flags & MS_RDONLY) &&
|
||||
(features = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){
|
||||
if (!sb_rdonly(sb) && (features = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){
|
||||
ext2_msg(sb, KERN_ERR, "error: couldn't mount RDWR because of "
|
||||
"unsupported optional features (%x)",
|
||||
le32_to_cpu(features));
|
||||
@@ -1170,7 +1169,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
|
||||
if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL))
|
||||
ext2_msg(sb, KERN_WARNING,
|
||||
"warning: mounting ext3 filesystem as ext2");
|
||||
if (ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY))
|
||||
if (ext2_setup_super (sb, es, sb_rdonly(sb)))
|
||||
sb->s_flags |= MS_RDONLY;
|
||||
ext2_write_super(sb);
|
||||
return 0;
|
||||
@@ -1301,7 +1300,7 @@ static int ext2_unfreeze(struct super_block *sb)
|
||||
|
||||
static void ext2_write_super(struct super_block *sb)
|
||||
{
|
||||
if (!(sb->s_flags & MS_RDONLY))
|
||||
if (!sb_rdonly(sb))
|
||||
ext2_sync_fs(sb, 1);
|
||||
}
|
||||
|
||||
@@ -1339,7 +1338,7 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
|
||||
"dax flag with busy inodes while remounting");
|
||||
sbi->s_mount_opt ^= EXT2_MOUNT_DAX;
|
||||
}
|
||||
if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) {
|
||||
if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) {
|
||||
spin_unlock(&sbi->s_lock);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user