nilfs2: implement nilfs_show_options to display mount options in /proc/mounts

This is a patch to display mount options in procfs.
Mount options will show up in the /proc/mounts as other fs does.

...
/dev/sda6 /mnt nilfs2 ro,relatime,barrier=off,cp=3,order=strict 0 0
...

Signed-off-by: Jiro SEKIBA <jir@unicus.jp>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
This commit is contained in:
Jiro SEKIBA 2009-06-24 20:06:34 +09:00 committed by Ryusuke Konishi
parent 1435110467
commit b58a285ba4
1 changed files with 23 additions and 1 deletions

View File

@ -50,6 +50,8 @@
#include <linux/writeback.h> #include <linux/writeback.h>
#include <linux/kobject.h> #include <linux/kobject.h>
#include <linux/exportfs.h> #include <linux/exportfs.h>
#include <linux/seq_file.h>
#include <linux/mount.h>
#include "nilfs.h" #include "nilfs.h"
#include "mdt.h" #include "mdt.h"
#include "alloc.h" #include "alloc.h"
@ -529,6 +531,26 @@ static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf)
return 0; return 0;
} }
static int nilfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
{
struct super_block *sb = vfs->mnt_sb;
struct nilfs_sb_info *sbi = NILFS_SB(sb);
if (!nilfs_test_opt(sbi, BARRIER))
seq_printf(seq, ",barrier=off");
if (nilfs_test_opt(sbi, SNAPSHOT))
seq_printf(seq, ",cp=%llu",
(unsigned long long int)sbi->s_snapshot_cno);
if (nilfs_test_opt(sbi, ERRORS_RO))
seq_printf(seq, ",errors=remount-ro");
if (nilfs_test_opt(sbi, ERRORS_PANIC))
seq_printf(seq, ",errors=panic");
if (nilfs_test_opt(sbi, STRICT_ORDER))
seq_printf(seq, ",order=strict");
return 0;
}
static struct super_operations nilfs_sops = { static struct super_operations nilfs_sops = {
.alloc_inode = nilfs_alloc_inode, .alloc_inode = nilfs_alloc_inode,
.destroy_inode = nilfs_destroy_inode, .destroy_inode = nilfs_destroy_inode,
@ -546,7 +568,7 @@ static struct super_operations nilfs_sops = {
.remount_fs = nilfs_remount, .remount_fs = nilfs_remount,
.clear_inode = nilfs_clear_inode, .clear_inode = nilfs_clear_inode,
/* .umount_begin */ /* .umount_begin */
/* .show_options */ .show_options = nilfs_show_options
}; };
static struct inode * static struct inode *