From f43f102c71f69a1b0bd6d4ea7cb7f0c74e67b083 Mon Sep 17 00:00:00 2001 From: Chas Williams Date: Sun, 19 Jun 2005 18:39:03 +0000 Subject: [PATCH 1/1] linux-change-dentry-cleanup-20050619 try to make this work in 2.4 also --- src/afs/LINUX/osi_machdep.h | 2 +- src/afs/LINUX/osi_misc.c | 9 +-------- src/afs/LINUX/osi_vfsops.c | 38 +++++++++++++++++++------------------- src/afs/LINUX/osi_vnodeops.c | 4 ++-- 4 files changed, 23 insertions(+), 30 deletions(-) diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index 101d384..7d13d64 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -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) diff --git a/src/afs/LINUX/osi_misc.c b/src/afs/LINUX/osi_misc.c index 36e01fd..261e428 100644 --- a/src/afs/LINUX/osi_misc.c +++ b/src/afs/LINUX/osi_misc.c @@ -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. diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c index 6372a3a..a0ed85e 100644 --- a/src/afs/LINUX/osi_vfsops.c +++ b/src/afs/LINUX/osi_vfsops.c @@ -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, diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 3394302..33eeefa 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -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 }; -- 1.9.4