Skip to content

Commit

Permalink
Rename superblock flags (MS_xyz -> SB_xyz)
Browse files Browse the repository at this point in the history
This is a pure automated search-and-replace of the internal kernel
superblock flags.

The s_flags are now called SB_*, with the names and the values for the
moment mirroring the MS_* flags that they're equivalent to.

Note how the MS_xyz flags are the ones passed to the mount system call,
while the SB_xyz flags are what we then use in sb->s_flags.

The script to do this was:

    # places to look in; re security/*: it generally should *not* be
    # touched (that stuff parses mount(2) arguments directly), but
    # there are two places where we really deal with superblock flags.
    FILES="drivers/mtd drivers/staging/lustre fs ipc mm \
            include/linux/fs.h include/uapi/linux/bfs_fs.h \
            security/apparmor/apparmorfs.c security/apparmor/include/lib.h"
    # the list of MS_... constants
    SYMS="RDONLY NOSUID NODEV NOEXEC SYNCHRONOUS REMOUNT MANDLOCK \
          DIRSYNC NOATIME NODIRATIME BIND MOVE REC VERBOSE SILENT \
          POSIXACL UNBINDABLE PRIVATE SLAVE SHARED RELATIME KERNMOUNT \
          I_VERSION STRICTATIME LAZYTIME SUBMOUNT NOREMOTELOCK NOSEC BORN \
          ACTIVE NOUSER"

    SED_PROG=
    for i in $SYMS; do SED_PROG="$SED_PROG -e s/MS_$i/SB_$i/g"; done

    # we want files that contain at least one of MS_...,
    # with fs/namespace.c and fs/pnode.c excluded.
    L=$(for i in $SYMS; do git grep -w -l MS_$i $FILES; done| sort|uniq|grep -v '^fs/namespace.c'|grep -v '^fs/pnode.c')

    for f in $L; do sed -i $f $SED_PROG; done

Requested-by: Al Viro <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
torvalds committed Nov 27, 2017
1 parent 141cbfb commit 1751e8a
Show file tree
Hide file tree
Showing 111 changed files with 417 additions and 417 deletions.
6 changes: 3 additions & 3 deletions drivers/mtd/mtdsuper.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ static struct dentry *mount_mtd_aux(struct file_system_type *fs_type, int flags,
pr_debug("MTDSB: New superblock for device %d (\"%s\")\n",
mtd->index, mtd->name);

ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
ret = fill_super(sb, data, flags & SB_SILENT ? 1 : 0);
if (ret < 0) {
deactivate_locked_super(sb);
return ERR_PTR(ret);
}

/* go */
sb->s_flags |= MS_ACTIVE;
sb->s_flags |= SB_ACTIVE;
return dget(sb->s_root);

/* new mountpoint for an already mounted superblock */
Expand Down Expand Up @@ -202,7 +202,7 @@ struct dentry *mount_mtd(struct file_system_type *fs_type, int flags,
not_an_MTD_device:
#endif /* CONFIG_BLOCK */

if (!(flags & MS_SILENT))
if (!(flags & SB_SILENT))
printk(KERN_NOTICE
"MTD: Attempt to mount non-MTD device \"%s\"\n",
dev_name);
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/lustre/lustre/llite/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ static bool file_is_noatime(const struct file *file)
if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))
return true;

if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode))
if ((inode->i_sb->s_flags & SB_NODIRATIME) && S_ISDIR(inode->i_mode))
return true;

return false;
Expand Down
14 changes: 7 additions & 7 deletions drivers/staging/lustre/lustre/llite/llite_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,11 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
}

if (data->ocd_connect_flags & OBD_CONNECT_ACL) {
sb->s_flags |= MS_POSIXACL;
sb->s_flags |= SB_POSIXACL;
sbi->ll_flags |= LL_SBI_ACL;
} else {
LCONSOLE_INFO("client wants to enable acl, but mdt not!\n");
sb->s_flags &= ~MS_POSIXACL;
sb->s_flags &= ~SB_POSIXACL;
sbi->ll_flags &= ~LL_SBI_ACL;
}

Expand Down Expand Up @@ -660,7 +660,7 @@ void ll_kill_super(struct super_block *sb)
struct ll_sb_info *sbi;

/* not init sb ?*/
if (!(sb->s_flags & MS_ACTIVE))
if (!(sb->s_flags & SB_ACTIVE))
return;

sbi = ll_s2sbi(sb);
Expand Down Expand Up @@ -2039,8 +2039,8 @@ int ll_remount_fs(struct super_block *sb, int *flags, char *data)
int err;
__u32 read_only;

if ((bool)(*flags & MS_RDONLY) != sb_rdonly(sb)) {
read_only = *flags & MS_RDONLY;
if ((bool)(*flags & SB_RDONLY) != sb_rdonly(sb)) {
read_only = *flags & SB_RDONLY;
err = obd_set_info_async(NULL, sbi->ll_md_exp,
sizeof(KEY_READ_ONLY),
KEY_READ_ONLY, sizeof(read_only),
Expand All @@ -2053,9 +2053,9 @@ int ll_remount_fs(struct super_block *sb, int *flags, char *data)
}

if (read_only)
sb->s_flags |= MS_RDONLY;
sb->s_flags |= SB_RDONLY;
else
sb->s_flags &= ~MS_RDONLY;
sb->s_flags &= ~SB_RDONLY;

if (sbi->ll_flags & LL_SBI_VERBOSE)
LCONSOLE_WARN("Remounted %s %s\n", profilenm,
Expand Down
6 changes: 3 additions & 3 deletions fs/9p/vfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,
if (v9ses->cache)
sb->s_bdi->ra_pages = (VM_MAX_READAHEAD * 1024)/PAGE_SIZE;

sb->s_flags |= MS_ACTIVE | MS_DIRSYNC | MS_NOATIME;
sb->s_flags |= SB_ACTIVE | SB_DIRSYNC | SB_NOATIME;
if (!v9ses->cache)
sb->s_flags |= MS_SYNCHRONOUS;
sb->s_flags |= SB_SYNCHRONOUS;

#ifdef CONFIG_9P_FS_POSIX_ACL
if ((v9ses->flags & V9FS_ACL_MASK) == V9FS_POSIX_ACL)
sb->s_flags |= MS_POSIXACL;
sb->s_flags |= SB_POSIXACL;
#endif

return 0;
Expand Down
4 changes: 2 additions & 2 deletions fs/adfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ static int parse_options(struct super_block *sb, char *options)
static int adfs_remount(struct super_block *sb, int *flags, char *data)
{
sync_filesystem(sb);
*flags |= MS_NODIRATIME;
*flags |= SB_NODIRATIME;
return parse_options(sb, data);
}

Expand Down Expand Up @@ -372,7 +372,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
struct inode *root;
int ret = -EINVAL;

sb->s_flags |= MS_NODIRATIME;
sb->s_flags |= SB_NODIRATIME;

asb = kzalloc(sizeof(*asb), GFP_KERNEL);
if (!asb)
Expand Down
2 changes: 1 addition & 1 deletion fs/affs/amigaffs.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ affs_error(struct super_block *sb, const char *function, const char *fmt, ...)
pr_crit("error (device %s): %s(): %pV\n", sb->s_id, function, &vaf);
if (!sb_rdonly(sb))
pr_warn("Remounting filesystem read-only\n");
sb->s_flags |= MS_RDONLY;
sb->s_flags |= SB_RDONLY;
va_end(args);
}

Expand Down
6 changes: 3 additions & 3 deletions fs/affs/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,12 @@ int affs_init_bitmap(struct super_block *sb, int *flags)
int i, res = 0;
struct affs_sb_info *sbi = AFFS_SB(sb);

if (*flags & MS_RDONLY)
if (*flags & SB_RDONLY)
return 0;

if (!AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag) {
pr_notice("Bitmap invalid - mounting %s read only\n", sb->s_id);
*flags |= MS_RDONLY;
*flags |= SB_RDONLY;
return 0;
}

Expand Down Expand Up @@ -288,7 +288,7 @@ int affs_init_bitmap(struct super_block *sb, int *flags)
if (affs_checksum_block(sb, bh)) {
pr_warn("Bitmap %u invalid - mounting %s read only.\n",
bm->bm_key, sb->s_id);
*flags |= MS_RDONLY;
*flags |= SB_RDONLY;
goto out;
}
pr_debug("read bitmap block %d: %d\n", blk, bm->bm_key);
Expand Down
16 changes: 8 additions & 8 deletions fs/affs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)

sb->s_magic = AFFS_SUPER_MAGIC;
sb->s_op = &affs_sops;
sb->s_flags |= MS_NODIRATIME;
sb->s_flags |= SB_NODIRATIME;

sbi = kzalloc(sizeof(struct affs_sb_info), GFP_KERNEL);
if (!sbi)
Expand Down Expand Up @@ -466,7 +466,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
if ((chksum == FS_DCFFS || chksum == MUFS_DCFFS || chksum == FS_DCOFS
|| chksum == MUFS_DCOFS) && !sb_rdonly(sb)) {
pr_notice("Dircache FS - mounting %s read only\n", sb->s_id);
sb->s_flags |= MS_RDONLY;
sb->s_flags |= SB_RDONLY;
}
switch (chksum) {
case MUFS_FS:
Expand All @@ -488,7 +488,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
/* fall thru */
case FS_OFS:
affs_set_opt(sbi->s_flags, SF_OFS);
sb->s_flags |= MS_NOEXEC;
sb->s_flags |= SB_NOEXEC;
break;
case MUFS_DCOFS:
case MUFS_INTLOFS:
Expand All @@ -497,7 +497,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
case FS_INTLOFS:
affs_set_opt(sbi->s_flags, SF_INTL);
affs_set_opt(sbi->s_flags, SF_OFS);
sb->s_flags |= MS_NOEXEC;
sb->s_flags |= SB_NOEXEC;
break;
default:
pr_err("Unknown filesystem on device %s: %08X\n",
Expand All @@ -513,7 +513,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
sig, sig[3] + '0', blocksize);
}

sb->s_flags |= MS_NODEV | MS_NOSUID;
sb->s_flags |= SB_NODEV | SB_NOSUID;

sbi->s_data_blksize = sb->s_blocksize;
if (affs_test_opt(sbi->s_flags, SF_OFS))
Expand Down Expand Up @@ -570,7 +570,7 @@ affs_remount(struct super_block *sb, int *flags, char *data)
pr_debug("%s(flags=0x%x,opts=\"%s\")\n", __func__, *flags, data);

sync_filesystem(sb);
*flags |= MS_NODIRATIME;
*flags |= SB_NODIRATIME;

memcpy(volume, sbi->s_volume, 32);
if (!parse_options(data, &uid, &gid, &mode, &reserved, &root_block,
Expand All @@ -596,10 +596,10 @@ affs_remount(struct super_block *sb, int *flags, char *data)
memcpy(sbi->s_volume, volume, 32);
spin_unlock(&sbi->symlink_lock);

if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb))
if ((bool)(*flags & SB_RDONLY) == sb_rdonly(sb))
return 0;

if (*flags & MS_RDONLY)
if (*flags & SB_RDONLY)
affs_free_bitmap(sb);
else
res = affs_init_bitmap(sb, flags);
Expand Down
4 changes: 2 additions & 2 deletions fs/afs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,10 @@ static struct dentry *afs_mount(struct file_system_type *fs_type,
if (ret < 0)
goto error_sb;
as = NULL;
sb->s_flags |= MS_ACTIVE;
sb->s_flags |= SB_ACTIVE;
} else {
_debug("reuse");
ASSERTCMP(sb->s_flags, &, MS_ACTIVE);
ASSERTCMP(sb->s_flags, &, SB_ACTIVE);
afs_destroy_sbi(as);
as = NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion fs/befs/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ Version 0.4 (2001-10-28)
(fs/befs/super.c)

* Tell the kernel to only mount befs read-only.
By setting the MS_RDONLY flag in befs_read_super().
By setting the SB_RDONLY flag in befs_read_super().
Not that it was possible to write before. But now the kernel won't even try.
(fs/befs/super.c)

Expand Down
4 changes: 2 additions & 2 deletions fs/befs/linuxvfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
if (!sb_rdonly(sb)) {
befs_warning(sb,
"No write support. Marking filesystem read-only");
sb->s_flags |= MS_RDONLY;
sb->s_flags |= SB_RDONLY;
}

/*
Expand Down Expand Up @@ -948,7 +948,7 @@ static int
befs_remount(struct super_block *sb, int *flags, char *data)
{
sync_filesystem(sb);
if (!(*flags & MS_RDONLY))
if (!(*flags & SB_RDONLY))
return -EINVAL;
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -2957,7 +2957,7 @@ static inline int btrfs_fs_closing(struct btrfs_fs_info *fs_info)
*/
static inline int btrfs_need_cleaner_sleep(struct btrfs_fs_info *fs_info)
{
return fs_info->sb->s_flags & MS_RDONLY || btrfs_fs_closing(fs_info);
return fs_info->sb->s_flags & SB_RDONLY || btrfs_fs_closing(fs_info);
}

static inline void free_fs_info(struct btrfs_fs_info *fs_info)
Expand Down
2 changes: 1 addition & 1 deletion fs/btrfs/extent_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1984,7 +1984,7 @@ int repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start,
struct btrfs_bio *bbio = NULL;
int ret;

ASSERT(!(fs_info->sb->s_flags & MS_RDONLY));
ASSERT(!(fs_info->sb->s_flags & SB_RDONLY));
BUG_ON(!mirror_num);

bio = btrfs_io_bio_alloc(1);
Expand Down
4 changes: 2 additions & 2 deletions fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ static int cluster_pages_for_defrag(struct inode *inode,
if (!i_done || ret)
goto out;

if (!(inode->i_sb->s_flags & MS_ACTIVE))
if (!(inode->i_sb->s_flags & SB_ACTIVE))
goto out;

/*
Expand Down Expand Up @@ -1333,7 +1333,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
* make sure we stop running if someone unmounts
* the FS
*/
if (!(inode->i_sb->s_flags & MS_ACTIVE))
if (!(inode->i_sb->s_flags & SB_ACTIVE))
break;

if (btrfs_defrag_cancelled(fs_info)) {
Expand Down
Loading

0 comments on commit 1751e8a

Please sign in to comment.