-/* Drop dentry if it is not used already, unhash otherwise.
- Should be called with dcache lock held!
- Returns: 1 if dentry was dropped, 0 if unhashed. */
-int ll_drop_dentry(struct dentry *dentry)
-{
- lock_dentry(dentry);
- if (atomic_read(&dentry->d_count) == 0) {
- CDEBUG(D_DENTRY, "deleting dentry %.*s (%p) parent %p "
- "inode %p\n", dentry->d_name.len,
- dentry->d_name.name, dentry, dentry->d_parent,
- dentry->d_inode);
- dget_locked(dentry);
- __d_drop(dentry);
- unlock_dentry(dentry);
- spin_unlock(&dcache_lock);
- cfs_spin_unlock(&ll_lookup_lock);
- dput(dentry);
- cfs_spin_lock(&ll_lookup_lock);
- spin_lock(&dcache_lock);
- return 1;
- }
- /* disconected dentry can not be find without lookup, because we
- * not need his to unhash or mark invalid. */
- if (dentry->d_flags & DCACHE_DISCONNECTED) {
- unlock_dentry(dentry);
- RETURN (0);
- }
-
- if (!(dentry->d_flags & DCACHE_LUSTRE_INVALID)) {
- CDEBUG(D_DENTRY, "unhashing dentry %.*s (%p) parent %p "
- "inode %p refc %d\n", dentry->d_name.len,
- dentry->d_name.name, dentry, dentry->d_parent,
- dentry->d_inode, atomic_read(&dentry->d_count));
- /* actually we don't unhash the dentry, rather just
- * mark it inaccessible for to __d_lookup(). otherwise
- * sys_getcwd() could return -ENOENT -bzzz */
- dentry->d_flags |= DCACHE_LUSTRE_INVALID;
- if (!dentry->d_inode || !S_ISDIR(dentry->d_inode->i_mode))
- __d_drop(dentry);
- }
- unlock_dentry(dentry);
- return 0;
-}
-
-void ll_unhash_aliases(struct inode *inode)