summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorBoris Burkov <boris@bur.io>2020-11-18 15:06:23 -0800
committerDavid Sterba <dsterba@suse.com>2020-12-09 19:16:08 +0100
commit04c415596953ec90fdae1ad388fdc8151d5dfdc1 (patch)
tree5dc0eeabcf81c5f689a8fd4131b545c8767a3bc6 /fs/btrfs/super.c
parent948462294577a3870c407c16d89bb2314f0b0cfb (diff)
downloadlinux-stable-04c415596953ec90fdae1ad388fdc8151d5dfdc1.tar.gz
linux-stable-04c415596953ec90fdae1ad388fdc8151d5dfdc1.tar.bz2
linux-stable-04c415596953ec90fdae1ad388fdc8151d5dfdc1.zip
btrfs: use superblock state to print space_cache mount option
To make the contents of /proc/mounts better match the actual state of the filesystem, base the display of the space cache mount options off the contents of the super block rather than the last mount options passed in. Since there are many scenarios where the mount will ignore a space cache option, simply showing the passed in option is misleading. For example, if we mount with -o remount,space_cache=v2 on a read-write file system without an existing free space tree, we won't build a free space tree, but /proc/mounts will read space_cache=v2 (until we mount again and it goes away) cache_generation is set iff space_cache=v1, FREE_SPACE_TREE is set iff space_cache=v2, and if neither is the case, we print nospace_cache. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Boris Burkov <boris@bur.io> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r--fs/btrfs/super.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index b2252184305c..bd3ce2b43838 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1483,9 +1483,9 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
seq_puts(seq, ",discard=async");
if (!(info->sb->s_flags & SB_POSIXACL))
seq_puts(seq, ",noacl");
- if (btrfs_test_opt(info, SPACE_CACHE))
+ if (btrfs_free_space_cache_v1_active(info))
seq_puts(seq, ",space_cache");
- else if (btrfs_test_opt(info, FREE_SPACE_TREE))
+ else if (btrfs_fs_compat_ro(info, FREE_SPACE_TREE))
seq_puts(seq, ",space_cache=v2");
else
seq_puts(seq, ",nospace_cache");