diff options
author | Tejun Heo <htejun@gmail.com> | 2007-06-13 15:27:24 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-11 19:09:09 -0400 |
commit | a0edd7c848945a75e2f41673f43bc37d0a5fed15 (patch) | |
tree | c74ea7d7dbc814faef126f97601a16c7118b3099 /fs/sysfs/inode.c | |
parent | fb6896da37f19be4b75154c14d1cd79231255b17 (diff) |
sysfs: move sysfs_drop_dentry() to dir.c and make it static
After add/remove path restructuring, the only user of
sysfs_drop_dentry() is sysfs_addrm_finish(). Move sysfs_drop_dentry()
to dir.c and make it static.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs/inode.c')
-rw-r--r-- | fs/sysfs/inode.c | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index f95966847a81..3756e152285a 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
@@ -197,62 +197,6 @@ void sysfs_instantiate(struct dentry *dentry, struct inode *inode) | |||
197 | d_instantiate(dentry, inode); | 197 | d_instantiate(dentry, inode); |
198 | } | 198 | } |
199 | 199 | ||
200 | /** | ||
201 | * sysfs_drop_dentry - drop dentry for the specified sysfs_dirent | ||
202 | * @sd: target sysfs_dirent | ||
203 | * | ||
204 | * Drop dentry for @sd. @sd must have been unlinked from its | ||
205 | * parent on entry to this function such that it can't be looked | ||
206 | * up anymore. | ||
207 | * | ||
208 | * @sd->s_dentry which is protected with sysfs_assoc_lock points | ||
209 | * to the currently associated dentry but we're not holding a | ||
210 | * reference to it and racing with dput(). Grab dcache_lock and | ||
211 | * verify dentry before dropping it. If @sd->s_dentry is NULL or | ||
212 | * dput() beats us, no need to bother. | ||
213 | */ | ||
214 | void sysfs_drop_dentry(struct sysfs_dirent *sd) | ||
215 | { | ||
216 | struct dentry *dentry = NULL; | ||
217 | struct inode *inode; | ||
218 | |||
219 | /* We're not holding a reference to ->s_dentry dentry but the | ||
220 | * field will stay valid as long as sysfs_assoc_lock is held. | ||
221 | */ | ||
222 | spin_lock(&sysfs_assoc_lock); | ||
223 | spin_lock(&dcache_lock); | ||
224 | |||
225 | /* drop dentry if it's there and dput() didn't kill it yet */ | ||
226 | if (sd->s_dentry && sd->s_dentry->d_inode) { | ||
227 | dentry = dget_locked(sd->s_dentry); | ||
228 | spin_lock(&dentry->d_lock); | ||
229 | __d_drop(dentry); | ||
230 | spin_unlock(&dentry->d_lock); | ||
231 | } | ||
232 | |||
233 | spin_unlock(&dcache_lock); | ||
234 | spin_unlock(&sysfs_assoc_lock); | ||
235 | |||
236 | dput(dentry); | ||
237 | /* XXX: unpin if directory, this will go away soon */ | ||
238 | if (sysfs_type(sd) == SYSFS_DIR) | ||
239 | dput(dentry); | ||
240 | |||
241 | /* adjust nlink and update timestamp */ | ||
242 | inode = ilookup(sysfs_sb, sd->s_ino); | ||
243 | if (inode) { | ||
244 | mutex_lock(&inode->i_mutex); | ||
245 | |||
246 | inode->i_ctime = CURRENT_TIME; | ||
247 | drop_nlink(inode); | ||
248 | if (sysfs_type(sd) == SYSFS_DIR) | ||
249 | drop_nlink(inode); | ||
250 | |||
251 | mutex_unlock(&inode->i_mutex); | ||
252 | iput(inode); | ||
253 | } | ||
254 | } | ||
255 | |||
256 | int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name) | 200 | int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name) |
257 | { | 201 | { |
258 | struct sysfs_addrm_cxt acxt; | 202 | struct sysfs_addrm_cxt acxt; |