btrfs-progs: mkfs: output device list in sorted order
authorZhao Lei <zhaolei@cn.fujitsu.com>
Tue, 3 Nov 2015 11:03:00 +0000 (19:03 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Nov 2015 11:56:52 +0000 (12:56 +0100)
commit568a3743f52d82b044e4a9f0d27170eba361e7bc
tree08deb4483280d6a7bd0b94fb4439c507cf30b47a
parentc5cb2432bfea5a657495d511bcbfd38dcb8cba41
btrfs-progs: mkfs: output device list in sorted order

list_for_each_entry_reverse() in current code can not output
devices in sorted order, because the sequence are broken in
btrfs_alloc_chunk().

We can use list_sort() instead.

Before patch:
 # mkfs.btrfs -f /dev/vdd /dev/vde /dev/vdf
 ...
 Number of devices:  3
 Devices:
    ID        SIZE  PATH
     3     2.60GiB  /dev/vdf
     1     2.60GiB  /dev/vdd
     2     2.60GiB  /dev/vde

After patch:
 # mkfs.btrfs -f /dev/vdd /dev/vde /dev/vdf
 ...
 Number of devices:  3
 Devices:
    ID        SIZE  PATH
     1     2.60GiB  /dev/vdd
     2     2.60GiB  /dev/vde
     3     2.60GiB  /dev/vdf

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
mkfs.c