hammer2 - Embed cache_index heuristic in chain structure
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 31 Aug 2017 02:49:29 +0000 (19:49 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 31 Aug 2017 05:19:01 +0000 (22:19 -0700)
* Embed the cache_index heuristic in the hammer2_chain structure and get
  rid of all the code that passed it in to various API functions.  This
  substantially cleans-up the API.

* Adjust comments for upcoming error handling work.

12 files changed:
sys/vfs/hammer2/hammer2.h
sys/vfs/hammer2/hammer2_bulkfree.c
sys/vfs/hammer2/hammer2_chain.c
sys/vfs/hammer2/hammer2_flush.c
sys/vfs/hammer2/hammer2_freemap.c
sys/vfs/hammer2/hammer2_inode.c
sys/vfs/hammer2/hammer2_iocom.c
sys/vfs/hammer2/hammer2_ioctl.c
sys/vfs/hammer2/hammer2_strategy.c
sys/vfs/hammer2/hammer2_synchro.c
sys/vfs/hammer2/hammer2_vfsops.c
sys/vfs/hammer2/hammer2_xops.c

index 7674a0b..eea38fc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The DragonFly Project.  All rights reserved.
+ * Copyright (c) 2011-2017 The DragonFly Project.  All rights reserved.
  *
  * This code is derived from software contributed to The DragonFly Project
  * by Matthew Dillon <dillon@dragonflybsd.org>
@@ -310,7 +310,7 @@ struct hammer2_chain {
        u_int           refs;
        u_int           lockcnt;
        int             error;                  /* on-lock data error state */
-       int             unused01;               /* (aka ip->cluster) */
+       int             cache_index;            /* heur speeds up lookup */
 
        hammer2_media_data_t *data;             /* data pointer shortcut */
        TAILQ_ENTRY(hammer2_chain) flush_node;  /* flush list */
@@ -563,7 +563,6 @@ RB_PROTOTYPE(hammer2_chain_tree, hammer2_chain, rbnode, hammer2_chain_cmp);
 
 struct hammer2_cluster_item {
        hammer2_chain_t         *chain;
-       int                     cache_index;
        int                     error;
        uint32_t                flags;
 };
@@ -1452,16 +1451,16 @@ hammer2_chain_t *hammer2_chain_repparent(hammer2_chain_t **chainp, int how);
 hammer2_chain_t *hammer2_chain_lookup(hammer2_chain_t **parentp,
                                hammer2_key_t *key_nextp,
                                hammer2_key_t key_beg, hammer2_key_t key_end,
-                               int *cache_indexp, int flags);
+                               int flags);
 hammer2_chain_t *hammer2_chain_next(hammer2_chain_t **parentp,
                                hammer2_chain_t *chain,
                                hammer2_key_t *key_nextp,
                                hammer2_key_t key_beg, hammer2_key_t key_end,
-                               int *cache_indexp, int flags);
+                               int flags);
 int hammer2_chain_scan(hammer2_chain_t *parent,
                                hammer2_chain_t **chainp,
                                hammer2_blockref_t *bref,
-                               int *firstp, int *cache_indexp, int flags);
+                               int *firstp, int flags);
 
 int hammer2_chain_create(hammer2_chain_t **parentp, hammer2_chain_t **chainp,
                                hammer2_pfs_t *pmp, int methods,
@@ -1491,10 +1490,10 @@ void hammer2_pfs_memory_wakeup(hammer2_pfs_t *pmp);
 
 void hammer2_base_delete(hammer2_chain_t *chain,
                                hammer2_blockref_t *base, int count,
-                               int *cache_indexp, hammer2_chain_t *child);
+                               hammer2_chain_t *child);
 void hammer2_base_insert(hammer2_chain_t *chain,
                                hammer2_blockref_t *base, int count,
-                               int *cache_indexp, hammer2_chain_t *child);
+                               hammer2_chain_t *child);
 
 /*
  * hammer2_flush.c
index 138df8c..17f9110 100644 (file)
@@ -103,7 +103,6 @@ hammer2_bulk_scan(hammer2_chain_t *parent,
 {
        hammer2_blockref_t bref;
        hammer2_chain_t *chain;
-       int cache_index = -1;
        int first = 1;
        int rup_error;
        int error;
@@ -126,7 +125,6 @@ hammer2_bulk_scan(hammer2_chain_t *parent,
         */
        for (;;) {
                error |= hammer2_chain_scan(parent, &chain, &bref, &first,
-                                           &cache_index,
                                            HAMMER2_LOOKUP_NODATA |
                                            HAMMER2_LOOKUP_SHARED);
 
@@ -679,7 +677,6 @@ h2_bulkfree_sync(hammer2_bulkfree_info_t *cbinfo)
        hammer2_bmap_data_t *live;
        hammer2_chain_t *live_parent;
        hammer2_chain_t *live_chain;
-       int cache_index = -1;
        int bmapindex;
 
        kprintf("hammer2_bulkfree - range ");
@@ -736,7 +733,6 @@ h2_bulkfree_sync(hammer2_bulkfree_info_t *cbinfo)
                                            &key_dummy,
                                            key,
                                            key + HAMMER2_FREEMAP_LEVEL1_MASK,
-                                           &cache_index,
                                            HAMMER2_LOOKUP_ALWAYS);
 
 #if 0
index aef1c24..1d45feb 100644 (file)
@@ -72,7 +72,7 @@ static hammer2_io_t *hammer2_chain_drop_data(hammer2_chain_t *chain);
 static hammer2_chain_t *hammer2_combined_find(
                hammer2_chain_t *parent,
                hammer2_blockref_t *base, int count,
-               int *cache_indexp, hammer2_key_t *key_nextp,
+               hammer2_key_t *key_nextp,
                hammer2_key_t key_beg, hammer2_key_t key_end,
                hammer2_blockref_t **bresp);
 
@@ -2034,7 +2034,10 @@ hammer2_chain_find_callback(hammer2_chain_t *child, void *data)
 
 /*
  * Retrieve the specified chain from a media blockref, creating the
- * in-memory chain structure which reflects it.
+ * in-memory chain structure which reflects it.  The returned chain is
+ * held but not locked.  The caller must lock it to crc-check and
+ * dereference its data, and should check chain->error after locking
+ * before assuming that the data is good.
  *
  * To handle insertion races pass the INSERT_RACE flag along with the
  * generation number of the core.  NULL will be returned if the generation
@@ -2130,6 +2133,9 @@ hammer2_chain_lookup_done(hammer2_chain_t *parent)
  * Take the locked chain and return a locked parent.  The chain remains
  * locked on return.
  *
+ * This will work even if the chain is errored, and the caller can check
+ * parent->error on return if desired since the parent will be locked.
+ *
  * This function handles the lock order reversal.
  */
 hammer2_chain_t *
@@ -2173,6 +2179,9 @@ again:
  * Take the locked chain and return a locked parent.  The chain is unlocked
  * and dropped.  *chainp is set to the returned parent as a convenience.
  *
+ * This will work even if the chain is errored, and the caller can check
+ * parent->error on return if desired since the parent will be locked.
+ *
  * This function handles the lock order reversal.
  */
 hammer2_chain_t *
@@ -2223,13 +2232,21 @@ again:
  * indirect block and this function will recurse upwards and find the inode
  * again.
  *
+ * This function unconditionally sets *errorp, replacing any previous value.
+ *
  * (*parentp) must be exclusively locked and referenced and can be an inode
- * or an existing indirect block within the inode.
+ * or an existing indirect block within the inode.  If (*parent) is errored
+ * out, this function will not attempt to recurse the radix tree and
+ * will return NULL along with an appropriate *errorp.  If NULL is returned
+ * and *errorp is 0, the requested lookup could not be located.
  *
  * On return (*parentp) will be modified to point at the deepest parent chain
  * element encountered during the search, as a helper for an insertion or
  * deletion.   The new (*parentp) will be locked and referenced and the old
  * will be unlocked and dereferenced (no change if they are both the same).
+ * This is particularly important if the caller wishes to insert a new chain,
+ * (*parentp) will be set properly even if NULL is returned, as long as no
+ * error occurred.
  *
  * The matching chain will be returned exclusively locked.  If NOLOCK is
  * requested the chain will be returned only referenced.  Note that the
@@ -2244,12 +2261,6 @@ again:
  * NULL is returned if no match was found, but (*parentp) will still
  * potentially be adjusted.
  *
- * If a fatal error occurs (typically an I/O error), a dummy chain is
- * returned with chain->error and error-identifying information set.  This
- * chain will assert if you try to do anything fancy with it.
- *
- * XXX Depending on where the error occurs we should allow continued iteration.
- *
  * On return (*key_nextp) will point to an iterative value for key_beg.
  * (If NULL is returned (*key_nextp) is set to (key_end + 1)).
  *
@@ -2267,7 +2278,7 @@ again:
 hammer2_chain_t *
 hammer2_chain_lookup(hammer2_chain_t **parentp, hammer2_key_t *key_nextp,
                     hammer2_key_t key_beg, hammer2_key_t key_end,
-                    int *cache_indexp, int flags)
+                    int flags)
 {
        hammer2_dev_t *hmp;
        hammer2_chain_t *parent;
@@ -2431,7 +2442,7 @@ again:
         */
        hammer2_spin_ex(&parent->core.spin);
        chain = hammer2_combined_find(parent, base, count,
-                                     cache_indexp, key_nextp,
+                                     key_nextp,
                                      key_beg, key_end,
                                      &bref);
        generation = parent->core.generation;
@@ -2584,7 +2595,7 @@ hammer2_chain_t *
 hammer2_chain_next(hammer2_chain_t **parentp, hammer2_chain_t *chain,
                   hammer2_key_t *key_nextp,
                   hammer2_key_t key_beg, hammer2_key_t key_end,
-                  int *cache_indexp, int flags)
+                  int flags)
 {
        hammer2_chain_t *parent;
        int how_maybe;
@@ -2648,7 +2659,7 @@ hammer2_chain_next(hammer2_chain_t **parentp, hammer2_chain_t *chain,
         */
        return (hammer2_chain_lookup(parentp, key_nextp,
                                     key_beg, key_end,
-                                    cache_indexp, flags));
+                                    flags));
 }
 
 /*
@@ -2680,7 +2691,7 @@ hammer2_chain_next(hammer2_chain_t **parentp, hammer2_chain_t *chain,
 int
 hammer2_chain_scan(hammer2_chain_t *parent, hammer2_chain_t **chainp,
                   hammer2_blockref_t *bref, int *firstp,
-                  int *cache_indexp, int flags)
+                  int flags)
 {
        hammer2_dev_t *hmp;
        hammer2_blockref_t *base;
@@ -2814,7 +2825,7 @@ again:
        bref_ptr = NULL;
        hammer2_spin_ex(&parent->core.spin);
        chain = hammer2_combined_find(parent, base, count,
-                                     cache_indexp, &next_key,
+                                     &next_key,
                                      key, HAMMER2_KEY_MAX,
                                      &bref_ptr);
        generation = parent->core.generation;
@@ -3434,9 +3445,7 @@ _hammer2_chain_delete_helper(hammer2_chain_t *parent, hammer2_chain_t *chain,
                 * undone.  XXX split update possible w/delete in middle?
                 */
                if (base) {
-                       int cache_index = -1;
-                       hammer2_base_delete(parent, base, count,
-                                           &cache_index, chain);
+                       hammer2_base_delete(parent, base, count, chain);
                }
                hammer2_spin_unex(&parent->core.spin);
                hammer2_spin_unex(&chain->core.spin);
@@ -3543,7 +3552,6 @@ hammer2_chain_create_indirect(hammer2_chain_t *parent,
        int count;
        int ncount;
        int nbytes;
-       int cache_index;
        int loops;
        int reason;
        int generation;
@@ -3687,7 +3695,6 @@ hammer2_chain_create_indirect(hammer2_chain_t *parent,
        key_beg = 0;
        key_end = HAMMER2_KEY_MAX;
        key_next = 0;   /* avoid gcc warnings */
-       cache_index = 0;
        hammer2_spin_ex(&parent->core.spin);
        loops = 0;
        reason = 0;
@@ -3712,7 +3719,7 @@ hammer2_chain_create_indirect(hammer2_chain_t *parent,
                 *       until we lock it.
                 */
                chain = hammer2_combined_find(parent, base, count,
-                                             &cache_index, &key_next,
+                                             &key_next,
                                              key_beg, key_end,
                                              &bref);
                generation = parent->core.generation;
@@ -3889,7 +3896,6 @@ hammer2_chain_indkey_freemap(hammer2_chain_t *parent, hammer2_key_t *keyp,
        hammer2_key_t key_beg;
        hammer2_key_t key_end;
        hammer2_key_t key_next;
-       int cache_index;
        int locount;
        int hicount;
        int maxloops = 300000;
@@ -3905,7 +3911,6 @@ hammer2_chain_indkey_freemap(hammer2_chain_t *parent, hammer2_key_t *keyp,
         */
        key_beg = 0;
        key_end = HAMMER2_KEY_MAX;
-       cache_index = 0;
        hammer2_spin_ex(&parent->core.spin);
 
        for (;;) {
@@ -3914,7 +3919,7 @@ hammer2_chain_indkey_freemap(hammer2_chain_t *parent, hammer2_key_t *keyp,
                              parent, base, count);
                }
                chain = hammer2_combined_find(parent, base, count,
-                                             &cache_index, &key_next,
+                                             &key_next,
                                              key_beg, key_end,
                                              &bref);
 
@@ -4010,7 +4015,6 @@ hammer2_chain_indkey_file(hammer2_chain_t *parent, hammer2_key_t *keyp,
        hammer2_key_t key_end;
        hammer2_key_t key_next;
        int nradix;
-       int cache_index;
        int locount;
        int hicount;
        int maxloops = 300000;
@@ -4028,7 +4032,6 @@ hammer2_chain_indkey_file(hammer2_chain_t *parent, hammer2_key_t *keyp,
         */
        key_beg = 0;
        key_end = HAMMER2_KEY_MAX;
-       cache_index = 0;
        hammer2_spin_ex(&parent->core.spin);
 
        for (;;) {
@@ -4037,7 +4040,7 @@ hammer2_chain_indkey_file(hammer2_chain_t *parent, hammer2_key_t *keyp,
                              parent, base, count);
                }
                chain = hammer2_combined_find(parent, base, count,
-                                             &cache_index, &key_next,
+                                             &key_next,
                                              key_beg, key_end,
                                              &bref);
 
@@ -4138,7 +4141,6 @@ hammer2_chain_indkey_dir(hammer2_chain_t *parent, hammer2_key_t *keyp,
        int nkeybits;
        int locount;
        int hicount;
-       int cache_index;
        int maxloops = 300000;
 
        /*
@@ -4160,7 +4162,6 @@ hammer2_chain_indkey_dir(hammer2_chain_t *parent, hammer2_key_t *keyp,
         */
        key_beg = 0;
        key_end = HAMMER2_KEY_MAX;
-       cache_index = 0;
        hammer2_spin_ex(&parent->core.spin);
 
        for (;;) {
@@ -4169,7 +4170,7 @@ hammer2_chain_indkey_dir(hammer2_chain_t *parent, hammer2_key_t *keyp,
                              parent, base, count);
                }
                chain = hammer2_combined_find(parent, base, count,
-                                             &cache_index, &key_next,
+                                             &key_next,
                                              key_beg, key_end,
                                              &bref);
 
@@ -4314,7 +4315,6 @@ hammer2_chain_indkey_dir(hammer2_chain_t *parent, hammer2_key_t *keyp,
        int nkeybits;
        int locount;
        int hicount;
-       int cache_index;
        int maxloops = 300000;
 
        /*
@@ -4336,7 +4336,6 @@ hammer2_chain_indkey_dir(hammer2_chain_t *parent, hammer2_key_t *keyp,
         */
        key_beg = 0;
        key_end = HAMMER2_KEY_MAX;
-       cache_index = 0;
        hammer2_spin_ex(&parent->core.spin);
 
        for (;;) {
@@ -4345,7 +4344,7 @@ hammer2_chain_indkey_dir(hammer2_chain_t *parent, hammer2_key_t *keyp,
                              parent, base, count);
                }
                chain = hammer2_combined_find(parent, base, count,
-                                             &cache_index, &key_next,
+                                             &key_next,
                                              key_beg, key_end,
                                              &bref);
 
@@ -4517,16 +4516,13 @@ hammer2_chain_delete(hammer2_chain_t *parent, hammer2_chain_t *chain,
  * Note that *key_nexp can overflow to 0, which should be tested by the
  * caller.
  *
- * (*cache_indexp) is a heuristic and can be any value without effecting
- * the result.
- *
  * WARNING!  Must be called with parent's spinlock held.  Spinlock remains
  *          held through the operation.
  */
 static int
 hammer2_base_find(hammer2_chain_t *parent,
                  hammer2_blockref_t *base, int count,
-                 int *cache_indexp, hammer2_key_t *key_nextp,
+                 hammer2_key_t *key_nextp,
                  hammer2_key_t key_beg, hammer2_key_t key_end)
 {
        hammer2_blockref_t *scan;
@@ -4547,13 +4543,13 @@ hammer2_base_find(hammer2_chain_t *parent,
                return(count);
 
        /*
-        * Sequential optimization using *cache_indexp.  This is the most
-        * likely scenario.
+        * Sequential optimization using parent->cache_index.  This is
+        * the most likely scenario.
         *
         * We can avoid trailing empty entries on live chains, otherwise
         * we might have to check the whole block array.
         */
-       i = *cache_indexp;
+       i = parent->cache_index;        /* SMP RACE OK */
        cpu_ccfence();
        limit = parent->core.live_zero;
        if (i >= limit)
@@ -4570,7 +4566,7 @@ hammer2_base_find(hammer2_chain_t *parent,
                --scan;
                --i;
        }
-       *cache_indexp = i;
+       parent->cache_index = i;
 
        /*
         * Search forwards, stop when we find a scan element which
@@ -4590,7 +4586,7 @@ hammer2_base_find(hammer2_chain_t *parent,
                ++i;
        }
        if (i != count) {
-               *cache_indexp = i;
+               parent->cache_index = i;
                if (i >= limit) {
                        i = count;
                } else {
@@ -4625,7 +4621,7 @@ hammer2_base_find(hammer2_chain_t *parent,
 static hammer2_chain_t *
 hammer2_combined_find(hammer2_chain_t *parent,
                      hammer2_blockref_t *base, int count,
-                     int *cache_indexp, hammer2_key_t *key_nextp,
+                     hammer2_key_t *key_nextp,
                      hammer2_key_t key_beg, hammer2_key_t key_end,
                      hammer2_blockref_t **bresp)
 {
@@ -4637,8 +4633,8 @@ hammer2_combined_find(hammer2_chain_t *parent,
         * Lookup in block array and in rbtree.
         */
        *key_nextp = key_end + 1;
-       i = hammer2_base_find(parent, base, count, cache_indexp,
-                             key_nextp, key_beg, key_end);
+       i = hammer2_base_find(parent, base, count, key_nextp,
+                             key_beg, key_end);
        chain = hammer2_chain_find(parent, key_nextp, key_beg, key_end);
 
        /*
@@ -4714,7 +4710,7 @@ found:
 void
 hammer2_base_delete(hammer2_chain_t *parent,
                    hammer2_blockref_t *base, int count,
-                   int *cache_indexp, hammer2_chain_t *chain)
+                   hammer2_chain_t *chain)
 {
        hammer2_blockref_t *elm = &chain->bref;
        hammer2_blockref_t *scan;
@@ -4728,8 +4724,8 @@ hammer2_base_delete(hammer2_chain_t *parent,
         *     re-flushed in some cases.
         */
        key_next = 0; /* max range */
-       i = hammer2_base_find(parent, base, count, cache_indexp,
-                             &key_next, elm->key, elm->key);
+       i = hammer2_base_find(parent, base, count, &key_next,
+                             elm->key, elm->key);
        scan = &base[i];
        if (i == count || scan->type == 0 ||
            scan->key != elm->key ||
@@ -4795,7 +4791,7 @@ hammer2_base_delete(hammer2_chain_t *parent,
 void
 hammer2_base_insert(hammer2_chain_t *parent,
                    hammer2_blockref_t *base, int count,
-                   int *cache_indexp, hammer2_chain_t *chain)
+                   hammer2_chain_t *chain)
 {
        hammer2_blockref_t *elm = &chain->bref;
        hammer2_key_t key_next;
@@ -4814,8 +4810,8 @@ hammer2_base_insert(hammer2_chain_t *parent,
         *     re-flushed in some cases.
         */
        key_next = 0; /* max range */
-       i = hammer2_base_find(parent, base, count, cache_indexp,
-                             &key_next, elm->key, elm->key);
+       i = hammer2_base_find(parent, base, count, &key_next,
+                             elm->key, elm->key);
 
        /*
         * Shortcut fill optimization, typical ordered insertion(s) may not
@@ -5221,7 +5217,6 @@ hammer2_chain_inode_find(hammer2_pfs_t *pmp, hammer2_key_t inum,
        hammer2_chain_t *parent;
        hammer2_chain_t *rchain;
        hammer2_key_t key_dummy;
-       int cache_index = -1;
        int resolve_flags;
 
        resolve_flags = (flags & HAMMER2_LOOKUP_SHARED) ?
@@ -5250,7 +5245,7 @@ hammer2_chain_inode_find(hammer2_pfs_t *pmp, hammer2_key_t inum,
        if (parent) {
                rchain = hammer2_chain_lookup(&parent, &key_dummy,
                                              inum, inum,
-                                             &cache_index, flags);
+                                             flags);
        }
        *parentp = parent;
        *chainp = rchain;
index 30987e3..a679b4a 100644 (file)
@@ -68,7 +68,7 @@ struct hammer2_flush_info {
        hammer2_chain_t *parent;
        int             depth;
        int             diddeferral;
-       int             cache_index;
+       int             unused01;
        int             flags;
        struct h2_flush_list flushq;
        hammer2_chain_t *debug;
@@ -344,7 +344,6 @@ hammer2_flush(hammer2_chain_t *chain, int flags)
         */
        bzero(&info, sizeof(info));
        TAILQ_INIT(&info.flushq);
-       info.cache_index = -1;
        info.flags = flags & ~HAMMER2_FLUSH_TOP;
 
        /*
@@ -1039,8 +1038,7 @@ hammer2_flush_core(hammer2_flush_info_t *info, hammer2_chain_t *chain,
                if (base && (chain->flags & HAMMER2_CHAIN_BMAPUPD)) {
                        if (chain->flags & HAMMER2_CHAIN_BMAPPED) {
                                hammer2_spin_ex(&parent->core.spin);
-                               hammer2_base_delete(parent, base, count,
-                                                   &info->cache_index, chain);
+                               hammer2_base_delete(parent, base, count, chain);
                                hammer2_spin_unex(&parent->core.spin);
                                /* base_delete clears both bits */
                        } else {
@@ -1050,8 +1048,7 @@ hammer2_flush_core(hammer2_flush_info_t *info, hammer2_chain_t *chain,
                }
                if (base && (chain->flags & HAMMER2_CHAIN_BMAPPED) == 0) {
                        hammer2_spin_ex(&parent->core.spin);
-                       hammer2_base_insert(parent, base, count,
-                                           &info->cache_index, chain);
+                       hammer2_base_insert(parent, base, count, chain);
                        hammer2_spin_unex(&parent->core.spin);
                        /* base_insert sets BMAPPED */
                }
index c237654..5a97f64 100644 (file)
@@ -323,7 +323,6 @@ hammer2_freemap_try_alloc(hammer2_chain_t **parentp,
        size_t bytes;
        uint16_t class;
        int error = 0;
-       int cache_index = -1;
 
        /*
         * Calculate the number of bytes being allocated, the number
@@ -347,7 +346,6 @@ hammer2_freemap_try_alloc(hammer2_chain_t **parentp,
        l1mask = l1size - 1;
 
        chain = hammer2_chain_lookup(parentp, &key_dummy, key, key + l1mask,
-                                    &cache_index,
                                     HAMMER2_LOOKUP_ALWAYS |
                                     HAMMER2_LOOKUP_MATCHIND);
 
@@ -933,7 +931,6 @@ hammer2_freemap_adjust(hammer2_dev_t *hmp, hammer2_blockref_t *bref,
        int start;
        int count;
        int modified = 0;
-       int cache_index = -1;
        int error;
        size_t bgsize = 0;
 
@@ -974,7 +971,6 @@ hammer2_freemap_adjust(hammer2_dev_t *hmp, hammer2_blockref_t *bref,
        hammer2_chain_lock(parent, HAMMER2_RESOLVE_ALWAYS);
 
        chain = hammer2_chain_lookup(&parent, &key_dummy, key, key + l1mask,
-                                    &cache_index,
                                     HAMMER2_LOOKUP_ALWAYS |
                                     HAMMER2_LOOKUP_MATCHIND);
 
index 4141749..08f25eb 100644 (file)
@@ -1306,7 +1306,6 @@ hammer2_inode_xop_mkdirent(hammer2_thread_t *thr, hammer2_xop_t *arg)
        hammer2_chain_t *chain;
        hammer2_key_t key_next;
        size_t data_len;
-       int cache_index = -1;
        int error;
 
        if (hammer2_debug & 0x0001)
@@ -1322,7 +1321,7 @@ hammer2_inode_xop_mkdirent(hammer2_thread_t *thr, hammer2_xop_t *arg)
        }
        chain = hammer2_chain_lookup(&parent, &key_next,
                                     xop->lhc, xop->lhc,
-                                    &cache_index, 0);
+                                    0);
        if (chain) {
                error = EEXIST;
                goto fail;
@@ -1388,7 +1387,6 @@ hammer2_inode_xop_create(hammer2_thread_t *thr, hammer2_xop_t *arg)
        hammer2_chain_t *parent;
        hammer2_chain_t *chain;
        hammer2_key_t key_next;
-       int cache_index = -1;
        int error;
 
        if (hammer2_debug & 0x0001)
@@ -1404,7 +1402,7 @@ hammer2_inode_xop_create(hammer2_thread_t *thr, hammer2_xop_t *arg)
        }
        chain = hammer2_chain_lookup(&parent, &key_next,
                                     xop->lhc, xop->lhc,
-                                    &cache_index, 0);
+                                    0);
        if (chain) {
                error = EEXIST;
                goto fail;
@@ -1497,7 +1495,6 @@ hammer2_inode_xop_unlinkall(hammer2_thread_t *thr, hammer2_xop_t *arg)
        hammer2_chain_t *parent;
        hammer2_chain_t *chain;
        hammer2_key_t key_next;
-       int cache_index = -1;
 
        /*
         * We need the precise parent chain to issue the deletion.
@@ -1511,7 +1508,6 @@ hammer2_inode_xop_unlinkall(hammer2_thread_t *thr, hammer2_xop_t *arg)
        }
        chain = hammer2_chain_lookup(&parent, &key_next,
                                     xop->key_beg, xop->key_end,
-                                    &cache_index,
                                     HAMMER2_LOOKUP_ALWAYS);
        while (chain) {
                hammer2_chain_delete(parent, chain,
@@ -1520,7 +1516,6 @@ hammer2_inode_xop_unlinkall(hammer2_thread_t *thr, hammer2_xop_t *arg)
                /* depend on function to unlock the shared lock */
                chain = hammer2_chain_next(&parent, chain, &key_next,
                                           key_next, xop->key_end,
-                                          &cache_index,
                                           HAMMER2_LOOKUP_ALWAYS);
        }
 done:
@@ -1544,7 +1539,6 @@ hammer2_inode_xop_connect(hammer2_thread_t *thr, hammer2_xop_t *arg)
        hammer2_chain_t *chain;
        hammer2_pfs_t *pmp;
        hammer2_key_t key_dummy;
-       int cache_index = -1;
        int error;
 
        /*
@@ -1561,7 +1555,7 @@ hammer2_inode_xop_connect(hammer2_thread_t *thr, hammer2_xop_t *arg)
        }
        chain = hammer2_chain_lookup(&parent, &key_dummy,
                                     xop->lhc, xop->lhc,
-                                    &cache_index, 0);
+                                    0);
        if (chain) {
                hammer2_chain_unlock(chain);
                hammer2_chain_drop(chain);
@@ -1648,13 +1642,11 @@ hammer2_inode_xop_chain_sync(hammer2_thread_t *thr, hammer2_xop_t *arg)
                 */
                hammer2_key_t lbase;
                hammer2_key_t key_next;
-               int cache_index = -1;
 
                lbase = (xop->meta.size + HAMMER2_PBUFMASK64) &
                        ~HAMMER2_PBUFMASK64;
                chain = hammer2_chain_lookup(&parent, &key_next,
                                             lbase, HAMMER2_KEY_MAX,
-                                            &cache_index,
                                             HAMMER2_LOOKUP_NODATA |
                                             HAMMER2_LOOKUP_NODIRECT);
                while (chain) {
@@ -1674,7 +1666,6 @@ hammer2_inode_xop_chain_sync(hammer2_thread_t *thr, hammer2_xop_t *arg)
                        }
                        chain = hammer2_chain_next(&parent, chain, &key_next,
                                                   key_next, HAMMER2_KEY_MAX,
-                                                  &cache_index,
                                                   HAMMER2_LOOKUP_NODATA |
                                                   HAMMER2_LOOKUP_NODIRECT);
                }
index 95f4802..0957eff 100644 (file)
@@ -294,7 +294,6 @@ hammer2_update_spans(hammer2_dev_t *hmp, kdmsg_state_t *state)
        hammer2_key_t key_next;
        kdmsg_msg_t *rmsg;
        size_t name_len;
-       int cache_index = -1;
 
        /*
         * Lookup mount point under the media-localized super-root.
@@ -311,7 +310,6 @@ hammer2_update_spans(hammer2_dev_t *hmp, kdmsg_state_t *state)
                goto done;
        chain = hammer2_chain_lookup(&parent, &key_next,
                                     HAMMER2_KEY_MIN, HAMMER2_KEY_MAX,
-                                    &cache_index,
                                     0);
        while (chain) {
                if (chain->bref.type != HAMMER2_BREF_TYPE_INODE)
@@ -338,7 +336,6 @@ hammer2_update_spans(hammer2_dev_t *hmp, kdmsg_state_t *state)
 
                chain = hammer2_chain_next(&parent, chain, &key_next,
                                               key_next, HAMMER2_KEY_MAX,
-                                              &cache_index,
                                               0);
        }
        hammer2_inode_unlock(spmp->iroot);
index 4225e66..dbd2f69 100644 (file)
@@ -404,7 +404,6 @@ hammer2_ioctl_pfs_get(hammer2_inode_t *ip, void *data)
        hammer2_chain_t *chain;
        hammer2_key_t key_next;
        hammer2_key_t save_key;
-       int cache_index = -1;
        int error;
 
        hmp = ip->pmp->pfs_hmps[0];
@@ -431,7 +430,6 @@ hammer2_ioctl_pfs_get(hammer2_inode_t *ip, void *data)
                                            HAMMER2_RESOLVE_SHARED);
                chain = hammer2_chain_lookup(&parent, &key_next,
                                            pfs->name_key, HAMMER2_KEY_MAX,
-                                           &cache_index,
                                            HAMMER2_LOOKUP_SHARED);
        }
 
@@ -449,7 +447,6 @@ hammer2_ioctl_pfs_get(hammer2_inode_t *ip, void *data)
                }
                chain = hammer2_chain_next(&parent, chain, &key_next,
                                            key_next, HAMMER2_KEY_MAX,
-                                           &cache_index,
                                            HAMMER2_LOOKUP_SHARED);
        }
 
@@ -476,7 +473,6 @@ hammer2_ioctl_pfs_get(hammer2_inode_t *ip, void *data)
                } else {
                        chain = hammer2_chain_next(&parent, chain, &key_next,
                                                    key_next, HAMMER2_KEY_MAX,
-                                                   &cache_index,
                                                    HAMMER2_LOOKUP_SHARED);
                        if (chain)
                                pfs->name_next = chain->bref.key;
@@ -521,7 +517,6 @@ hammer2_ioctl_pfs_lookup(hammer2_inode_t *ip, void *data)
        hammer2_chain_t *chain;
        hammer2_key_t key_next;
        hammer2_key_t lhc;
-       int cache_index = -1;
        int error;
        size_t len;
 
@@ -543,7 +538,6 @@ hammer2_ioctl_pfs_lookup(hammer2_inode_t *ip, void *data)
 
        chain = hammer2_chain_lookup(&parent, &key_next,
                                         lhc, lhc + HAMMER2_DIRHASH_LOMASK,
-                                        &cache_index,
                                         HAMMER2_LOOKUP_SHARED);
        while (chain) {
                if (hammer2_chain_dirent_test(chain, pfs->name, len))
@@ -551,7 +545,6 @@ hammer2_ioctl_pfs_lookup(hammer2_inode_t *ip, void *data)
                chain = hammer2_chain_next(&parent, chain, &key_next,
                                           key_next,
                                           lhc + HAMMER2_DIRHASH_LOMASK,
-                                          &cache_index,
                                           HAMMER2_LOOKUP_SHARED);
        }
 
index d0a9e30..45a2404 100644 (file)
@@ -292,7 +292,6 @@ hammer2_strategy_xop_read(hammer2_thread_t *thr, hammer2_xop_t *arg)
        hammer2_key_t lbase;
        struct bio *bio;
        struct buf *bp;
-       int cache_index = -1;
        int error;
 
        /*
@@ -320,7 +319,6 @@ hammer2_strategy_xop_read(hammer2_thread_t *thr, hammer2_xop_t *arg)
        if (parent) {
                chain = hammer2_chain_lookup(&parent, &key_dummy,
                                             lbase, lbase,
-                                            &cache_index,
                                             HAMMER2_LOOKUP_ALWAYS |
                                             HAMMER2_LOOKUP_SHARED);
                error = chain ? chain->error : 0;
@@ -692,7 +690,6 @@ hammer2_assign_physical(hammer2_inode_t *ip, hammer2_chain_t **parentp,
        hammer2_key_t key_dummy;
        hammer2_off_t dedup_off;
        int pradix = hammer2_getradix(pblksize);
-       int cache_index = -1;
 
        /*
         * Locate the chain associated with lbase, return a locked chain.
@@ -705,7 +702,6 @@ hammer2_assign_physical(hammer2_inode_t *ip, hammer2_chain_t **parentp,
 retry:
        chain = hammer2_chain_lookup(parentp, &key_dummy,
                                     lbase, lbase,
-                                    &cache_index,
                                     HAMMER2_LOOKUP_NODATA);
 
        /*
@@ -1232,12 +1228,10 @@ zero_write(char *data, hammer2_inode_t *ip,
 {
        hammer2_chain_t *chain;
        hammer2_key_t key_dummy;
-       int cache_index = -1;
 
        *errorp = 0;
        chain = hammer2_chain_lookup(parentp, &key_dummy,
                                     lbase, lbase,
-                                    &cache_index,
                                     HAMMER2_LOOKUP_NODATA);
        if (chain) {
                if (chain->bref.type == HAMMER2_BREF_TYPE_INODE) {
index 384be9f..0a9b5ed 100644 (file)
@@ -358,7 +358,6 @@ hammer2_sync_slaves(hammer2_thread_t *thr, hammer2_inode_t *ip,
        hammer2_pfs_t *pmp;
        hammer2_key_t key_next;
        hammer2_tid_t sync_tid;
-       int cache_index = -1;
        int needrescan;
        int want_update;
        int error;
@@ -452,7 +451,6 @@ hammer2_sync_slaves(hammer2_thread_t *thr, hammer2_inode_t *ip,
 
        chain = hammer2_chain_lookup(&parent, &key_next,
                                     HAMMER2_KEY_MIN, HAMMER2_KEY_MAX,
-                                    &cache_index,
                                     HAMMER2_LOOKUP_SHARED |
                                     HAMMER2_LOOKUP_NODIRECT |
                                     HAMMER2_LOOKUP_NODATA);
@@ -625,7 +623,6 @@ hammer2_sync_slaves(hammer2_thread_t *thr, hammer2_inode_t *ip,
                if (advance_local) {
                        chain = hammer2_chain_next(&parent, chain, &key_next,
                                                   key_next, HAMMER2_KEY_MAX,
-                                                  &cache_index,
                                                   HAMMER2_LOOKUP_SHARED |
                                                   HAMMER2_LOOKUP_NODIRECT |
                                                   HAMMER2_LOOKUP_NODATA);
@@ -712,7 +709,6 @@ hammer2_sync_insert(hammer2_thread_t *thr,
 {
        hammer2_chain_t *chain;
        hammer2_key_t dummy;
-       int cache_index = -1;
 
 #if HAMMER2_SYNCHRO_DEBUG
        if (hammer2_debug & 1)
@@ -743,7 +739,6 @@ hammer2_sync_insert(hammer2_thread_t *thr,
         */
        chain = hammer2_chain_lookup(parentp, &dummy,
                                     focus->bref.key, focus->bref.key,
-                                    &cache_index,
                                     HAMMER2_LOOKUP_NODIRECT |
                                     HAMMER2_LOOKUP_ALWAYS);
        KKASSERT(chain == NULL);
@@ -836,7 +831,6 @@ hammer2_sync_destroy(hammer2_thread_t *thr,
        hammer2_chain_t *chain;
        hammer2_key_t key_next;
        hammer2_key_t save_key;
-       int cache_index = -1;
 
        chain = *chainp;
 
@@ -872,7 +866,6 @@ hammer2_sync_destroy(hammer2_thread_t *thr,
                                     HAMMER2_RESOLVE_ALWAYS);
        *chainp = hammer2_chain_lookup(parentp, &key_next,
                                     save_key, HAMMER2_KEY_MAX,
-                                    &cache_index,
                                     HAMMER2_LOOKUP_SHARED |
                                     HAMMER2_LOOKUP_NODIRECT |
                                     HAMMER2_LOOKUP_NODATA);
index 74b70a2..61ac8de 100644 (file)
@@ -877,7 +877,6 @@ hammer2_vfs_mount(struct mount *mp, char *path, caddr_t data,
        char *label;
        int ronly = 1;
        int error;
-       int cache_index;
        int i;
 
        hmp = NULL;
@@ -885,7 +884,6 @@ hammer2_vfs_mount(struct mount *mp, char *path, caddr_t data,
        dev = NULL;
        label = NULL;
        devvp = NULL;
-       cache_index = -1;
 
        kprintf("hammer2_mount\n");
 
@@ -1191,7 +1189,7 @@ hammer2_vfs_mount(struct mount *mp, char *path, caddr_t data,
                parent = hammer2_chain_lookup_init(&hmp->vchain, 0);
                schain = hammer2_chain_lookup(&parent, &key_dummy,
                                      HAMMER2_SROOT_KEY, HAMMER2_SROOT_KEY,
-                                     &cache_index, 0);
+                                     0);
                hammer2_chain_lookup_done(parent);
                if (schain == NULL) {
                        kprintf("hammer2_mount: invalid super-root\n");
@@ -1300,7 +1298,7 @@ hammer2_vfs_mount(struct mount *mp, char *path, caddr_t data,
        lhc = hammer2_dirhash(label, strlen(label));
        chain = hammer2_chain_lookup(&parent, &key_next,
                                     lhc, lhc + HAMMER2_DIRHASH_LOMASK,
-                                    &cache_index, 0);
+                                    0);
        while (chain) {
                if (chain->bref.type == HAMMER2_BREF_TYPE_INODE &&
                    strcmp(label, chain->data->ipdata.filename) == 0) {
@@ -1309,7 +1307,7 @@ hammer2_vfs_mount(struct mount *mp, char *path, caddr_t data,
                chain = hammer2_chain_next(&parent, chain, &key_next,
                                            key_next,
                                            lhc + HAMMER2_DIRHASH_LOMASK,
-                                           &cache_index, 0);
+                                           0);
        }
        if (parent) {
                hammer2_chain_unlock(parent);
@@ -1431,7 +1429,6 @@ hammer2_update_pmps(hammer2_dev_t *hmp)
        hammer2_pfs_t *spmp;
        hammer2_pfs_t *pmp;
        hammer2_key_t key_next;
-       int cache_index = -1;
 
        /*
         * Force local mount (disassociate all PFSs from their clusters).
@@ -1450,7 +1447,7 @@ hammer2_update_pmps(hammer2_dev_t *hmp)
        parent = hammer2_inode_chain(spmp->iroot, 0, HAMMER2_RESOLVE_ALWAYS);
        chain = hammer2_chain_lookup(&parent, &key_next,
                                         HAMMER2_KEY_MIN, HAMMER2_KEY_MAX,
-                                        &cache_index, 0);
+                                        0);
        while (chain) {
                if (chain->bref.type != HAMMER2_BREF_TYPE_INODE)
                        continue;
@@ -1462,7 +1459,7 @@ hammer2_update_pmps(hammer2_dev_t *hmp)
                                       bref.modify_tid, force_local);
                chain = hammer2_chain_next(&parent, chain, &key_next,
                                           key_next, HAMMER2_KEY_MAX,
-                                          &cache_index, 0);
+                                          0);
        }
        if (parent) {
                hammer2_chain_unlock(parent);
@@ -2068,7 +2065,6 @@ hammer2_recovery_scan(hammer2_dev_t *hmp, hammer2_chain_t *parent,
        const hammer2_inode_data_t *ripdata;
        hammer2_chain_t *chain;
        hammer2_blockref_t bref;
-       int cache_index;
        int tmp_error;
        int rup_error;
        int error;
@@ -2149,7 +2145,6 @@ hammer2_recovery_scan(hammer2_dev_t *hmp, hammer2_chain_t *parent,
         * rup_error    Cumulative error for recursion
         * tmp_error    Specific non-cumulative recursion error
         */
-       cache_index = 0;
        chain = NULL;
        first = 1;
        rup_error = 0;
@@ -2157,7 +2152,7 @@ hammer2_recovery_scan(hammer2_dev_t *hmp, hammer2_chain_t *parent,
 
        for (;;) {
                error |= hammer2_chain_scan(parent, &chain, &bref,
-                                           &first, &cache_index,
+                                           &first,
                                            HAMMER2_LOOKUP_NODATA);
 
                /*
index 692b878..46deedd 100644 (file)
@@ -73,7 +73,6 @@ checkdirempty(hammer2_chain_t *oparent, hammer2_chain_t *ochain, int clindex)
        hammer2_chain_t *chain;
        hammer2_key_t key_next;
        hammer2_key_t inum;
-       int cache_index = -1;
        int error;
 
        error = 0;
@@ -113,7 +112,7 @@ checkdirempty(hammer2_chain_t *oparent, hammer2_chain_t *ochain, int clindex)
                chain = hammer2_chain_lookup(&parent, &key_next,
                                             HAMMER2_DIRHASH_VISIBLE,
                                             HAMMER2_KEY_MAX,
-                                            &cache_index, 0);
+                                            0);
        }
        if (chain) {
                error = ENOTEMPTY;
@@ -166,7 +165,6 @@ hammer2_xop_readdir(hammer2_thread_t *thr, hammer2_xop_t *arg)
        hammer2_chain_t *chain;
        hammer2_key_t key_next;
        hammer2_key_t lkey;
-       int cache_index = -1;
        int error = 0;
 
        lkey = xop->lkey;
@@ -190,11 +188,10 @@ hammer2_xop_readdir(hammer2_thread_t *thr, hammer2_xop_t *arg)
         * lock so do not unlock it on the iteration.
         */
        chain = hammer2_chain_lookup(&parent, &key_next, lkey, lkey,
-                                    &cache_index, HAMMER2_LOOKUP_SHARED);
+                                    HAMMER2_LOOKUP_SHARED);
        if (chain == NULL) {
                chain = hammer2_chain_lookup(&parent, &key_next,
                                             lkey, HAMMER2_KEY_MAX,
-                                            &cache_index,
                                             HAMMER2_LOOKUP_SHARED);
        }
        while (chain) {
@@ -203,7 +200,6 @@ hammer2_xop_readdir(hammer2_thread_t *thr, hammer2_xop_t *arg)
                        break;
                chain = hammer2_chain_next(&parent, chain, &key_next,
                                           key_next, HAMMER2_KEY_MAX,
-                                          &cache_index,
                                           HAMMER2_LOOKUP_SHARED);
        }
        if (chain) {
@@ -229,7 +225,6 @@ hammer2_xop_nresolve(hammer2_thread_t *thr, hammer2_xop_t *arg)
        size_t name_len;
        hammer2_key_t key_next;
        hammer2_key_t lhc;
-       int cache_index = -1;   /* XXX */
        int error;
 
        parent = hammer2_inode_chain(xop->head.ip1, thr->clindex,
@@ -250,7 +245,6 @@ hammer2_xop_nresolve(hammer2_thread_t *thr, hammer2_xop_t *arg)
        lhc = hammer2_dirhash(name, name_len);
        chain = hammer2_chain_lookup(&parent, &key_next,
                                     lhc, lhc + HAMMER2_DIRHASH_LOMASK,
-                                    &cache_index,
                                     HAMMER2_LOOKUP_ALWAYS |
                                     HAMMER2_LOOKUP_SHARED);
        while (chain) {
@@ -259,7 +253,6 @@ hammer2_xop_nresolve(hammer2_thread_t *thr, hammer2_xop_t *arg)
                chain = hammer2_chain_next(&parent, chain, &key_next,
                                           key_next,
                                           lhc + HAMMER2_DIRHASH_LOMASK,
-                                          &cache_index,
                                           HAMMER2_LOOKUP_ALWAYS |
                                           HAMMER2_LOOKUP_SHARED);
        }
@@ -314,7 +307,6 @@ hammer2_xop_unlink(hammer2_thread_t *thr, hammer2_xop_t *arg)
        size_t name_len;
        hammer2_key_t key_next;
        hammer2_key_t lhc;
-       int cache_index = -1;   /* XXX */
        int error;
 
 again:
@@ -338,7 +330,6 @@ again:
        lhc = hammer2_dirhash(name, name_len);
        chain = hammer2_chain_lookup(&parent, &key_next,
                                     lhc, lhc + HAMMER2_DIRHASH_LOMASK,
-                                    &cache_index,
                                     HAMMER2_LOOKUP_ALWAYS);
        while (chain) {
                if (hammer2_chain_dirent_test(chain, name, name_len))
@@ -346,7 +337,6 @@ again:
                chain = hammer2_chain_next(&parent, chain, &key_next,
                                           key_next,
                                           lhc + HAMMER2_DIRHASH_LOMASK,
-                                          &cache_index,
                                           HAMMER2_LOOKUP_ALWAYS);
        }
 
@@ -488,7 +478,6 @@ hammer2_xop_nrename(hammer2_thread_t *thr, hammer2_xop_t *arg)
        hammer2_chain_t *tmp;
        hammer2_inode_t *ip;
        hammer2_key_t key_next;
-       int cache_index = -1;
        int error;
 
        /*
@@ -542,7 +531,6 @@ hammer2_xop_nrename(hammer2_thread_t *thr, hammer2_xop_t *arg)
                lhc = hammer2_dirhash(name, name_len);
                chain = hammer2_chain_lookup(&parent, &key_next,
                                             lhc, lhc + HAMMER2_DIRHASH_LOMASK,
-                                            &cache_index,
                                             HAMMER2_LOOKUP_ALWAYS);
                while (chain) {
                        if (hammer2_chain_dirent_test(chain, name, name_len))
@@ -550,7 +538,6 @@ hammer2_xop_nrename(hammer2_thread_t *thr, hammer2_xop_t *arg)
                        chain = hammer2_chain_next(&parent, chain, &key_next,
                                                   key_next,
                                                   lhc + HAMMER2_DIRHASH_LOMASK,
-                                                  &cache_index,
                                                   HAMMER2_LOOKUP_ALWAYS);
                }
        }
@@ -659,7 +646,6 @@ hammer2_xop_nrename(hammer2_thread_t *thr, hammer2_xop_t *arg)
        tmp = hammer2_chain_lookup(&parent, &key_next,
                                   xop->lhc & ~HAMMER2_DIRHASH_LOMASK,
                                   xop->lhc | HAMMER2_DIRHASH_LOMASK,
-                                  &cache_index,
                                   HAMMER2_LOOKUP_ALWAYS);
        while (tmp) {
                if (hammer2_chain_dirent_test(tmp, xop->head.name2,
@@ -669,7 +655,6 @@ hammer2_xop_nrename(hammer2_thread_t *thr, hammer2_xop_t *arg)
                tmp = hammer2_chain_next(&parent, tmp, &key_next,
                                         key_next,
                                         xop->lhc | HAMMER2_DIRHASH_LOMASK,
-                                        &cache_index,
                                         HAMMER2_LOOKUP_ALWAYS);
        }
 
@@ -679,7 +664,7 @@ hammer2_xop_nrename(hammer2_thread_t *thr, hammer2_xop_t *arg)
         */
        tmp = hammer2_chain_lookup(&parent, &key_next,
                                   xop->lhc, xop->lhc,
-                                  &cache_index, 0);
+                                  0);
        KKASSERT(tmp == NULL);
        error = hammer2_chain_create(&parent, &chain,
                                     pmp, HAMMER2_METH_DEFAULT,
@@ -711,7 +696,6 @@ hammer2_xop_scanlhc(hammer2_thread_t *thr, hammer2_xop_t *arg)
        hammer2_chain_t *parent;
        hammer2_chain_t *chain;
        hammer2_key_t key_next;
-       int cache_index = -1;   /* XXX */
        int error = 0;
 
        parent = hammer2_inode_chain(xop->head.ip1, thr->clindex,
@@ -731,7 +715,6 @@ hammer2_xop_scanlhc(hammer2_thread_t *thr, hammer2_xop_t *arg)
        chain = hammer2_chain_lookup(&parent, &key_next,
                                     xop->lhc,
                                     xop->lhc + HAMMER2_DIRHASH_LOMASK,
-                                    &cache_index,
                                     HAMMER2_LOOKUP_ALWAYS |
                                     HAMMER2_LOOKUP_SHARED);
        while (chain) {
@@ -746,7 +729,6 @@ hammer2_xop_scanlhc(hammer2_thread_t *thr, hammer2_xop_t *arg)
                chain = hammer2_chain_next(&parent, chain, &key_next,
                                           key_next,
                                           xop->lhc + HAMMER2_DIRHASH_LOMASK,
-                                          &cache_index,
                                           HAMMER2_LOOKUP_ALWAYS |
                                           HAMMER2_LOOKUP_SHARED);
        }
@@ -770,7 +752,6 @@ hammer2_xop_lookup(hammer2_thread_t *thr, hammer2_xop_t *arg)
        hammer2_chain_t *parent;
        hammer2_chain_t *chain;
        hammer2_key_t key_next;
-       int cache_index = -1;   /* XXX */
        int error = 0;
 
        parent = hammer2_inode_chain(xop->head.ip1, thr->clindex,
@@ -788,7 +769,6 @@ hammer2_xop_lookup(hammer2_thread_t *thr, hammer2_xop_t *arg)
         */
        chain = hammer2_chain_lookup(&parent, &key_next,
                                     xop->lhc, xop->lhc,
-                                    &cache_index,
                                     HAMMER2_LOOKUP_ALWAYS |
                                     HAMMER2_LOOKUP_SHARED);
        if (chain)
@@ -822,7 +802,6 @@ hammer2_xop_scanall(hammer2_thread_t *thr, hammer2_xop_t *arg)
        hammer2_chain_t *parent;
        hammer2_chain_t *chain;
        hammer2_key_t key_next;
-       int cache_index = -1;
        int error = 0;
 
        /*
@@ -848,14 +827,14 @@ hammer2_xop_scanall(hammer2_thread_t *thr, hammer2_xop_t *arg)
         */
        chain = hammer2_chain_lookup(&parent, &key_next,
                                     xop->key_beg, xop->key_end,
-                                    &cache_index, xop->lookup_flags);
+                                    xop->lookup_flags);
        while (chain) {
                error = hammer2_xop_feed(&xop->head, chain, thr->clindex, 0);
                if (error)
                        break;
                chain = hammer2_chain_next(&parent, chain, &key_next,
                                           key_next, xop->key_end,
-                                          &cache_index, xop->lookup_flags);
+                                          xop->lookup_flags);
        }
        if (chain) {
                hammer2_chain_unlock(chain);