diff options
author | Chuck Lever <cel@netapp.com> | 2006-03-20 13:44:12 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-20 13:44:12 -0500 |
commit | b4629fe2f094b719847f31be1ee5ab38300038b2 (patch) | |
tree | 158b3aabf291ef9462e3e02493fb4c45265f9e8e /fs/namespace.c | |
parent | 1356b8c28d67cafd74f7e7dcfb39bf53681790a5 (diff) |
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 <cel@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r-- | fs/namespace.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index 39c81a8d6316..71e75bcf4d28 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -399,6 +399,44 @@ struct seq_operations mounts_op = { | |||
399 | .show = show_vfsmnt | 399 | .show = show_vfsmnt |
400 | }; | 400 | }; |
401 | 401 | ||
402 | static int show_vfsstat(struct seq_file *m, void *v) | ||
403 | { | ||
404 | struct vfsmount *mnt = v; | ||
405 | int err = 0; | ||
406 | |||
407 | /* device */ | ||
408 | if (mnt->mnt_devname) { | ||
409 | seq_puts(m, "device "); | ||
410 | mangle(m, mnt->mnt_devname); | ||
411 | } else | ||
412 | seq_puts(m, "no device"); | ||
413 | |||
414 | /* mount point */ | ||
415 | seq_puts(m, " mounted on "); | ||
416 | seq_path(m, mnt, mnt->mnt_root, " \t\n\\"); | ||
417 | seq_putc(m, ' '); | ||
418 | |||
419 | /* file system type */ | ||
420 | seq_puts(m, "with fstype "); | ||
421 | mangle(m, mnt->mnt_sb->s_type->name); | ||
422 | |||
423 | /* optional statistics */ | ||
424 | if (mnt->mnt_sb->s_op->show_stats) { | ||
425 | seq_putc(m, ' '); | ||
426 | err = mnt->mnt_sb->s_op->show_stats(m, mnt); | ||
427 | } | ||
428 | |||
429 | seq_putc(m, '\n'); | ||
430 | return err; | ||
431 | } | ||
432 | |||
433 | struct seq_operations mountstats_op = { | ||
434 | .start = m_start, | ||
435 | .next = m_next, | ||
436 | .stop = m_stop, | ||
437 | .show = show_vfsstat, | ||
438 | }; | ||
439 | |||
402 | /** | 440 | /** |
403 | * may_umount_tree - check if a mount tree is busy | 441 | * may_umount_tree - check if a mount tree is busy |
404 | * @mnt: root of mount tree | 442 | * @mnt: root of mount tree |