Skip to content

Commit

Permalink
Properly call btrfs_search_slot while shrinking
Browse files Browse the repository at this point in the history
The shrinking code used btrfs_next_leaf to find the next item, but
this does not cow the blocks it touches.  This fix calls search_slot after
finding the next item to do appropriate cow and balancing.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Chris Mason committed Sep 25, 2008
1 parent 2552488 commit 1372f8e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -2434,7 +2434,15 @@ int btrfs_shrink_extent_tree(struct btrfs_root *root, u64 new_size)
break;
}
leaf = path->nodes[0];
nritems = btrfs_header_nritems(leaf);
btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);

/*
* btrfs_next_leaf doesn't cow buffers, we have to
* do the search again
*/
memcpy(&key, &found_key, sizeof(key));
btrfs_release_path(root, path);
continue;
}

btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
Expand Down

0 comments on commit 1372f8e

Please sign in to comment.