summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-27 16:05:09 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-27 16:05:09 -0500
commit1751e8a6cb935e555fcdbcb9ab4f0446e322ca3e (patch)
tree83c57e4aeda0665cb131de862364b7a5cfd7dd66 /fs/btrfs/super.c
parent141cbfba1d0502006463aa80f57c64086226af1a (diff)
Rename superblock flags (MS_xyz -> SB_xyz)
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 <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r--fs/btrfs/super.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 65af029559b5..305cae7444a0 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -107,7 +107,7 @@ static void btrfs_handle_error(struct btrfs_fs_info *fs_info)
107 return; 107 return;
108 108
109 if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) { 109 if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) {
110 sb->s_flags |= MS_RDONLY; 110 sb->s_flags |= SB_RDONLY;
111 btrfs_info(fs_info, "forced readonly"); 111 btrfs_info(fs_info, "forced readonly");
112 /* 112 /*
113 * Note that a running device replace operation is not 113 * Note that a running device replace operation is not
@@ -137,7 +137,7 @@ void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function
137 137
138 /* 138 /*
139 * Special case: if the error is EROFS, and we're already 139 * Special case: if the error is EROFS, and we're already
140 * under MS_RDONLY, then it is safe here. 140 * under SB_RDONLY, then it is safe here.
141 */ 141 */
142 if (errno == -EROFS && sb_rdonly(sb)) 142 if (errno == -EROFS && sb_rdonly(sb))
143 return; 143 return;
@@ -168,7 +168,7 @@ void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function
168 set_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state); 168 set_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state);
169 169
170 /* Don't go through full error handling during mount */ 170 /* Don't go through full error handling during mount */
171 if (sb->s_flags & MS_BORN) 171 if (sb->s_flags & SB_BORN)
172 btrfs_handle_error(fs_info); 172 btrfs_handle_error(fs_info);
173} 173}
174 174
@@ -625,7 +625,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
625 break; 625 break;
626 case Opt_acl: 626 case Opt_acl:
627#ifdef CONFIG_BTRFS_FS_POSIX_ACL 627#ifdef CONFIG_BTRFS_FS_POSIX_ACL
628 info->sb->s_flags |= MS_POSIXACL; 628 info->sb->s_flags |= SB_POSIXACL;
629 break; 629 break;
630#else 630#else
631 btrfs_err(info, "support for ACL not compiled in!"); 631 btrfs_err(info, "support for ACL not compiled in!");
@@ -633,7 +633,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
633 goto out; 633 goto out;
634#endif 634#endif
635 case Opt_noacl: 635 case Opt_noacl:
636 info->sb->s_flags &= ~MS_POSIXACL; 636 info->sb->s_flags &= ~SB_POSIXACL;
637 break; 637 break;
638 case Opt_notreelog: 638 case Opt_notreelog:
639 btrfs_set_and_info(info, NOTREELOG, 639 btrfs_set_and_info(info, NOTREELOG,
@@ -851,7 +851,7 @@ check:
851 /* 851 /*
852 * Extra check for current option against current flag 852 * Extra check for current option against current flag
853 */ 853 */
854 if (btrfs_test_opt(info, NOLOGREPLAY) && !(new_flags & MS_RDONLY)) { 854 if (btrfs_test_opt(info, NOLOGREPLAY) && !(new_flags & SB_RDONLY)) {
855 btrfs_err(info, 855 btrfs_err(info,
856 "nologreplay must be used with ro mount option"); 856 "nologreplay must be used with ro mount option");
857 ret = -EINVAL; 857 ret = -EINVAL;
@@ -1147,7 +1147,7 @@ static int btrfs_fill_super(struct super_block *sb,
1147 sb->s_xattr = btrfs_xattr_handlers; 1147 sb->s_xattr = btrfs_xattr_handlers;
1148 sb->s_time_gran = 1; 1148 sb->s_time_gran = 1;
1149#ifdef CONFIG_BTRFS_FS_POSIX_ACL 1149#ifdef CONFIG_BTRFS_FS_POSIX_ACL
1150 sb->s_flags |= MS_POSIXACL; 1150 sb->s_flags |= SB_POSIXACL;
1151#endif 1151#endif
1152 sb->s_flags |= SB_I_VERSION; 1152 sb->s_flags |= SB_I_VERSION;
1153 sb->s_iflags |= SB_I_CGROUPWB; 1153 sb->s_iflags |= SB_I_CGROUPWB;
@@ -1180,7 +1180,7 @@ static int btrfs_fill_super(struct super_block *sb,
1180 } 1180 }
1181 1181
1182 cleancache_init_fs(sb); 1182 cleancache_init_fs(sb);
1183 sb->s_flags |= MS_ACTIVE; 1183 sb->s_flags |= SB_ACTIVE;
1184 return 0; 1184 return 0;
1185 1185
1186fail_close: 1186fail_close:
@@ -1277,7 +1277,7 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
1277 seq_puts(seq, ",flushoncommit"); 1277 seq_puts(seq, ",flushoncommit");
1278 if (btrfs_test_opt(info, DISCARD)) 1278 if (btrfs_test_opt(info, DISCARD))
1279 seq_puts(seq, ",discard"); 1279 seq_puts(seq, ",discard");
1280 if (!(info->sb->s_flags & MS_POSIXACL)) 1280 if (!(info->sb->s_flags & SB_POSIXACL))
1281 seq_puts(seq, ",noacl"); 1281 seq_puts(seq, ",noacl");
1282 if (btrfs_test_opt(info, SPACE_CACHE)) 1282 if (btrfs_test_opt(info, SPACE_CACHE))
1283 seq_puts(seq, ",space_cache"); 1283 seq_puts(seq, ",space_cache");
@@ -1409,11 +1409,11 @@ static struct dentry *mount_subvol(const char *subvol_name, u64 subvol_objectid,
1409 1409
1410 mnt = vfs_kern_mount(&btrfs_fs_type, flags, device_name, newargs); 1410 mnt = vfs_kern_mount(&btrfs_fs_type, flags, device_name, newargs);
1411 if (PTR_ERR_OR_ZERO(mnt) == -EBUSY) { 1411 if (PTR_ERR_OR_ZERO(mnt) == -EBUSY) {
1412 if (flags & MS_RDONLY) { 1412 if (flags & SB_RDONLY) {
1413 mnt = vfs_kern_mount(&btrfs_fs_type, flags & ~MS_RDONLY, 1413 mnt = vfs_kern_mount(&btrfs_fs_type, flags & ~SB_RDONLY,
1414 device_name, newargs); 1414 device_name, newargs);
1415 } else { 1415 } else {
1416 mnt = vfs_kern_mount(&btrfs_fs_type, flags | MS_RDONLY, 1416 mnt = vfs_kern_mount(&btrfs_fs_type, flags | SB_RDONLY,
1417 device_name, newargs); 1417 device_name, newargs);
1418 if (IS_ERR(mnt)) { 1418 if (IS_ERR(mnt)) {
1419 root = ERR_CAST(mnt); 1419 root = ERR_CAST(mnt);
@@ -1565,7 +1565,7 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
1565 u64 subvol_objectid = 0; 1565 u64 subvol_objectid = 0;
1566 int error = 0; 1566 int error = 0;
1567 1567
1568 if (!(flags & MS_RDONLY)) 1568 if (!(flags & SB_RDONLY))
1569 mode |= FMODE_WRITE; 1569 mode |= FMODE_WRITE;
1570 1570
1571 error = btrfs_parse_early_options(data, mode, fs_type, 1571 error = btrfs_parse_early_options(data, mode, fs_type,
@@ -1619,13 +1619,13 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
1619 if (error) 1619 if (error)
1620 goto error_fs_info; 1620 goto error_fs_info;
1621 1621
1622 if (!(flags & MS_RDONLY) && fs_devices->rw_devices == 0) { 1622 if (!(flags & SB_RDONLY) && fs_devices->rw_devices == 0) {
1623 error = -EACCES; 1623 error = -EACCES;
1624 goto error_close_devices; 1624 goto error_close_devices;
1625 } 1625 }
1626 1626
1627 bdev = fs_devices->latest_bdev; 1627 bdev = fs_devices->latest_bdev;
1628 s = sget(fs_type, btrfs_test_super, btrfs_set_super, flags | MS_NOSEC, 1628 s = sget(fs_type, btrfs_test_super, btrfs_set_super, flags | SB_NOSEC,
1629 fs_info); 1629 fs_info);
1630 if (IS_ERR(s)) { 1630 if (IS_ERR(s)) {
1631 error = PTR_ERR(s); 1631 error = PTR_ERR(s);
@@ -1635,7 +1635,7 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
1635 if (s->s_root) { 1635 if (s->s_root) {
1636 btrfs_close_devices(fs_devices); 1636 btrfs_close_devices(fs_devices);
1637 free_fs_info(fs_info); 1637 free_fs_info(fs_info);
1638 if ((flags ^ s->s_flags) & MS_RDONLY) 1638 if ((flags ^ s->s_flags) & SB_RDONLY)
1639 error = -EBUSY; 1639 error = -EBUSY;
1640 } else { 1640 } else {
1641 snprintf(s->s_id, sizeof(s->s_id), "%pg", bdev); 1641 snprintf(s->s_id, sizeof(s->s_id), "%pg", bdev);
@@ -1702,11 +1702,11 @@ static inline void btrfs_remount_begin(struct btrfs_fs_info *fs_info,
1702{ 1702{
1703 if (btrfs_raw_test_opt(old_opts, AUTO_DEFRAG) && 1703 if (btrfs_raw_test_opt(old_opts, AUTO_DEFRAG) &&
1704 (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || 1704 (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) ||
1705 (flags & MS_RDONLY))) { 1705 (flags & SB_RDONLY))) {
1706 /* wait for any defraggers to finish */ 1706 /* wait for any defraggers to finish */
1707 wait_event(fs_info->transaction_wait, 1707 wait_event(fs_info->transaction_wait,
1708 (atomic_read(&fs_info->defrag_running) == 0)); 1708 (atomic_read(&fs_info->defrag_running) == 0));
1709 if (flags & MS_RDONLY) 1709 if (flags & SB_RDONLY)
1710 sync_filesystem(fs_info->sb); 1710 sync_filesystem(fs_info->sb);
1711 } 1711 }
1712} 1712}
@@ -1766,10 +1766,10 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
1766 btrfs_resize_thread_pool(fs_info, 1766 btrfs_resize_thread_pool(fs_info,
1767 fs_info->thread_pool_size, old_thread_pool_size); 1767 fs_info->thread_pool_size, old_thread_pool_size);
1768 1768
1769 if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) 1769 if ((bool)(*flags & SB_RDONLY) == sb_rdonly(sb))
1770 goto out; 1770 goto out;
1771 1771
1772 if (*flags & MS_RDONLY) { 1772 if (*flags & SB_RDONLY) {
1773 /* 1773 /*
1774 * this also happens on 'umount -rf' or on shutdown, when 1774 * this also happens on 'umount -rf' or on shutdown, when
1775 * the filesystem is busy. 1775 * the filesystem is busy.
@@ -1781,10 +1781,10 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
1781 /* avoid complains from lockdep et al. */ 1781 /* avoid complains from lockdep et al. */
1782 up(&fs_info->uuid_tree_rescan_sem); 1782 up(&fs_info->uuid_tree_rescan_sem);
1783 1783
1784 sb->s_flags |= MS_RDONLY; 1784 sb->s_flags |= SB_RDONLY;
1785 1785
1786 /* 1786 /*
1787 * Setting MS_RDONLY will put the cleaner thread to 1787 * Setting SB_RDONLY will put the cleaner thread to
1788 * sleep at the next loop if it's already active. 1788 * sleep at the next loop if it's already active.
1789 * If it's already asleep, we'll leave unused block 1789 * If it's already asleep, we'll leave unused block
1790 * groups on disk until we're mounted read-write again 1790 * groups on disk until we're mounted read-write again
@@ -1856,7 +1856,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
1856 goto restore; 1856 goto restore;
1857 } 1857 }
1858 } 1858 }
1859 sb->s_flags &= ~MS_RDONLY; 1859 sb->s_flags &= ~SB_RDONLY;
1860 1860
1861 set_bit(BTRFS_FS_OPEN, &fs_info->flags); 1861 set_bit(BTRFS_FS_OPEN, &fs_info->flags);
1862 } 1862 }
@@ -1866,9 +1866,9 @@ out:
1866 return 0; 1866 return 0;
1867 1867
1868restore: 1868restore:
1869 /* We've hit an error - don't reset MS_RDONLY */ 1869 /* We've hit an error - don't reset SB_RDONLY */
1870 if (sb_rdonly(sb)) 1870 if (sb_rdonly(sb))
1871 old_flags |= MS_RDONLY; 1871 old_flags |= SB_RDONLY;
1872 sb->s_flags = old_flags; 1872 sb->s_flags = old_flags;
1873 fs_info->mount_opt = old_opts; 1873 fs_info->mount_opt = old_opts;
1874 fs_info->compress_type = old_compress_type; 1874 fs_info->compress_type = old_compress_type;