From: Eric W. Biederman <[email protected]> The only uses of s_dentry left are the code that maintains s_dentry and trivial users that don't actually need it. So this patch removes the s_dentry maintenance code and restructures the trivial uses to use something else. Signed-off-by: Eric W. Biederman <[email protected]> Signed-off-by: Tejun Heo <[email protected]> Cc: Cornelia Huck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> --- fs/sysfs/dir.c | 32 ++++---------------------------- fs/sysfs/mount.c | 1 - fs/sysfs/sysfs.h | 1 - 3 files changed, 4 insertions(+), 30 deletions(-) diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 1c3dc5d..36b6c79 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c @@ -289,22 +289,7 @@ static void sysfs_d_iput(struct dentry * dentry, struct inode * inode) { struct sysfs_dirent * sd = dentry->d_fsdata; - if (sd) { - /* sd->s_dentry is protected with sysfs_assoc_lock. - * This allows sysfs_drop_dentry() to dereference it. - */ - spin_lock(&sysfs_assoc_lock); - - /* The dentry might have been deleted or another - * lookup could have happened updating sd->s_dentry to - * point the new dentry. Ignore if it isn't pointing - * to this dentry. - */ - if (sd->s_dentry == dentry) - sd->s_dentry = NULL; - spin_unlock(&sysfs_assoc_lock); - sysfs_put(sd); - } + sysfs_put(sd); iput(inode); } @@ -352,9 +337,6 @@ struct sysfs_dirent *sysfs_new_dirent(const char *name, umode_t mode, int type) * @sd: target sysfs_dirent * @dentry: dentry to associate * - * Associate @sd with @dentry. This is protected by - * sysfs_assoc_lock to avoid race with sysfs_d_iput(). - * * LOCKING: * mutex_lock(sysfs_mutex) */ @@ -362,12 +344,6 @@ static void sysfs_attach_dentry(struct sysfs_dirent *sd, struct dentry *dentry) { dentry->d_op = &sysfs_dentry_ops; dentry->d_fsdata = sysfs_get(sd); - - /* protect sd->s_dentry against sysfs_d_iput */ - spin_lock(&sysfs_assoc_lock); - sd->s_dentry = dentry; - spin_unlock(&sysfs_assoc_lock); - d_rehash(dentry); } @@ -846,7 +822,7 @@ int sysfs_rename_dir(struct kobject * kobj, const char *new_name) /* rename */ d_add(new_dentry, NULL); - d_move(sd->s_dentry, new_dentry); + d_move(old_dentry, new_dentry); error = 0; goto out_unlock; @@ -881,7 +857,7 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj) error = PTR_ERR(old_dentry); goto out_dput; } - old_parent = sd->s_parent->s_dentry; + old_parent = old_dentry->d_parent; new_parent = sysfs_get_dentry(new_parent_sd); if (IS_ERR(new_parent)) { @@ -907,7 +883,7 @@ again: } else error = 0; d_add(new_dentry, NULL); - d_move(sd->s_dentry, new_dentry); + d_move(old_dentry, new_dentry); dput(new_dentry); /* Remove from old parent's list and insert into new parent's list. */ diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c index 8989cbb..28bf359 100644 --- a/fs/sysfs/mount.c +++ b/fs/sysfs/mount.c @@ -56,7 +56,6 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent) iput(inode); return -ENOMEM; } - sysfs_root.s_dentry = root; root->d_fsdata = &sysfs_root; sb->s_root = root; return 0; diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index 179e6a2..791b3ed 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h @@ -37,7 +37,6 @@ struct sysfs_dirent { unsigned int s_flags; umode_t s_mode; ino_t s_ino; - struct dentry * s_dentry; struct iattr * s_iattr; atomic_t s_event; }; -- 1.5.3.4 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- [PATCH 49/75] sysfs: Rewrite rename in terms of sysfs dirents
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 49/75] sysfs: Rewrite rename in terms of sysfs dirents
- References:
- [PATCH 01/75] platform: prefix MODALIAS with "platform:"
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 02/75] HOWTO: update ja_JP/HOWTO with latest changes
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 03/75] Driver core: make sysfs uevent-attributes static
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 04/75] Driver core: change add_uevent_var to use a struct
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 05/75] Driver core: add CONFIG_UEVENT_HELPER_PATH
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 06/75] Driver core: remove subsys_set_kset
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 07/75] Driver core: remove kset_set_kset_s
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 08/75] Driver core: remove subsys_put()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 09/75] Driver core: remove subsys_get()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 10/75] Driver core: remove put_bus()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 11/75] Driver core: remove get_bus()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 12/75] kobjects: fix up improper use of the kobject name field
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 13/75] cdev: remove unneeded setting of cdev names
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 14/75] Drivers: clean up direct setting of the name of a kset
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 15/75] kobject: remove the static array for the name
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 16/75] Driver core: clean up removed functions from the documentation
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 17/75] debugfs: helper for decimal challenged
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 18/75] sysfs/file.c - use mutex instead of semaphore
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 19/75] sysfs: cleanup semaphore.h
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 20/75] sysfs: Remove first pass at shadow directory support
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 21/75] sysfs: cosmetic changes in sysfs_lookup()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 22/75] sysfs: simplify sysfs_rename_dir()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 23/75] sysfs: make sysfs_add/remove_one() call link/unlink_sibling() implictly
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 24/75] sysfs: make sysfs_add_one() automatically check for duplicate entry
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 25/75] sysfs: make sysfs_addrm_finish() return void
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 26/75] dmi-id: Use dynamic sysfs attributes
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 27/75] dmi-id: Possible cleanup
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 28/75] Convert from class_device to device for drivers/video
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 29/75] Convert from class_device to device in drivers/char
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 30/75] Driver core: exclude kobject_uevent.c for !CONFIG_HOTPLUG
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 31/75] Driver core: add uevent file for bus and driver
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 32/75] Driver core: kerneldoc - kobject_uevent_env is not "usually KOBJ_MOVE"
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 33/75] Fix Firmware class name collision
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 34/75] drivers/base/power/: make 2 functions static
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 35/75] sysfs: Fix typos in fs/sysfs/file.c
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 36/75] sysdev: remove global sysdev drivers list
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 37/75] Driver core: Make platform_device.id an int
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 38/75] sysfs: fix i_mutex locking in sysfs_get_dentry()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 39/75] sysfs: Move all of inode initialization into sysfs_init_inode
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 40/75] sysfs: Remove sysfs_instantiate
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 41/75] sysfs: Use kill_anon_super
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 42/75] sysfs: Make sysfs_mount static
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 43/75] sysfs: In sysfs_lookup don't open code sysfs_find_dirent
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 44/75] sysfs: Simplify readdir.
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 45/75] sysfs: Rewrite sysfs_drop_dentry.
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 46/75] sysfs: Introduce sysfs_rename_mutex
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 47/75] sysfs: simply sysfs_get_dentry
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 01/75] platform: prefix MODALIAS with "platform:"
- Prev by Date: [PATCH 47/75] sysfs: simply sysfs_get_dentry
- Next by Date: [PATCH 49/75] sysfs: Rewrite rename in terms of sysfs dirents
- Previous by thread: [PATCH 47/75] sysfs: simply sysfs_get_dentry
- Next by thread: [PATCH 49/75] sysfs: Rewrite rename in terms of sysfs dirents
- Index(es):