]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Remove inode hinting for dcaches
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Wed, 18 Nov 2009 20:07:04 +0000 (20:07 +0000)
committerDerrick Brashear <shadow|account-1000005@unknown>
Fri, 20 Nov 2009 14:51:47 +0000 (06:51 -0800)
The VNOP read code has always contained incomplete support for inode
hinting. In theory this would let us attach open cache files to dcache
structures, so that we don't have the overhead of opening the file
with every read that we do.

However, this has been ifdef'd off ever since the first release, and
is fundamentally broken - it relied upon structure elements that just
don't exist, and has no mechanism for throttling the number of inode
hints that are maintained. Inode hinting also required that we store
an inode number within the osi_file structure (so hint validity could
be checked), which causes a problem on some modern OS's.

Simplify all of this, by just removing the partial hinting support.
If we want to revisit this in the future, then the code is in git,
but if we _do_ feel we want to keep open cache files around, it's
probably better to start from scratch!

Change-Id: Ia378922f7fcc24fb27b343015dbd16818302ec10
Reviewed-on: http://gerrit.openafs.org/850
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
15 files changed:
src/afs/AIX/osi_file.c
src/afs/DARWIN/osi_file.c
src/afs/FBSD/osi_file.c
src/afs/HPUX/osi_file.c
src/afs/IRIX/osi_file.c
src/afs/LINUX/osi_file.c
src/afs/LINUX24/osi_file.c
src/afs/NBSD/osi_file.c
src/afs/OBSD/osi_file.c
src/afs/SOLARIS/osi_file.c
src/afs/UKERNEL/afs_usrops.c
src/afs/VNOPS/afs_vnop_read.c
src/afs/afs_init.c
src/afs/afs_osi.h
src/afs/afs_prototypes.h

index ac0dcac24d980cb54aedb49333621e4eb96070eb..410843b9e1117696e256e107ff75525decfbd634 100644 (file)
@@ -56,7 +56,6 @@ osi_UFSOpen(afs_dcache_id_t *ainode)
     afile->size = VTOI(afile->vnode)->i_size;
     afile->offset = 0;
     afile->proc = (int (*)())0;
-    afile->inum = ainode->ufs; /* for hint validity checking */
     return (void *)afile;
 }
 
index 13067a748a1e9e23eae070bab1d4828c27ca6d85..3edd4967ff0d407d9071053ef019bf0748daf641 100644 (file)
@@ -198,7 +198,6 @@ osi_UFSOpen(afs_dcache_id_t *ainode)
     afile->vnode = vp;
     afile->offset = 0;
     afile->proc = (int (*)())0;
-    afile->inum = ainode->ufs; /* for hint validity checking */
 #ifndef AFS_CACHE_VNODE_PATH
     afile->size = va.va_size;
 #else
index 8dc94113f91e1ea766117feb90730921f131a1da..fdac540c424e208378382b6facd63e7f2dcba48d 100644 (file)
@@ -59,7 +59,6 @@ osi_UFSOpen(afs_dcache_id_t *ainode)
     afile->size = VTOI(vp)->i_size;
     afile->offset = 0;
     afile->proc = NULL;
-    afile->inum = ainode->ufs; /* for hint validity checking */
     return (void *)afile;
 }
 
index 14bd7684de518b2ef6a434880ff90b4533c96e55..1d2ae5c3acb9abaa290d7b43944b2470e073e301 100644 (file)
@@ -57,7 +57,6 @@ osi_UFSOpen(afs_dcache_id_t *ainode)
     afile->size = VTOI(afile->vnode)->i_size;
     afile->offset = 0;
     afile->proc = (int (*)())0;
-    afile->inum = ainode->ufs; /* for hint validity checking */
     return (void *)afile;
 }
 
index 21e4b96cb90ad6796fe3b1c5a2024e01eb9d63c7..10ca92d6e04619d917012966f179ecd57181afaa 100644 (file)
@@ -62,7 +62,6 @@ osi_UFSOpen(afs_dcache_id_t *ainode)
     afile->size = VnodeToSize(afile->vnode);
     afile->offset = 0;
     afile->proc = (int (*)())0;
-    afile->inum = ainode->ufs; /* for hint validity checking */
     return (void *)afile;
 }
 
index a1eebe398d6382a38d3fbcfc0ccbb8dee2c1bba4..7af6b6d710ade79e44976a1ea0ae63532e8c1684 100644 (file)
@@ -32,7 +32,7 @@ extern struct cred *cache_creds;
 #endif
 
 struct file *
-afs_linux_raw_open(afs_dcache_id_t *ainode, ino_t *hint)
+afs_linux_raw_open(afs_dcache_id_t *ainode)
 {
     struct inode *tip = NULL;
     struct dentry *dp = NULL;
@@ -65,8 +65,6 @@ afs_linux_raw_open(afs_dcache_id_t *ainode, ino_t *hint)
 #else
        osi_Panic("Can't open inode %d\n", (int) ainode->ufs);
 #endif
-    if (hint)
-       *hint = tip->i_ino;
     return filp;
 }
 
@@ -94,7 +92,7 @@ osi_UFSOpen(afs_dcache_id_t *ainode)
     }
     memset(afile, 0, sizeof(struct osi_file));
 
-    afile->filp = afs_linux_raw_open(ainode, &afile->inum);
+    afile->filp = afs_linux_raw_open(ainode);
     afile->size = i_size_read(FILE_INODE(afile->filp));
     AFS_GLOCK();
     afile->offset = 0;
index 56959ea3a80ca6903f1c86eea606d01dcd9ef9fc..ba58d051bf7e8a24a36063ba440a2d2f75f7487c 100644 (file)
@@ -36,7 +36,7 @@ extern struct super_block *afs_cacheSBp;
 
 #if defined(AFS_LINUX26_ENV) 
 struct file *
-afs_linux_raw_open(afs_dcache_id_t *ainode, ino_t *hint)
+afs_linux_raw_open(afs_dcache_id_t *ainode)
 {
     struct inode *tip = NULL;
     struct dentry *dp = NULL;
@@ -68,8 +68,6 @@ afs_linux_raw_open(afs_dcache_id_t *ainode, ino_t *hint)
 #else
        osi_Panic("Can't open inode %d\n", (int) ainode->ufs);
 #endif
-    if (hint)
-       *hint = tip->i_ino;
     return filp;
 }
 
@@ -97,7 +95,7 @@ osi_UFSOpen(afs_dcache_id_t *ainode)
     }
     memset(afile, 0, sizeof(struct osi_file));
 
-    afile->filp = afs_linux_raw_open(ainode, &afile->inum);
+    afile->filp = afs_linux_raw_open(ainode);
     afile->size = i_size_read(FILE_INODE(afile->filp));
     AFS_GLOCK();
     afile->offset = 0;
@@ -152,7 +150,6 @@ osi_UFSOpen(afs_dcache_id_t *ainode)
     AFS_GLOCK();
     afile->offset = 0;
     afile->proc = (int (*)())0;
-    afile->inum = ainode->ufs; /* for hint validity checking */
     return (void *)afile;
 }
 #endif
index 312b9fd50529c3aa49f11444e7304c1f147f081f..cf85911fb7cda2bed03f314b90fb141591e8a67d 100644 (file)
@@ -49,7 +49,6 @@ osi_UFSOpen(afs_dcache_id_t *ainode)
     afile->size = VTOI(afile->vnode)->i_size;
     afile->offset = 0;
     afile->proc = (int (*)())0;
-    afile->inum = ainode->ufs; /* for hint validity checking */
     return (void *)afile;
 }
 
index 3cc2d1f907f33897b9f3b6596ffa8ff7befeaf12..a82cd02b81201ccb73450aff0c0a299102f62726 100644 (file)
@@ -53,7 +53,6 @@ osi_UFSOpen(afs_dcache_id_t *ainode)
 #endif
     afile->offset = 0;
     afile->proc = NULL;
-    afile->inum = ainode->ufs; /* for hint validity checking */
     return (void *)afile;
 }
 
index 858d52a2b49757a1b5d0b82ca37f77c8e5ef055c..5b18303aaeb6c358a0ef86211234ee81cefe20f1 100644 (file)
@@ -160,7 +160,6 @@ osi_VxfsOpen(afs_dcache_id_t *ainode)
     afile->size = VnodeToSize(afile->vnode);
     afile->offset = 0;
     afile->proc = (int (*)())0;
-    afile->inum = ainode->ufs; /* for hint validity checking */
     return (void *)afile;
 }
 #endif /* AFS_HAVE_VXFS */
@@ -249,7 +248,6 @@ osi_UfsOpen(afs_dcache_id_t *ainode)
 #endif
     afile->offset = 0;
     afile->proc = (int (*)())0;
-    afile->inum = ainode->ufs; /* for hint validity checking */
     return (void *)afile;
 }
 
index 663d481c15a241950767cab4f07106b084c64410..353d0e70b30429f2d79933fb5ff35d99acd5d53c 100644 (file)
@@ -731,7 +731,6 @@ osi_UFSOpen(afs_dcache_id_t *ino)
     }
     fp->size = st.st_size;
     fp->offset = 0;
-    fp->inum = ino->ufs;
     fp->vnode = (struct usr_vnode *)fp;
 
     AFS_GLOCK();
index 3f6f0b5feefede125ca77d43af2c748430d853b7..6ca652b60f89c7c9cda2a8417cde45a88cbe6e32 100644 (file)
 
 extern char afs_zeros[AFS_ZEROS];
 
-afs_int32 maxIHint;
-afs_int32 nihints;             /* # of above actually in-use */
-afs_int32 usedihint;
-
-
 /* Imported variables */
 extern afs_rwlock_t afs_xdcache;
 extern unsigned char *afs_indexFlags;
@@ -790,20 +785,6 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio,
            }
        } else {
            /* get the data from the file */
-#ifdef IHINT
-           if (tfile = tdc->ihint) {
-               if (tdc->f.inode != tfile->inum) {
-                   afs_warn("afs_UFSRead: %x hint mismatch tdc %d inum %d\n",
-                            tdc, tdc->f.inode, tfile->inum);
-                   osi_UFSClose(tfile);
-                   tdc->ihint = tfile = 0;
-                   nihints--;
-               }
-           }
-           if (tfile != 0) {
-               usedihint++;
-           } else
-#endif /* IHINT */
            tfile = (struct osi_file *)osi_UFSOpen(&tdc->f.inode);
 #ifdef AFS_DARWIN80_ENV
            trimlen = len;
@@ -916,14 +897,7 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio,
 #else
            code = VOP_RDWR(tfile->vnode, &tuio, UIO_READ, 0, afs_osi_credp);
 #endif
-
-#ifdef IHINT
-           if (!tdc->ihint && nihints < maxIHint) {
-               tdc->ihint = tfile;
-               nihints++;
-           } else
-#endif /* IHINT */
-               osi_UFSClose(tfile);
+           osi_UFSClose(tfile);
 
            if (code) {
                error = code;
index 69bf17826ba952d214df76a1593fd21f1b7fabd5..8eba2e6e74f9b76f016973f65a04283ab36b4292 100644 (file)
@@ -127,9 +127,6 @@ afs_CacheInit(afs_int32 astatSize, afs_int32 afiles, afs_int32 ablocks,
        return 0;
     afs_cacheinit_flag = 1;
     cacheInfoModTime = 0;
-    maxIHint = ninodes;
-    nihints = 0;
-    usedihint = 0;
 
     LOCK_INIT(&afs_ftf, "afs_ftf");
     AFS_RWLOCK_INIT(&afs_xaxs, "afs_xaxs");
@@ -694,7 +691,7 @@ shutdown_cache(void)
 
        afs_cacheStats = 0;
        afs_cacheFiles = afs_cacheBlocks = 0;
-       pag_epoch = maxIHint = nihints = usedihint = 0;
+       pag_epoch = 0;
        pagCounter = 0;
 #if defined(AFS_XBSD_ENV)
        vrele(volumeVnode);     /* let it go, finally. */
index 66c2e058e7c49fcdde8ac7f565f95841f6414152..805b2b144e55bc53c3db046fc3dfd3581d985cd6 100644 (file)
@@ -68,7 +68,6 @@ struct osi_file {
 #endif
     int (*proc) (struct osi_file * afile, afs_int32 code);     /* proc, which, if not null, is called on writes */
     char *rock;                        /* rock passed to proc */
-    ino_t inum;                        /* guarantee validity of hint */
 #if defined(UKERNEL)
     int fd;                    /* file descriptor for user space files */
 #endif                         /* defined(UKERNEL) */
index fde30dcbe2f268bec76a0cda3fe1b32511f69070..327e2e906dce19878ef6bb43b5bba16c9638128f 100644 (file)
@@ -1170,9 +1170,6 @@ extern int afs_open(struct vcache **avcp, afs_int32 aflags,
 
 
 /* VNOPS/afs_vnop_read.c */
-extern afs_int32 maxIHint;
-extern afs_int32 nihints;
-extern afs_int32 usedihint;
 extern int afs_MemRead(register struct vcache *avc, struct uio *auio,
                       afs_ucred_t *acred, daddr_t albn,
                       struct buf **abpp, int noLock);