Commit 200da64e authored by Tsutomu Itoh's avatar Tsutomu Itoh Committed by Chris Mason

Btrfs: fix /proc/mounts info.

Some mount options are not displayed by /proc/mounts.
This patch displays the option such as compress_type by /proc/mounts.

Ex.
  [before]
    $ mount | grep sdc2
    /dev/sdc2 on /test12 type btrfs (rw,space_cache,compress=lzo)
    $ cat /proc/mounts | grep sdc2
    /dev/sdc2 /test12 btrfs rw,relatime,compress 0 0

  [after]
    $ mount | grep sdc2
    /dev/sdc2 on /test12 type btrfs (rw,space_cache,compress=lzo)
    $ cat /proc/mounts | grep sdc2
    /dev/sdc2 /test12 btrfs rw,relatime,compress=lzo,space_cache 0 0
Signed-off-by: default avatarTsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent c9149235
...@@ -644,6 +644,7 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs) ...@@ -644,6 +644,7 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
{ {
struct btrfs_root *root = btrfs_sb(vfs->mnt_sb); struct btrfs_root *root = btrfs_sb(vfs->mnt_sb);
struct btrfs_fs_info *info = root->fs_info; struct btrfs_fs_info *info = root->fs_info;
char *compress_type;
if (btrfs_test_opt(root, DEGRADED)) if (btrfs_test_opt(root, DEGRADED))
seq_puts(seq, ",degraded"); seq_puts(seq, ",degraded");
...@@ -662,8 +663,16 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs) ...@@ -662,8 +663,16 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
if (info->thread_pool_size != min_t(unsigned long, if (info->thread_pool_size != min_t(unsigned long,
num_online_cpus() + 2, 8)) num_online_cpus() + 2, 8))
seq_printf(seq, ",thread_pool=%d", info->thread_pool_size); seq_printf(seq, ",thread_pool=%d", info->thread_pool_size);
if (btrfs_test_opt(root, COMPRESS)) if (btrfs_test_opt(root, COMPRESS)) {
seq_puts(seq, ",compress"); if (info->compress_type == BTRFS_COMPRESS_ZLIB)
compress_type = "zlib";
else
compress_type = "lzo";
if (btrfs_test_opt(root, FORCE_COMPRESS))
seq_printf(seq, ",compress-force=%s", compress_type);
else
seq_printf(seq, ",compress=%s", compress_type);
}
if (btrfs_test_opt(root, NOSSD)) if (btrfs_test_opt(root, NOSSD))
seq_puts(seq, ",nossd"); seq_puts(seq, ",nossd");
if (btrfs_test_opt(root, SSD_SPREAD)) if (btrfs_test_opt(root, SSD_SPREAD))
...@@ -678,6 +687,12 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs) ...@@ -678,6 +687,12 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
seq_puts(seq, ",discard"); seq_puts(seq, ",discard");
if (!(root->fs_info->sb->s_flags & MS_POSIXACL)) if (!(root->fs_info->sb->s_flags & MS_POSIXACL))
seq_puts(seq, ",noacl"); seq_puts(seq, ",noacl");
if (btrfs_test_opt(root, SPACE_CACHE))
seq_puts(seq, ",space_cache");
if (btrfs_test_opt(root, CLEAR_CACHE))
seq_puts(seq, ",clear_cache");
if (btrfs_test_opt(root, USER_SUBVOL_RM_ALLOWED))
seq_puts(seq, ",user_subvol_rm_allowed");
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment