linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] btrfs-progs: mkfs should be consistent in calling register device
@ 2014-10-15  0:45 Anand Jain
  0 siblings, 0 replies; only message in thread
From: Anand Jain @ 2014-10-15  0:45 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba, clm

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 <anand.jain@oracle.com>
---
 mkfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mkfs.c b/mkfs.c
index 9de61e1..e10e62d 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;
 
-- 
2.0.0.153.g79dcccc


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-10-15  8:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-15  0:45 [PATCH 1/1] btrfs-progs: mkfs should be consistent in calling register device Anand Jain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).