From 37003d3627369162e05f95e8b3b244a012a46589 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Fri, 26 Apr 2013 16:06:06 -0500 Subject: Btrfs-progs: remove some dead/unbuilt code Remove some commented-out & #if 0'd code: * close_blocks() * btrfs_drop_snapshot() * btrfs_realloc_node() * btrfs_find_dead_roots() There are still some #if 0'd functions in there, but I'm hedging on those for now, they have been copied to cmds-check.c and I want to see if they can be brough back into ctree.c eventually. Signed-off-by: Eric Sandeen Signed-off-by: David Sterba Signed-off-by: Chris Mason --- ctree.c | 140 ---------------------------------------------------------------- 1 file changed, 140 deletions(-) (limited to 'ctree.c') diff --git a/ctree.c b/ctree.c index d491cdd1..81db06df 100644 --- a/ctree.c +++ b/ctree.c @@ -372,17 +372,6 @@ int btrfs_cow_block(struct btrfs_trans_handle *trans, return ret; } -/* -static int close_blocks(u64 blocknr, u64 other, u32 blocksize) -{ - if (blocknr < other && other - (blocknr + blocksize) < 32768) - return 1; - if (blocknr > other && blocknr - (other + blocksize) < 32768) - return 1; - return 0; -} -*/ - /* * compare two keys in a memcmp fashion */ @@ -407,135 +396,6 @@ int btrfs_comp_keys(struct btrfs_disk_key *disk, struct btrfs_key *k2) return 0; } - -#if 0 -int btrfs_realloc_node(struct btrfs_trans_handle *trans, - struct btrfs_root *root, struct extent_buffer *parent, - int start_slot, int cache_only, u64 *last_ret, - struct btrfs_key *progress) -{ - struct extent_buffer *cur; - struct extent_buffer *tmp; - u64 blocknr; - u64 gen; - u64 search_start = *last_ret; - u64 last_block = 0; - u64 other; - u32 parent_nritems; - int end_slot; - int i; - int err = 0; - int parent_level; - int uptodate; - u32 blocksize; - int progress_passed = 0; - struct btrfs_disk_key disk_key; - - parent_level = btrfs_header_level(parent); - if (cache_only && parent_level != 1) - return 0; - - if (trans->transaction != root->fs_info->running_transaction) { - printk(KERN_CRIT "trans %Lu running %Lu\n", trans->transid, - root->fs_info->running_transaction->transid); - WARN_ON(1); - } - if (trans->transid != root->fs_info->generation) { - printk(KERN_CRIT "trans %Lu running %Lu\n", trans->transid, - root->fs_info->generation); - WARN_ON(1); - } - - parent_nritems = btrfs_header_nritems(parent); - blocksize = btrfs_level_size(root, parent_level - 1); - end_slot = parent_nritems; - - if (parent_nritems == 1) - return 0; - - for (i = start_slot; i < end_slot; i++) { - int close = 1; - - if (!parent->map_token) { - map_extent_buffer(parent, - btrfs_node_key_ptr_offset(i), - sizeof(struct btrfs_key_ptr), - &parent->map_token, &parent->kaddr, - &parent->map_start, &parent->map_len, - KM_USER1); - } - btrfs_node_key(parent, &disk_key, i); - if (!progress_passed && comp_keys(&disk_key, progress) < 0) - continue; - - progress_passed = 1; - blocknr = btrfs_node_blockptr(parent, i); - gen = btrfs_node_ptr_generation(parent, i); - if (last_block == 0) - last_block = blocknr; - - if (i > 0) { - other = btrfs_node_blockptr(parent, i - 1); - close = close_blocks(blocknr, other, blocksize); - } - if (close && i < end_slot - 2) { - other = btrfs_node_blockptr(parent, i + 1); - close = close_blocks(blocknr, other, blocksize); - } - if (close) { - last_block = blocknr; - continue; - } - if (parent->map_token) { - unmap_extent_buffer(parent, parent->map_token, - KM_USER1); - parent->map_token = NULL; - } - - cur = btrfs_find_tree_block(root, blocknr, blocksize); - if (cur) - uptodate = btrfs_buffer_uptodate(cur, gen); - else - uptodate = 0; - if (!cur || !uptodate) { - if (cache_only) { - free_extent_buffer(cur); - continue; - } - if (!cur) { - cur = read_tree_block(root, blocknr, - blocksize, gen); - } else if (!uptodate) { - btrfs_read_buffer(cur, gen); - } - } - if (search_start == 0) - search_start = last_block; - - err = __btrfs_cow_block(trans, root, cur, parent, i, - &tmp, search_start, - min(16 * blocksize, - (end_slot - i) * blocksize)); - if (err) { - free_extent_buffer(cur); - break; - } - search_start = tmp->start; - last_block = tmp->start; - *last_ret = search_start; - if (parent_level == 1) - btrfs_clear_buffer_defrag(tmp); - free_extent_buffer(tmp); - } - if (parent->map_token) { - unmap_extent_buffer(parent, parent->map_token, - KM_USER1); - parent->map_token = NULL; - } - return err; -} -#endif - /* * The leaf data grows from end-to-front in the node. * this returns the address of the start of the last item, -- cgit v1.2.3