From 6345bbd5b4f41cd5f4bf090b9f17e6c9c9afcf62 Mon Sep 17 00:00:00 2001 From: Anand Jain Date: Wed, 15 Oct 2014 08:45:11 +0800 Subject: [PATCH] btrfs-progs: mkfs should be consistent in calling register device When we have one device we don't call register device. (in fact not mandatory, but to make it consistent) And when we have more than one we call register device. reproducer: Nothing in the kernel device list cat /proc/fs/btrfs/devlist | egrep fsid | wc -l 0 mkfs.btrfs will automatically call register device when devices is more than 1. mkfs.btrfs -f /dev/sdb /dev/sdc cat /proc/fs/btrfs/devlist | egrep fsid | wc -l 1 But it does not when there is only one device mkfs.btrfs -f /dev/sdb cat /proc/fs/btrfs/devlist | egrep fsid | wc -l 0 Signed-off-by: Anand Jain Signed-off-by: David Sterba --- mkfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkfs.c b/mkfs.c index 9de61e19..e10e62d2 100644 --- a/mkfs.c +++ b/mkfs.c @@ -1588,11 +1588,11 @@ int main(int ac, char **av) trans = btrfs_start_transaction(root, 1); + btrfs_register_one_device(file); + if (dev_cnt == 0) goto raid_groups; - btrfs_register_one_device(file); - while (dev_cnt-- > 0) { int old_mixed = mixed;