From 5ded32558df79700b7800646ae90d589e1a82120 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Mon, 18 Jul 2005 16:20:04 +0000 Subject: [PATCH] INODE-rollback-dentry-open-20050718 and roll back the cache inode finding with dentry_open --- src/afs/LINUX/osi_file.c | 49 +++---------------------------------- src/afs/LINUX/osi_machdep.h | 2 +- src/afs/LINUX/osi_misc.c | 2 +- src/afs/afs_osi.h | 2 +- 4 files changed, 7 insertions(+), 48 deletions(-) diff --git a/src/afs/LINUX/osi_file.c b/src/afs/LINUX/osi_file.c index 83c06bf6fa..e83277d6cd 100644 --- a/src/afs/LINUX/osi_file.c +++ b/src/afs/LINUX/osi_file.c @@ -31,30 +31,13 @@ extern struct vfsmount *afs_cacheMnt; #endif extern struct super_block *afs_cacheSBp; -/*#if defined(AFS_LINUX26_ENV) && (defined(CONFIG_EXPORTFS) || defined(CONFIG_EXPORTFS_MODULE)) -#define HAS_UFSOPEN -extern struct export_operations export_op_default; - -#define CALL(ops,fun) ((ops->fun)?(ops->fun):export_op_default.fun) - -XXX something based on encode_fh / find_exported_dentry -This would require us to store an inode -> fh mapping (acquired by -afs_InitCacheFile or lookupname), but probably solves the resiserfs issue. -#elif... */ - -#if defined(AFS_LINUX24_ENV) && !defined(HAS_UFSOPEN) -#define HAS_UFSOPEN +#if defined(AFS_LINUX26_ENV) void * osi_UFSOpen(afs_int32 ainode) { register struct osi_file *afile = NULL; extern int cacheDiskType; struct inode *tip = NULL; -#ifndef AFS_LINUX26_ENV - afs_int32 code = 0; - struct list_head *lp = NULL; - struct dentry *tdp = NULL; -#endif struct dentry *dp = NULL; struct file *filp = NULL; AFS_STATCNT(osi_UFSOpen); @@ -79,33 +62,11 @@ osi_UFSOpen(afs_int32 ainode) osi_Panic("Can't get inode %d\n", ainode); tip->i_flags |= MS_NOATIME; /* Disable updating access times. */ -#ifdef AFS_LINUX26_ENV dp = d_alloc_anon(tip); -#else - spin_lock(&dcache_lock); - for (lp = tip->i_dentry.next; lp != &tip->i_dentry; lp = lp->next) { - tdp = list_entry(lp, struct dentry, d_alias); - if ( !(tdp->d_flags & DCACHE_NFSD_DISCONNECTED)) { - dget_locked(tdp); - dp=tdp; - break; - } - } - if (tdp && !dp) { - dget_locked(tdp); - dp=tdp; - } - tdp = NULL; - spin_unlock(&dcache_lock); - if (!dp) - dp = d_alloc_root(tip); - iput(tip); -#endif if (!dp) osi_Panic("Can't get dentry for inode %d\n", ainode); filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR); - if (IS_ERR(filp)) osi_Panic("Can't open inode %d\n", ainode); afile->filp = filp; @@ -116,9 +77,7 @@ osi_UFSOpen(afs_int32 ainode) afile->inum = ainode; /* for hint validity checking */ return (void *)afile; } -#endif - -#if !defined(HAS_UFSOPEN) +#else void * osi_UFSOpen(afs_int32 ainode) { @@ -194,14 +153,14 @@ afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat) return code; } -#ifdef AFS_LINUX24_ENV +#ifdef AFS_LINUX26_ENV int osi_UFSClose(register struct osi_file *afile) { AFS_STATCNT(osi_Close); if (afile) { if (OSIFILE_INODE(afile)) { - filp_close(afile->filp, NULL); + filp_close(afile->filp, NULL); } } diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index 7d13d64b1f..c0e22b5302 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -183,7 +183,7 @@ typedef struct uio { /* Get/set the inode in the osifile struct. */ #define FILE_INODE(F) (F)->f_dentry->d_inode -#ifdef AFS_LINUX24_ENV +#ifdef AFS_LINUX26_ENV #define OSIFILE_INODE(a) FILE_INODE((a)->filp) #else #define OSIFILE_INODE(a) FILE_INODE(&(a)->file) diff --git a/src/afs/LINUX/osi_misc.c b/src/afs/LINUX/osi_misc.c index 261e428b51..b11cb7852f 100644 --- a/src/afs/LINUX/osi_misc.c +++ b/src/afs/LINUX/osi_misc.c @@ -141,7 +141,7 @@ osi_InitCacheInfo(char *aname) int osi_rdwr(struct osi_file *osifile, uio_t * uiop, int rw) { -#ifdef AFS_LINUX24_ENV +#ifdef AFS_LINUX26_ENV struct file *filp = osifile->filp; #else struct file *filp = &osifile->file; diff --git a/src/afs/afs_osi.h b/src/afs/afs_osi.h index 2e2879d73d..30f8b82fa6 100644 --- a/src/afs/afs_osi.h +++ b/src/afs/afs_osi.h @@ -48,7 +48,7 @@ struct osi_stat { struct osi_file { afs_int32 size; /* file size in bytes XXX Must be first field XXX */ -#ifdef AFS_LINUX24_ENV +#ifdef AFS_LINUX26_ENV struct file *filp; /* May need this if we really open the file. */ #else #ifdef AFS_LINUX22_ENV