Commit f015f126 authored by David Howells's avatar David Howells Committed by Al Viro

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: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent be34d1a3
...@@ -672,6 +672,16 @@ static int follow_up_rcu(struct path *path) ...@@ -672,6 +672,16 @@ static int follow_up_rcu(struct path *path)
return 1; return 1;
} }
/*
* follow_up - Find the mountpoint of path's vfsmount
*
* Given a path, find the mountpoint of its source file system.
* Replace @path with the path of the mountpoint in the parent mount.
* Up is towards /.
*
* Return 1 if we went up a level and 0 if we were already at the
* root.
*/
int follow_up(struct path *path) int follow_up(struct path *path)
{ {
struct mount *mnt = real_mount(path->mnt); struct mount *mnt = real_mount(path->mnt);
......
...@@ -515,8 +515,20 @@ struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry, ...@@ -515,8 +515,20 @@ struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry,
} }
/* /*
* lookup_mnt increments the ref count before returning * lookup_mnt - Return the first child mount mounted at path
* the vfsmount struct. *
* "First" means first mounted chronologically. If you create the
* following mounts:
*
* mount /dev/sda1 /mnt
* mount /dev/sda2 /mnt
* mount /dev/sda3 /mnt
*
* Then lookup_mnt() on the base /mnt dentry in the root mount will
* return successively the root dentry and vfsmount of /dev/sda1, then
* /dev/sda2, then /dev/sda3, then NULL.
*
* lookup_mnt takes a reference to the found vfsmount.
*/ */
struct vfsmount *lookup_mnt(struct path *path) struct vfsmount *lookup_mnt(struct path *path)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment