kernel/hammer: Remove unused variables and add __debugvar.
authorSascha Wildner <saw@online.de>
Mon, 7 Jan 2013 08:48:18 +0000 (09:48 +0100)
committerSascha Wildner <saw@online.de>
Mon, 7 Jan 2013 08:49:39 +0000 (09:49 +0100)
13 files changed:
sys/vfs/hammer/hammer_blockmap.c
sys/vfs/hammer/hammer_btree.c
sys/vfs/hammer/hammer_cursor.c
sys/vfs/hammer/hammer_inode.c
sys/vfs/hammer/hammer_io.c
sys/vfs/hammer/hammer_mirror.c
sys/vfs/hammer/hammer_object.c
sys/vfs/hammer/hammer_pfs.c
sys/vfs/hammer/hammer_rebalance.c
sys/vfs/hammer/hammer_reblock.c
sys/vfs/hammer/hammer_transaction.c
sys/vfs/hammer/hammer_undo.c
sys/vfs/hammer/hammer_vnops.c

index b00d2ad..2049e1b 100644 (file)
@@ -1076,7 +1076,6 @@ hammer_blockmap_dedup(hammer_transaction_t trans,
                     hammer_off_t zone_offset, int bytes)
 {
        hammer_mount_t hmp;
-       hammer_volume_t root_volume;
        hammer_blockmap_t freemap;
        struct hammer_blockmap_layer1 *layer1;
        struct hammer_blockmap_layer2 *layer2;
@@ -1086,7 +1085,7 @@ hammer_blockmap_dedup(hammer_transaction_t trans,
        hammer_off_t layer2_offset;
        int32_t temp;
        int error;
-       int zone;
+       int zone __debugvar;
 
        if (bytes == 0)
                return (0);
@@ -1105,7 +1104,6 @@ hammer_blockmap_dedup(hammer_transaction_t trans,
         */
        zone = HAMMER_ZONE_DECODE(zone_offset);
        KKASSERT(zone >= HAMMER_ZONE_BTREE_INDEX && zone < HAMMER_MAX_ZONES);
-       root_volume = trans->rootvol;
        error = 0;
 
        freemap = &hmp->blockmap[HAMMER_ZONE_FREEMAP_INDEX];
@@ -1415,7 +1413,7 @@ hammer_blockmap_lookup(hammer_mount_t hmp, hammer_off_t zone_offset,
        hammer_off_t layer2_offset;
        hammer_off_t result_offset;
        hammer_off_t base_off;
-       hammer_reserve_t resv;
+       hammer_reserve_t resv __debugvar;
        int zone;
 
        /*
index e59ad9d..6165ae5 100644 (file)
@@ -934,7 +934,7 @@ hammer_btree_delete(hammer_cursor_t cursor)
 {
        hammer_node_ondisk_t ondisk;
        hammer_node_t node;
-       hammer_node_t parent;
+       hammer_node_t parent __debugvar;
        int error;
        int i;
 
@@ -1530,7 +1530,6 @@ btree_split_internal(hammer_cursor_t cursor)
        hammer_btree_elm_t parent_elm;
        struct hammer_node_lock lockroot;
        hammer_mount_t hmp = cursor->trans->hmp;
-       hammer_off_t hint;
        int parent_index;
        int made_root;
        int split;
@@ -1603,20 +1602,6 @@ btree_split_internal(hammer_cursor_t cursor)
                parent_index = cursor->parent_index;
        }
 
-       /*
-        * Calculate a hint for the allocation of the new B-Tree node.
-        * The most likely expansion is coming from the insertion point
-        * at cursor->index, so try to localize the allocation of our
-        * new node to accomodate that sub-tree.
-        *
-        * Use the right-most sub-tree when expandinging on the right edge.
-        * This is a very common case when copying a directory tree.
-        */
-       if (cursor->index == ondisk->count)
-               hint = ondisk->elms[cursor->index - 1].internal.subtree_offset;
-       else
-               hint = ondisk->elms[cursor->index].internal.subtree_offset;
-
        /*
         * Split node into new_node at the split point.
         *
@@ -1784,7 +1769,6 @@ btree_split_leaf(hammer_cursor_t cursor)
        hammer_btree_elm_t elm;
        hammer_btree_elm_t parent_elm;
        hammer_base_elm_t mid_boundary;
-       hammer_off_t hint;
        int parent_index;
        int made_root;
        int split;
@@ -1871,25 +1855,6 @@ btree_split_leaf(hammer_cursor_t cursor)
                parent_index = cursor->parent_index;
        }
 
-       /*
-        * Calculate a hint for the allocation of the new B-Tree leaf node.
-        * For now just try to localize it within the same bigblock as
-        * the current leaf.
-        *
-        * If the insertion point is at the end of the leaf we recognize a
-        * likely append sequence of some sort (data, meta-data, inodes,
-        * whatever).  Set the hint to zero to allocate out of linear space
-        * instead of trying to completely fill previously hinted space.
-        *
-        * This also sets the stage for recursive splits to localize using
-        * the new space.
-        */
-       ondisk = leaf->ondisk;
-       if (cursor->index == ondisk->count)
-               hint = 0;
-       else
-               hint = leaf->node_offset;
-
        /*
         * Split leaf into new_leaf at the split point.  Select a separator
         * value in-between the two leafs but with a bent towards the right
@@ -2459,7 +2424,7 @@ hammer_btree_do_propagation(hammer_cursor_t cursor,
 {
        hammer_cursor_t ncursor;
        hammer_tid_t mirror_tid;
-       int error;
+       int error __debugvar;
 
        /*
         * We do not propagate a mirror_tid if the filesystem was mounted
index eb6c573..c71ff8f 100644 (file)
@@ -800,13 +800,17 @@ hammer_lock_cursor(hammer_cursor_t cursor)
 int
 hammer_recover_cursor(hammer_cursor_t cursor)
 {
-       hammer_transaction_t trans;
+       hammer_transaction_t trans __debugvar;
+#if 0
        hammer_inode_t ip;
+#endif
        int error;
 
        hammer_unlock_cursor(cursor);
 
+#if 0
        ip = cursor->ip;
+#endif
        trans = cursor->trans;
        KKASSERT(trans->sync_lock_refs > 0);
 
index b3c9a8a..764eed0 100644 (file)
@@ -1877,13 +1877,11 @@ static int
 hammer_setup_parent_inodes_helper(hammer_record_t record, int depth,
                                  hammer_flush_group_t flg)
 {
-       hammer_mount_t hmp;
        hammer_inode_t pip;
        int good;
 
        KKASSERT(record->flush_state != HAMMER_FST_IDLE);
        pip = record->ip;
-       hmp = pip->hmp;
 
        /*
         * If the record is already flushing, is it in our flush group?
index db1d149..ddc5429 100644 (file)
@@ -1915,7 +1915,6 @@ static int
 hammer_io_direct_uncache_callback(hammer_inode_t ip, void *data)
 {
        hammer_inode_info_t iinfo = data;
-       hammer_off_t data_offset;
        hammer_off_t file_offset;
        struct vnode *vp;
        struct buf *bp;
@@ -1923,7 +1922,6 @@ hammer_io_direct_uncache_callback(hammer_inode_t ip, void *data)
 
        if (ip->vp == NULL)
                return(0);
-       data_offset = iinfo->u.leaf->data_offset;
        file_offset = iinfo->u.leaf->base.key - iinfo->u.leaf->data_len;
        blksize = iinfo->u.leaf->data_len;
        KKASSERT((blksize & HAMMER_BUFMASK) == 0);
index e797f19..c99850a 100644 (file)
@@ -30,8 +30,6 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
- * $DragonFly: src/sys/vfs/hammer/hammer_mirror.c,v 1.17 2008/07/31 22:30:33 dillon Exp $
  */
 /*
  * HAMMER mirroring ioctls - serialize and deserialize modifications made
@@ -578,13 +576,8 @@ hammer_ioc_mirror_write_rec(hammer_cursor_t cursor,
                            u_int32_t localization,
                            char *uptr)
 {
-       hammer_transaction_t trans;
-       u_int32_t rec_crc;
        int error;
 
-       trans = cursor->trans;
-       rec_crc = crc32(mrec, sizeof(*mrec));
-
        if (mrec->leaf.data_len < 0 || 
            mrec->leaf.data_len > HAMMER_XBUFSIZE ||
            mrec->leaf.data_len + sizeof(*mrec) > mrec->head.rec_size) {
@@ -670,13 +663,8 @@ hammer_ioc_mirror_write_pass(hammer_cursor_t cursor,
                             struct hammer_ioc_mirror_rw *mirror,
                             u_int32_t localization)
 {
-       hammer_transaction_t trans;
-       u_int32_t rec_crc;
        int error;
 
-       trans = cursor->trans;
-       rec_crc = crc32(mrec, sizeof(*mrec));
-
        /*
         * Re-localize for target.  Relocalization of data is handled
         * by hammer_mirror_write().
index 20dd41b..af83c28 100644 (file)
@@ -1036,7 +1036,7 @@ void
 hammer_ip_replace_bulk(hammer_mount_t hmp, hammer_record_t record)
 {
        hammer_record_t conflict;
-       int error;
+       int error __debugvar;
 
        while ((conflict = hammer_ip_get_bulk(record)) != NULL) {
                if ((conflict->flags & HAMMER_RECF_INTERLOCK_BE) == 0) {
@@ -1521,7 +1521,7 @@ _hammer_ip_reseek(hammer_cursor_t cursor)
 {
        struct hammer_base_elm save;
        hammer_btree_elm_t elm;
-       int error;
+       int error __debugvar;
        int r;
        int again = 0;
 
@@ -2148,7 +2148,7 @@ int
 hammer_ip_delete_clean(hammer_cursor_t cursor, hammer_inode_t ip, int *countp)
 {
        hammer_transaction_t trans = cursor->trans;
-       hammer_btree_leaf_elm_t leaf;
+       hammer_btree_leaf_elm_t leaf __debugvar;
        int error;
 
        KKASSERT(trans->type == HAMMER_TRANS_FLS);
@@ -2227,12 +2227,10 @@ hammer_ip_delete_record(hammer_cursor_t cursor, hammer_inode_t ip,
                        hammer_tid_t tid)
 {
        hammer_record_t iprec;
-       hammer_mount_t hmp;
        int error;
 
        KKASSERT(cursor->flags & HAMMER_CURSOR_BACKEND);
        KKASSERT(tid != 0);
-       hmp = cursor->node->hmp;
 
        /*
         * In-memory (unsynchronized) records can simply be freed.  This
@@ -2459,7 +2457,6 @@ hammer_delete_at_cursor(hammer_cursor_t cursor, int delete_flags,
        hammer_btree_elm_t elm;
        hammer_off_t data_offset;
        int32_t data_len;
-       u_int16_t rec_type;
        int error;
        int icount;
        int doprop;
@@ -2538,7 +2535,6 @@ hammer_delete_at_cursor(hammer_cursor_t cursor, int delete_flags,
        if (delete_flags & HAMMER_DELETE_DESTROY) {
                data_offset = elm->leaf.data_offset;
                data_len = elm->leaf.data_len;
-               rec_type = elm->leaf.base.rec_type;
                if (doprop) {
                        save_leaf = elm->leaf;
                        leaf = &save_leaf;
index 182da0b..ba60e1d 100644 (file)
@@ -30,8 +30,6 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
- * $DragonFly: src/sys/vfs/hammer/hammer_pfs.c,v 1.5 2008/07/31 04:42:04 dillon Exp $
  */
 /*
  * HAMMER PFS ioctls - Manage pseudo-fs configurations
@@ -448,15 +446,13 @@ int
 hammer_pfs_delete_at_cursor(hammer_cursor_t cursor, hammer_tid_t trunc_tid)
 {
        hammer_btree_leaf_elm_t elm;
-       hammer_transaction_t trans;
-        int error;
+       int error;
 
        elm = &cursor->node->ondisk->elms[cursor->index].leaf;
        if (elm->base.create_tid < trunc_tid &&
            elm->base.delete_tid < trunc_tid) {
                return(0);
        }
-        trans = cursor->trans;
 
        if (elm->base.create_tid >= trunc_tid) {
                error = hammer_delete_at_cursor(
index 8fcc347..1f27eb1 100644 (file)
@@ -254,7 +254,7 @@ rebalance_node(struct hammer_ioc_rebalance *rebal, hammer_cursor_t cursor,
        hammer_btree_elm_t elm;
        hammer_node_t node;
        hammer_tid_t tid;
-       u_int8_t type1;
+       u_int8_t type1 __debugvar;
        int base_count;
        int root_count;
        int avg_elms;
index 0498ace..65d987a 100644 (file)
@@ -531,7 +531,6 @@ hammer_reblock_int_node(struct hammer_ioc_reblock *reblock,
        struct hammer_node_lock lockroot;
        hammer_node_t onode;
        hammer_node_t nnode;
-       hammer_off_t hint;
        int error;
        int i;
 
@@ -540,16 +539,7 @@ hammer_reblock_int_node(struct hammer_ioc_reblock *reblock,
        if (error)
                goto done;
 
-       /*
-        * The internal node is visited after recursing through its
-        * first element.  Use the subtree offset allocated for that
-        * element as a hint for allocating the internal node.
-        */
        onode = cursor->node;
-       if (onode->ondisk->count)
-               hint = onode->ondisk->elms[0].internal.subtree_offset;
-       else
-               hint = 0;
        nnode = hammer_alloc_btree(cursor->trans, 0, &error);
 
        if (nnode == NULL)
index d59e285..7f262b6 100644 (file)
@@ -30,8 +30,6 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
- * $DragonFly: src/sys/vfs/hammer/hammer_transaction.c,v 1.25 2008/09/23 21:03:52 dillon Exp $
  */
 
 #include "hammer.h"
@@ -118,7 +116,7 @@ hammer_start_transaction_fls(struct hammer_transaction *trans,
 void
 hammer_done_transaction(struct hammer_transaction *trans)
 {
-       int expected_lock_refs;
+       int expected_lock_refs __debugvar;
 
        hammer_rel_volume(trans->rootvol, 0);
        trans->rootvol = NULL;
index e7320cc..7497d3d 100644 (file)
@@ -30,8 +30,6 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
- * $DragonFly: src/sys/vfs/hammer/hammer_undo.c,v 1.20 2008/07/18 00:19:53 dillon Exp $
  */
 
 /*
@@ -52,7 +50,7 @@ hammer_off_t
 hammer_undo_lookup(hammer_mount_t hmp, hammer_off_t zone3_off, int *errorp)
 {
        hammer_volume_t root_volume;
-       hammer_blockmap_t undomap;
+       hammer_blockmap_t undomap __debugvar;
        hammer_off_t result_offset;
        int i;
 
@@ -62,7 +60,7 @@ hammer_undo_lookup(hammer_mount_t hmp, hammer_off_t zone3_off, int *errorp)
                return(0);
        undomap = &hmp->blockmap[HAMMER_ZONE_UNDO_INDEX];
        KKASSERT(HAMMER_ZONE_DECODE(undomap->alloc_offset) == HAMMER_ZONE_UNDO_INDEX);
-       KKASSERT (zone3_off < undomap->alloc_offset);
+       KKASSERT(zone3_off < undomap->alloc_offset);
 
        i = (zone3_off & HAMMER_OFF_SHORT_MASK) / HAMMER_LARGEBLOCK_SIZE;
        result_offset = root_volume->ondisk->vol0_undo_array[i] +
@@ -434,7 +432,7 @@ int
 hammer_enter_undo_history(hammer_mount_t hmp, hammer_off_t offset, int bytes)
 {
        hammer_undo_t node;
-       hammer_undo_t onode;
+       hammer_undo_t onode __debugvar;
 
        node = RB_LOOKUP(hammer_und_rb_tree, &hmp->rb_undo_root, offset);
        if (node) {
@@ -480,7 +478,7 @@ hammer_undo_used(hammer_transaction_t trans)
 {
        hammer_blockmap_t cundomap;
        hammer_blockmap_t dundomap;
-       int64_t max_bytes;
+       int64_t max_bytes __debugvar;
        int64_t bytes;
 
        cundomap = &trans->hmp->blockmap[HAMMER_ZONE_UNDO_INDEX];
index 3781748..f402dca 100644 (file)
@@ -30,8 +30,6 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
- * $DragonFly: src/sys/vfs/hammer/hammer_vnops.c,v 1.102 2008/10/16 17:24:16 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -3298,7 +3296,7 @@ hammer_vop_strategy_write(struct vop_strategy_args *ap)
        hammer_inode_t ip;
        struct bio *bio;
        struct buf *bp;
-       int blksize;
+       int blksize __debugvar;
        int bytes;
        int error;