]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Btrfs: let allocation start from the right raid type
authorLiu Bo <bo.li.liu@oracle.com>
Thu, 27 Dec 2012 09:01:24 +0000 (09:01 +0000)
committerJosef Bacik <josef@toxicpanda.com>
Mon, 14 Jan 2013 18:52:52 +0000 (13:52 -0500)
This'd avoid us empty looping.

Say we have only one disk and the metadata raid type will be defaultly DUP,
and we do not need to start from index=0(RAID10) and get over two empty
loops to index=2(DUP).

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/extent-tree.c

index 61fefda74ff54b0a40cdab7141369f6e236df85d..aeba53191ece7285dedb5b4c4516a09473f9adb0 100644 (file)
@@ -5560,7 +5560,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
        int empty_cluster = 2 * 1024 * 1024;
        struct btrfs_space_info *space_info;
        int loop = 0;
-       int index = 0;
+       int index = __get_raid_index(data);
        int alloc_type = (data & BTRFS_BLOCK_GROUP_DATA) ?
                RESERVE_ALLOC_NO_ACCOUNT : RESERVE_ALLOC;
        bool found_uncached_bg = false;