On Mon, Jan 22, 2018 at 02:49:36PM -0800, Anand Jain wrote: > By maintaining the device order consistency it makes reproducing > the problems related to missing chunk in the degraded mode much more > consistent. So fix this by sorting the devices by devid within the > kernel. So that we know which device is assigned to the struct > fs_info::latest_bdev when all the devices are having and same > SB generation. > > Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx> > --- > fs/btrfs/volumes.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c > index 03f2685a5018..98e41d286283 100644 > --- a/fs/btrfs/volumes.c > +++ b/fs/btrfs/volumes.c > @@ -27,6 +27,7 @@ > #include <linux/raid/pq.h> > #include <linux/semaphore.h> > #include <linux/uuid.h> > +#include <linux/list_sort.h> > #include <asm/div64.h> > #include "ctree.h" > #include "extent_map.h" > @@ -1107,6 +1108,20 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices, > return ret; > } > > +static int device_sort(void *priv, struct list_head *a, struct list_head *b) I'll rename that to devid_cmp as it's the comparator and not really a sorting function. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
