Commit f015f1267b23d3530d3f874243fb83cb5f443005

Authored by David Howells
Committed by Al Viro
1 parent be34d1a3bc

VFS: Comment mount following code

Add comments describing what the directions "up" and "down" mean and ref count
handling to the VFS mount following family of functions.

Signed-off-by: Valerie Aurora <vaurora@redhat.com> (Original author)
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 2 changed files with 24 additions and 2 deletions Side-by-side Diff

... ... @@ -672,6 +672,16 @@
672 672 return 1;
673 673 }
674 674  
  675 +/*
  676 + * follow_up - Find the mountpoint of path's vfsmount
  677 + *
  678 + * Given a path, find the mountpoint of its source file system.
  679 + * Replace @path with the path of the mountpoint in the parent mount.
  680 + * Up is towards /.
  681 + *
  682 + * Return 1 if we went up a level and 0 if we were already at the
  683 + * root.
  684 + */
675 685 int follow_up(struct path *path)
676 686 {
677 687 struct mount *mnt = real_mount(path->mnt);
... ... @@ -515,8 +515,20 @@
515 515 }
516 516  
517 517 /*
518   - * lookup_mnt increments the ref count before returning
519   - * the vfsmount struct.
  518 + * lookup_mnt - Return the first child mount mounted at path
  519 + *
  520 + * "First" means first mounted chronologically. If you create the
  521 + * following mounts:
  522 + *
  523 + * mount /dev/sda1 /mnt
  524 + * mount /dev/sda2 /mnt
  525 + * mount /dev/sda3 /mnt
  526 + *
  527 + * Then lookup_mnt() on the base /mnt dentry in the root mount will
  528 + * return successively the root dentry and vfsmount of /dev/sda1, then
  529 + * /dev/sda2, then /dev/sda3, then NULL.
  530 + *
  531 + * lookup_mnt takes a reference to the found vfsmount.
520 532 */
521 533 struct vfsmount *lookup_mnt(struct path *path)
522 534 {