diff options
author | Eric Paris <eparis@redhat.com> | 2009-04-02 16:46:06 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-04-02 16:46:06 -0400 |
commit | a9572a15a854bd40453a6b7b4dd9d29132f64c64 (patch) | |
tree | 36eb4ee3be45a4d622da2f103e571894a60c3c13 /fs/btrfs | |
parent | fa9c0d795f7b57c76560b7fac703f5d341210e28 (diff) |
Btrfs: introduce btrfs_show_options
btrfs options can change at times other than mount, yet /proc/mounts shows the
options string used when the fs was mounted (an example would be when btrfs
determines that barriers aren't useful and turns them off.) This patch
instead outputs the actual options in use by btrfs.
Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/super.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 19a4daf03ccb..2ceb40b794a8 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/highmem.h> | 24 | #include <linux/highmem.h> |
25 | #include <linux/time.h> | 25 | #include <linux/time.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/seq_file.h> | ||
27 | #include <linux/string.h> | 28 | #include <linux/string.h> |
28 | #include <linux/smp_lock.h> | 29 | #include <linux/smp_lock.h> |
29 | #include <linux/backing-dev.h> | 30 | #include <linux/backing-dev.h> |
@@ -385,6 +386,37 @@ int btrfs_sync_fs(struct super_block *sb, int wait) | |||
385 | return ret; | 386 | return ret; |
386 | } | 387 | } |
387 | 388 | ||
389 | static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs) | ||
390 | { | ||
391 | struct btrfs_root *root = btrfs_sb(vfs->mnt_sb); | ||
392 | struct btrfs_fs_info *info = root->fs_info; | ||
393 | |||
394 | if (btrfs_test_opt(root, DEGRADED)) | ||
395 | seq_puts(seq, ",degraded"); | ||
396 | if (btrfs_test_opt(root, NODATASUM)) | ||
397 | seq_puts(seq, ",nodatasum"); | ||
398 | if (btrfs_test_opt(root, NODATACOW)) | ||
399 | seq_puts(seq, ",nodatacow"); | ||
400 | if (btrfs_test_opt(root, NOBARRIER)) | ||
401 | seq_puts(seq, ",nobarrier"); | ||
402 | if (info->max_extent != (u64)-1) | ||
403 | seq_printf(seq, ",max_extent=%llu", info->max_extent); | ||
404 | if (info->max_inline != 8192 * 1024) | ||
405 | seq_printf(seq, ",max_inline=%llu", info->max_inline); | ||
406 | if (info->alloc_start != 0) | ||
407 | seq_printf(seq, ",alloc_start=%llu", info->alloc_start); | ||
408 | if (info->thread_pool_size != min_t(unsigned long, | ||
409 | num_online_cpus() + 2, 8)) | ||
410 | seq_printf(seq, ",thread_pool=%d", info->thread_pool_size); | ||
411 | if (btrfs_test_opt(root, COMPRESS)) | ||
412 | seq_puts(seq, ",compress"); | ||
413 | if (btrfs_test_opt(root, SSD)) | ||
414 | seq_puts(seq, ",ssd"); | ||
415 | if (!(root->fs_info->sb->s_flags & MS_POSIXACL)) | ||
416 | seq_puts(seq, ",noacl"); | ||
417 | return 0; | ||
418 | } | ||
419 | |||
388 | static void btrfs_write_super(struct super_block *sb) | 420 | static void btrfs_write_super(struct super_block *sb) |
389 | { | 421 | { |
390 | sb->s_dirt = 0; | 422 | sb->s_dirt = 0; |
@@ -630,7 +662,7 @@ static struct super_operations btrfs_super_ops = { | |||
630 | .put_super = btrfs_put_super, | 662 | .put_super = btrfs_put_super, |
631 | .write_super = btrfs_write_super, | 663 | .write_super = btrfs_write_super, |
632 | .sync_fs = btrfs_sync_fs, | 664 | .sync_fs = btrfs_sync_fs, |
633 | .show_options = generic_show_options, | 665 | .show_options = btrfs_show_options, |
634 | .write_inode = btrfs_write_inode, | 666 | .write_inode = btrfs_write_inode, |
635 | .dirty_inode = btrfs_dirty_inode, | 667 | .dirty_inode = btrfs_dirty_inode, |
636 | .alloc_inode = btrfs_alloc_inode, | 668 | .alloc_inode = btrfs_alloc_inode, |