use node list for roots

This commit is contained in:
Chris Mason 2007-04-25 10:08:15 -04:00 committed by David Woodhouse
parent 0b3c55b251
commit c2d777735c
1 changed files with 5 additions and 6 deletions

View File

@ -167,7 +167,6 @@ static int add_pending(struct radix_tree_root *pending,
set_radix_bit(seen, blocknr); set_radix_bit(seen, blocknr);
return 0; return 0;
} }
static int pick_next_pending(struct radix_tree_root *pending, static int pick_next_pending(struct radix_tree_root *pending,
struct radix_tree_root *reada, struct radix_tree_root *reada,
struct radix_tree_root *nodes, struct radix_tree_root *nodes,
@ -176,7 +175,7 @@ static int pick_next_pending(struct radix_tree_root *pending,
unsigned long node_start = last; unsigned long node_start = last;
int ret; int ret;
ret = find_first_radix_bit(reada, bits, 0, 1); ret = find_first_radix_bit(reada, bits, 0, 1);
if (ret) if (ret && ret > 16)
return ret; return ret;
if (node_start > 8) if (node_start > 8)
node_start -= 8; node_start -= 8;
@ -187,7 +186,6 @@ static int pick_next_pending(struct radix_tree_root *pending,
return ret; return ret;
return find_first_radix_bit(pending, bits, 0, bits_nr); return find_first_radix_bit(pending, bits, 0, bits_nr);
} }
static struct btrfs_buffer reada_buf; static struct btrfs_buffer reada_buf;
static int run_next_block(struct btrfs_root *root, static int run_next_block(struct btrfs_root *root,
@ -208,7 +206,6 @@ static int run_next_block(struct btrfs_root *root,
struct btrfs_leaf *leaf; struct btrfs_leaf *leaf;
struct btrfs_node *node; struct btrfs_node *node;
u64 last_block = 0; u64 last_block = 0;
ret = pick_next_pending(pending, reada, nodes, *last, bits, bits_nr); ret = pick_next_pending(pending, reada, nodes, *last, bits, bits_nr);
if (ret == 0) { if (ret == 0) {
return 1; return 1;
@ -223,7 +220,6 @@ static int run_next_block(struct btrfs_root *root,
last_block = bits[i]; last_block = bits[i];
readahead(reada_buf.fd, offset, root->blocksize); readahead(reada_buf.fd, offset, root->blocksize);
} }
*last = bits[0]; *last = bits[0];
blocknr = bits[0]; blocknr = bits[0];
clear_radix_bit(pending, blocknr); clear_radix_bit(pending, blocknr);
@ -301,6 +297,9 @@ static int add_root_to_pending(struct btrfs_buffer *buf,
struct radix_tree_root *reada, struct radix_tree_root *reada,
struct radix_tree_root *nodes) struct radix_tree_root *nodes)
{ {
if (btrfs_header_level(&buf->node.header) > 0)
add_pending(nodes, seen, buf->blocknr);
else
add_pending(pending, seen, buf->blocknr); add_pending(pending, seen, buf->blocknr);
add_extent_rec(extent_radix, NULL, 0, buf->blocknr, 1, add_extent_rec(extent_radix, NULL, 0, buf->blocknr, 1,
btrfs_header_owner(&buf->node.header), 0, 1); btrfs_header_owner(&buf->node.header), 0, 1);