Linux: switch to evict_inode
authorMarc Dionne <marc.c.dionne@gmail.com>
Wed, 11 Aug 2010 22:55:29 +0000 (18:55 -0400)
committerDerrick Brashear <shadow@dementia.org>
Thu, 12 Aug 2010 20:46:04 +0000 (13:46 -0700)
In 2.6.36, the delete_inode and clear_inode inode operations
are replaced by evict_inode.
Rename our current clear_inode to evict_inode, and add a few
things that were previously handled by the generic delete_inode.

This is required for 2.6.36.

Change-Id: I68d75830b43df710ccce173ab36f3bb39074c59e
Reviewed-on: http://gerrit.openafs.org/2544
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

acinclude.m4
src/afs/LINUX/osi_vfsops.c

index 08a36a8..9effae9 100644 (file)
@@ -775,6 +775,8 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 AC_CHECK_LINUX_STRUCT([super_block], [s_bdi], [fs.h])
                 AC_CHECK_LINUX_STRUCT([super_operations], [alloc_inode],
                                       [fs.h])
+                AC_CHECK_LINUX_STRUCT([super_operations], [evict_inode],
+                                      [fs.h])
                  AC_CHECK_LINUX_STRUCT([task_struct], [cred], [sched.h])
                 AC_CHECK_LINUX_STRUCT([task_struct], [exit_state], [sched.h])
                 AC_CHECK_LINUX_STRUCT([task_struct], [parent], [sched.h])
index 1d3406d..36a0048 100644 (file)
@@ -286,6 +286,25 @@ afs_destroy_inodecache(void)
 }
 #endif
 
+#if defined(STRUCT_SUPER_OPERATIONS_HAS_EVICT_INODE)
+static void
+afs_evict_inode(struct inode *ip)
+{
+    struct vcache *vcp = VTOAFS(ip);
+
+    if (vcp->vlruq.prev || vcp->vlruq.next)
+       osi_Panic("inode freed while on LRU");
+    if (vcp->hnext)
+       osi_Panic("inode freed while still hashed");
+
+    truncate_inode_pages(&ip->i_data, 0);
+    end_writeback(ip);
+
+#if !defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE)
+    afs_osi_Free(ip->u.generic_ip, sizeof(struct vcache));
+#endif
+}
+#else
 static void
 afs_clear_inode(struct inode *ip)
 {
@@ -300,6 +319,7 @@ afs_clear_inode(struct inode *ip)
     afs_osi_Free(ip->u.generic_ip, sizeof(struct vcache));
 #endif
 }
+#endif
 
 /* afs_put_super
  * Called from unmount to release super_block. */
@@ -364,7 +384,11 @@ struct super_operations afs_sops = {
   .alloc_inode =       afs_alloc_inode,
   .destroy_inode =     afs_destroy_inode,
 #endif
+#if defined(STRUCT_SUPER_OPERATIONS_HAS_EVICT_INODE)
+  .evict_inode =       afs_evict_inode,
+#else
   .clear_inode =       afs_clear_inode,
+#endif
   .put_super =         afs_put_super,
   .statfs =            afs_statfs,
 };