From 9f33ad638fbdcf25244538c16eccf70bbf468fe6 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. Reviewed-on: http://gerrit.openafs.org/2544 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry-picked from commit fb01fbd7cd2d396df8a4605eaad9febc52ef3b61) Reviewed-on: http://gerrit.openafs.org/2552 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit e05b5937201ec313d2c8fa863f4dacec87ab687d) Change-Id: I42a22dbea4f880f5c8bb1cd0904f1711b3a48292 Reviewed-on: http://gerrit.openafs.org/3517 Reviewed-by: Simon Wilkinson --- acinclude.m4 | 4 ++++ src/afs/LINUX/osi_vfsops.c | 24 ++++++++++++++++++++++++ src/cf/linux-test4.m4 | 12 ++++++++++++ 3 files changed, 40 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index e7a5cc460..dcf099cae 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -747,6 +747,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) LINUX_DEFINES_FOR_EACH_PROCESS LINUX_DEFINES_PREV_TASK LINUX_FS_STRUCT_SUPER_HAS_ALLOC_INODE + LINUX_FS_STRUCT_SUPER_HAS_EVICT_INODE LINUX_FS_STRUCT_SUPER_BLOCK_HAS_S_BDI LINUX_STRUCT_BDI_HAS_NAME LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK @@ -910,6 +911,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) if test "x$ac_cv_linux_fs_struct_super_has_alloc_inode" = "xyes" ; then AC_DEFINE(STRUCT_SUPER_HAS_ALLOC_INODE, 1, [define if your struct super_operations has alloc_inode]) fi + if test "x$ac_cv_linux_fs_struct_super_has_evict_inode" = "xyes" ; then + AC_DEFINE(STRUCT_SUPER_OPERATIONS_HAS_EVICT_INODE, 1, [define if your struct super_operations has evict_inode]) + fi if test "x$ac_cv_linux_fs_struct_address_space_has_page_lock" = "xyes"; then AC_DEFINE(STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK, 1, [define if your struct address_space has page_lock]) fi diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c index 7305736eb..fb69d39c8 100644 --- a/src/afs/LINUX/osi_vfsops.c +++ b/src/afs/LINUX/osi_vfsops.c @@ -340,6 +340,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_HAS_ALLOC_INODE) + afs_osi_Free(ip->u.generic_ip, sizeof(struct vcache)); +#endif +} +#else static void afs_clear_inode(struct inode *ip) { @@ -354,6 +373,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. */ @@ -452,7 +472,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, #if !defined(AFS_LINUX24_ENV) diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index 06df41d82..894593c28 100644 --- a/src/cf/linux-test4.m4 +++ b/src/cf/linux-test4.m4 @@ -467,6 +467,18 @@ printk("%p\n", _super.alloc_inode);], AC_MSG_RESULT($ac_cv_linux_fs_struct_super_has_alloc_inode)]) +AC_DEFUN([LINUX_FS_STRUCT_SUPER_HAS_EVICT_INODE], [ + AC_MSG_CHECKING([for evict_inode in struct super_operations]) + AC_CACHE_VAL([ac_cv_linux_fs_struct_super_has_evict_inode], [ + AC_TRY_KBUILD( +[#include ], +[struct super_operations _super; +printk("%p\n", _super.evict_inode);], + ac_cv_linux_fs_struct_super_has_evict_inode=yes, + ac_cv_linux_fs_struct_super_has_evict_inode=no)]) + AC_MSG_RESULT($ac_cv_linux_fs_struct_super_has_evict_inode)]) + + AC_DEFUN([LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG], [ AC_MSG_CHECKING([for 3rd argument in posix_lock_file found in new kernels]) AC_CACHE_VAL([ac_cv_linux_kernel_posix_lock_file_wait_arg], [ -- 2.39.5