sysfs: add sysfs_dirent->s_parent
authorTejun Heo <htejun@gmail.com>
Wed, 13 Jun 2007 18:45:14 +0000 (03:45 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 11 Jul 2007 23:09:04 +0000 (16:09 -0700)
commit13b3086d2ea483cbcae5a4236446cecc082a72cf
treef6932aaf486a302aa7b03857d780bafda33db2d6
parenta26cd7226c24c3be5dd5f48a74832fe64beb8489
sysfs: add sysfs_dirent->s_parent

Add sysfs_dirent->s_parent.  With this patch, each sd points to and
holds a reference to its parent.  This allows walking sysfs tree
without referencing sd->s_dentry which can go away anytime if the user
doesn't control when it's deleted.

sd->s_parent is initialized and parent is referenced in
sysfs_attach_dirent().  Reference to parent is released when the sd is
released, so as long as reference to a sd is held, s_parent can be
followed.

dentry walk in sysfs_readdir() is convereted to s_parent walk.

This will be used to reimplement symlink such that it uses only
sysfs_dirent tree.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/sysfs/dir.c
fs/sysfs/mount.c
fs/sysfs/sysfs.h