diff options
author | Yan Zheng <zheng.yan@oracle.com> | 2009-07-24 11:06:53 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-07-24 11:22:47 -0400 |
commit | 1fcbac581be375ca0a686f72ee2b7fd1dbf386e7 (patch) | |
tree | 64789d4143fdb02acd428ec928ed18239c95c37b /fs/btrfs | |
parent | 20736abaa361bea488df6a1f66f6b37fb01107b9 (diff) |
Btrfs: find_free_dev_extent doesn't handle holes at the start of the device
find_free_dev_extent does not properly handle the case where
the device is not complete free, and there is a free extent
at the beginning of the device.
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/volumes.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 55c37276a29f..074c1c56d8c4 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -758,9 +758,13 @@ static noinline int find_free_dev_extent(struct btrfs_trans_handle *trans, | |||
758 | ret = btrfs_search_slot(trans, root, &key, path, 0, 0); | 758 | ret = btrfs_search_slot(trans, root, &key, path, 0, 0); |
759 | if (ret < 0) | 759 | if (ret < 0) |
760 | goto error; | 760 | goto error; |
761 | ret = btrfs_previous_item(root, path, 0, key.type); | 761 | if (ret > 0) { |
762 | if (ret < 0) | 762 | ret = btrfs_previous_item(root, path, key.objectid, key.type); |
763 | goto error; | 763 | if (ret < 0) |
764 | goto error; | ||
765 | if (ret > 0) | ||
766 | start_found = 1; | ||
767 | } | ||
764 | l = path->nodes[0]; | 768 | l = path->nodes[0]; |
765 | btrfs_item_key_to_cpu(l, &key, path->slots[0]); | 769 | btrfs_item_key_to_cpu(l, &key, path->slots[0]); |
766 | while (1) { | 770 | while (1) { |