From fff523953a2956b4aa6e283d6a847a5eb588f56b Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Thu, 13 Sep 2012 20:19:46 +0200
Subject: [PATCH] kernel/hammer: Remove some unused variables.

---
 sys/vfs/hammer/hammer_blockmap.c |    2 --
 sys/vfs/hammer/hammer_btree.c    |   35 -----------------------------------
 sys/vfs/hammer/hammer_cursor.c   |    2 --
 sys/vfs/hammer/hammer_inode.c    |    2 --
 sys/vfs/hammer/hammer_io.c       |    2 --
 sys/vfs/hammer/hammer_object.c   |    4 ----
 sys/vfs/hammer/hammer_pfs.c      |    4 +---
 sys/vfs/hammer/hammer_reblock.c  |   10 ----------
 8 files changed, 1 insertions(+), 60 deletions(-)

diff --git a/sys/vfs/hammer/hammer_blockmap.c b/sys/vfs/hammer/hammer_blockmap.c
index 0dd146c..b8fb76e 100644
--- a/sys/vfs/hammer/hammer_blockmap.c
+++ b/sys/vfs/hammer/hammer_blockmap.c
@@ -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;
@@ -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];
diff --git a/sys/vfs/hammer/hammer_btree.c b/sys/vfs/hammer/hammer_btree.c
index e59ad9d..7f91c65 100644
--- a/sys/vfs/hammer/hammer_btree.c
+++ b/sys/vfs/hammer/hammer_btree.c
@@ -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;
@@ -1604,20 +1603,6 @@ btree_split_internal(hammer_cursor_t cursor)
 	}
 
 	/*
-	 * 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.
 	 *
 	 *  B O O O P N N B	<-- P = node->elms[split] (index 4)
@@ -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;
@@ -1872,25 +1856,6 @@ btree_split_leaf(hammer_cursor_t cursor)
 	}
 
 	/*
-	 * 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
 	 * leaf since comparisons use an 'elm >= separator' inequality.
diff --git a/sys/vfs/hammer/hammer_cursor.c b/sys/vfs/hammer/hammer_cursor.c
index eb6c573..106dde6 100644
--- a/sys/vfs/hammer/hammer_cursor.c
+++ b/sys/vfs/hammer/hammer_cursor.c
@@ -801,12 +801,10 @@ int
 hammer_recover_cursor(hammer_cursor_t cursor)
 {
 	hammer_transaction_t trans;
-	hammer_inode_t ip;
 	int error;
 
 	hammer_unlock_cursor(cursor);
 
-	ip = cursor->ip;
 	trans = cursor->trans;
 	KKASSERT(trans->sync_lock_refs > 0);
 
diff --git a/sys/vfs/hammer/hammer_inode.c b/sys/vfs/hammer/hammer_inode.c
index b3c9a8a..764eed0 100644
--- a/sys/vfs/hammer/hammer_inode.c
+++ b/sys/vfs/hammer/hammer_inode.c
@@ -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?
diff --git a/sys/vfs/hammer/hammer_io.c b/sys/vfs/hammer/hammer_io.c
index db1d149..ddc5429 100644
--- a/sys/vfs/hammer/hammer_io.c
+++ b/sys/vfs/hammer/hammer_io.c
@@ -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);
diff --git a/sys/vfs/hammer/hammer_object.c b/sys/vfs/hammer/hammer_object.c
index 20dd41b..1c37333 100644
--- a/sys/vfs/hammer/hammer_object.c
+++ b/sys/vfs/hammer/hammer_object.c
@@ -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;
diff --git a/sys/vfs/hammer/hammer_pfs.c b/sys/vfs/hammer/hammer_pfs.c
index 182da0b..33ebbb1 100644
--- a/sys/vfs/hammer/hammer_pfs.c
+++ b/sys/vfs/hammer/hammer_pfs.c
@@ -448,15 +448,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(
diff --git a/sys/vfs/hammer/hammer_reblock.c b/sys/vfs/hammer/hammer_reblock.c
index 0498ace..65d987a 100644
--- a/sys/vfs/hammer/hammer_reblock.c
+++ b/sys/vfs/hammer/hammer_reblock.c
@@ -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)
-- 
1.7.7.2

