linux-change-dentry-cleanup-20050619
authorChas Williams <chas@cmf.nrl.navy.mil>
Sun, 19 Jun 2005 18:39:03 +0000 (18:39 +0000)
committerDerrick Brashear <shadow@dementia.org>
Sun, 19 Jun 2005 18:39:03 +0000 (18:39 +0000)
try to make this work in 2.4 also

src/afs/LINUX/osi_machdep.h
src/afs/LINUX/osi_misc.c
src/afs/LINUX/osi_vfsops.c
src/afs/LINUX/osi_vnodeops.c

index 101d384..7d13d64 100644 (file)
@@ -82,7 +82,7 @@
 #define VN_HOLD(V) ((vnode_t *) V)->i_count++
 #endif
 
-#if defined(AFS_LINUX26_ENV)
+#if defined(AFS_LINUX24_ENV)
 #define VN_RELE(V) iput((struct inode *) V)
 #else
 #define VN_RELE(V) osi_iput((struct inode *) V)
index 36e01fd..261e428 100644 (file)
@@ -363,22 +363,16 @@ osi_linux_free_inode_pages(void)
     }
 }
 
+#if !defined(AFS_LINUX24_ENV)
 void
 osi_clear_inode(struct inode *ip)
 {
     cred_t *credp = crref();
     struct vcache *vcp = ITOAFS(ip);
 
-#if defined(AFS_LINUX24_ENV)
-    if (atomic_read(&ip->i_count) > 1)
-       printf("afs_put_inode: ino %ld (0x%lx) has count %ld\n",
-              (long)ip->i_ino, (unsigned long)ip,
-              (long)atomic_read(&ip->i_count));
-#else
     if (ip->i_count > 1)
        printf("afs_put_inode: ino %ld (0x%lx) has count %ld\n",
               (long)ip->i_ino, (unsigned long)ip, (long)ip->i_count);
-#endif
 
     afs_InactiveVCache(vcp, credp);
     ObtainWriteLock(&vcp->lock, 504);
@@ -390,7 +384,6 @@ osi_clear_inode(struct inode *ip)
     crfree(credp);
 }
 
-#if !defined(AFS_LINUX26_ENV)
 /* iput an inode. Since we still have a separate inode pool, we don't want
  * to call iput on AFS inodes, since they would then end up on Linux's
  * inode_unsed list.
index 6372a3a..a0ed85e 100644 (file)
@@ -287,19 +287,17 @@ afs_write_inode(struct inode *ip)
 #endif
 }
 
-#if defined(AFS_LINUX26_ENV)
-static void
-afs_drop_inode(struct inode *ip)
-{
-       generic_delete_inode(ip);
-       AFS_GUNLOCK();          /* locked by afs_delete_inode() */
-}
-#endif
-
 static void
 afs_destroy_inode(struct inode *ip)
 {
+    cred_t *credp = crref();
+
+    /* locked by clear_inode() */
+    put_inode_on_dummy_list(ip);
     ip->i_state = 0;
+    afs_InactiveVCache(ITOAFS(ip), credp); /* afs_FlushVCache()? */
+    AFS_GUNLOCK();
+    crfree(credp);
 }
 
 
@@ -310,20 +308,21 @@ afs_destroy_inode(struct inode *ip)
  * That will trigger the call to delete routine.
  */
 
+#if defined(AFS_LINUX24_ENV)
+static void
+afs_clear_inode(struct inode *ip)
+{
+    AFS_GLOCK();       /* unlocked by destroy_inode() */
+}
+#else
 static void
 afs_delete_inode(struct inode *ip)
 {
-#if defined(AFS_LINUX26_ENV)
     AFS_GLOCK();               /* after spin_unlock(inode_lock) */
-    put_inode_on_dummy_list(ip);
-    osi_clear_inode(ip);
-#else
-    AFS_GLOCK();
     osi_clear_inode(ip);
     AFS_GUNLOCK();
-#endif
 }
-
+#endif
 
 /* afs_put_super
  * Called from unmount to release super_block. */
@@ -413,11 +412,12 @@ afs_umount_begin(struct super_block *sbp)
 }
 
 struct super_operations afs_sops = {
-#if defined(AFS_LINUX26_ENV)
-  .drop_inode =                afs_drop_inode,
+#if defined(AFS_LINUX24_ENV)
   .destroy_inode =     afs_destroy_inode,
+  .clear_inode =        afs_clear_inode,
+#else
+  .delete_inode =       afs_delete_inode,
 #endif
-  .delete_inode =      afs_delete_inode,
   .write_inode =       afs_write_inode,
   .put_super =         afs_put_super,
   .statfs =            afs_statfs,
index 3394302..33eeefa 100644 (file)
@@ -950,7 +950,7 @@ afs_linux_dentry_revalidate(struct dentry *dp)
     goto done;
 }
 
-#if !defined(AFS_LINUX26_ENV)
+#if !defined(AFS_LINUX24_ENV)
 /* afs_dentry_iput */
 static void
 afs_dentry_iput(struct dentry *dp, struct inode *ip)
@@ -971,7 +971,7 @@ afs_dentry_delete(struct dentry *dp)
 struct dentry_operations afs_dentry_operations = {
   .d_revalidate =      afs_linux_dentry_revalidate,
   .d_delete =          afs_dentry_delete,
-#if !defined(AFS_LINUX26_ENV)
+#if !defined(AFS_LINUX24_ENV)
   .d_iput =            afs_dentry_iput,
 #endif
 };