ChangeSet 1.1807.48.20, 2004/08/02 14:25:50-07:00, [EMAIL PROTECTED]

[PATCH] d_unhash consolidation

This removes a copy of d_unhash() from drivers/usb/core/inode.c and
and exports d_unhash() from fs/namei.c as dentry_unhash().
Tested - compiled and running.

Signed-off-by: Dan Aloni <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>


 drivers/usb/core/inode.c |   19 +------------------
 fs/namei.c               |    7 ++++---
 include/linux/fs.h       |    5 +++++
 3 files changed, 10 insertions(+), 21 deletions(-)


diff -Nru a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
--- a/drivers/usb/core/inode.c  2004-08-23 13:20:25 -07:00
+++ b/drivers/usb/core/inode.c  2004-08-23 13:20:25 -07:00
@@ -345,30 +345,13 @@
        return 0;
 }
 
-static void d_unhash(struct dentry *dentry)
-{
-       dget(dentry);
-       spin_lock(&dcache_lock);
-       switch (atomic_read(&dentry->d_count)) {
-       default:
-               spin_unlock(&dcache_lock);
-               shrink_dcache_parent(dentry);
-               spin_lock(&dcache_lock);
-               if (atomic_read(&dentry->d_count) != 2)
-                       break;
-       case 2:
-               __d_drop(dentry);
-       }
-       spin_unlock(&dcache_lock);
-}
-
 static int usbfs_rmdir(struct inode *dir, struct dentry *dentry)
 {
        int error = -ENOTEMPTY;
        struct inode * inode = dentry->d_inode;
 
        down(&inode->i_sem);
-       d_unhash(dentry);
+       dentry_unhash(dentry);
        if (usbfs_empty(dentry)) {
                dentry->d_inode->i_nlink -= 2;
                dput(dentry);
diff -Nru a/fs/namei.c b/fs/namei.c
--- a/fs/namei.c        2004-08-23 13:20:25 -07:00
+++ b/fs/namei.c        2004-08-23 13:20:25 -07:00
@@ -1659,7 +1659,7 @@
  * if it cannot handle the case of removing a directory
  * that is still in use by something else..
  */
-static void d_unhash(struct dentry *dentry)
+void dentry_unhash(struct dentry *dentry)
 {
        dget(dentry);
        spin_lock(&dcache_lock);
@@ -1689,7 +1689,7 @@
        DQUOT_INIT(dir);
 
        down(&dentry->d_inode->i_sem);
-       d_unhash(dentry);
+       dentry_unhash(dentry);
        if (d_mountpoint(dentry))
                error = -EBUSY;
        else {
@@ -2032,7 +2032,7 @@
        target = new_dentry->d_inode;
        if (target) {
                down(&target->i_sem);
-               d_unhash(new_dentry);
+               dentry_unhash(new_dentry);
        }
        if (d_mountpoint(old_dentry)||d_mountpoint(new_dentry))
                error = -EBUSY;
@@ -2410,4 +2410,5 @@
 EXPORT_SYMBOL(vfs_rmdir);
 EXPORT_SYMBOL(vfs_symlink);
 EXPORT_SYMBOL(vfs_unlink);
+EXPORT_SYMBOL(dentry_unhash);
 EXPORT_SYMBOL(generic_readlink);
diff -Nru a/include/linux/fs.h b/include/linux/fs.h
--- a/include/linux/fs.h        2004-08-23 13:20:25 -07:00
+++ b/include/linux/fs.h        2004-08-23 13:20:25 -07:00
@@ -809,6 +809,11 @@
 extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry 
*);
 
 /*
+ * VFS dentry helper functions.
+ */
+extern void dentry_unhash(struct dentry *dentry);
+
+/*
  * File types
  *
  * NOTE! These match bits 12..15 of stat.st_mode



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to