mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
VFS: New /proc file /proc/self/mountstats
Create a new file under /proc/self, called mountstats, where mounted file systems can export information (configuration options, performance counters, and so on). Use a mechanism similar to /proc/mounts and s_ops->show_options. This mechanism does not violate namespace security, and is safe to use while other processes are unmounting file systems. Thanks to Mike Waychison for his review and comments. Test-plan: Test concurrent mount/unmount operations while cat'ing /proc/self/mountstats. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
This commit is contained in:
parent
1356b8c28d
commit
b4629fe2f0
3 changed files with 78 additions and 0 deletions
|
|
@ -399,6 +399,44 @@ struct seq_operations mounts_op = {
|
|||
.show = show_vfsmnt
|
||||
};
|
||||
|
||||
static int show_vfsstat(struct seq_file *m, void *v)
|
||||
{
|
||||
struct vfsmount *mnt = v;
|
||||
int err = 0;
|
||||
|
||||
/* device */
|
||||
if (mnt->mnt_devname) {
|
||||
seq_puts(m, "device ");
|
||||
mangle(m, mnt->mnt_devname);
|
||||
} else
|
||||
seq_puts(m, "no device");
|
||||
|
||||
/* mount point */
|
||||
seq_puts(m, " mounted on ");
|
||||
seq_path(m, mnt, mnt->mnt_root, " \t\n\\");
|
||||
seq_putc(m, ' ');
|
||||
|
||||
/* file system type */
|
||||
seq_puts(m, "with fstype ");
|
||||
mangle(m, mnt->mnt_sb->s_type->name);
|
||||
|
||||
/* optional statistics */
|
||||
if (mnt->mnt_sb->s_op->show_stats) {
|
||||
seq_putc(m, ' ');
|
||||
err = mnt->mnt_sb->s_op->show_stats(m, mnt);
|
||||
}
|
||||
|
||||
seq_putc(m, '\n');
|
||||
return err;
|
||||
}
|
||||
|
||||
struct seq_operations mountstats_op = {
|
||||
.start = m_start,
|
||||
.next = m_next,
|
||||
.stop = m_stop,
|
||||
.show = show_vfsstat,
|
||||
};
|
||||
|
||||
/**
|
||||
* may_umount_tree - check if a mount tree is busy
|
||||
* @mnt: root of mount tree
|
||||
|
|
|
|||
Loading…
Reference in a new issue