From fb01fbd7cd2d396df8a4605eaad9febc52ef3b61 Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Wed, 11 Aug 2010 18:55:29 -0400 Subject: [PATCH] Linux: switch to evict_inode 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 Tested-by: Derrick Brashear --- acinclude.m4 | 2 ++ src/afs/LINUX/osi_vfsops.c | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index 08a36a80f..9effae9fa 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -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]) diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c index 1d3406d73..36a00489a 100644 --- a/src/afs/LINUX/osi_vfsops.c +++ b/src/afs/LINUX/osi_vfsops.c @@ -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, }; -- 2.39.5