btrfs-progs: scan /proc/partitions not all of /dev with "-d"
authorEric Sandeen <sandeen@redhat.com>
Wed, 20 Aug 2014 22:22:13 +0000 (17:22 -0500)
committerDavid Sterba <dsterba@suse.cz>
Fri, 10 Oct 2014 07:32:11 +0000 (09:32 +0200)
We can scan for btrfs devices in a few ways.  By default
libblkid is used for "device scan" and "filesystem show";
with the -m option only mounted filesystems are scanned,
and with -d we physically read every system device.

But there's no reason for the complexity of a descent through
/dev; /proc/partitions has every device known to the kernel, so
just use that when -d is specified.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
cmds-device.c
cmds-filesystem.c

index 0475bf6..b647024 100644 (file)
@@ -223,7 +223,7 @@ static int cmd_scan_dev(int argc, char **argv)
                        break;
                switch (c) {
                case 'd':
-                       where = BTRFS_SCAN_DEV;
+                       where = BTRFS_SCAN_PROC;
                        all = 1;
                        break;
                default:
index 0301442..1638f0b 100644 (file)
@@ -568,7 +568,7 @@ static int cmd_show(int argc, char **argv)
                        break;
                switch (c) {
                case 'd':
-                       where = BTRFS_SCAN_DEV;
+                       where = BTRFS_SCAN_PROC;
                        break;
                case 'm':
                        where = BTRFS_SCAN_MOUNTED;
@@ -592,7 +592,7 @@ static int cmd_show(int argc, char **argv)
                 * right away
                 */
                if (type == BTRFS_ARG_BLKDEV) {
-                       if (where == BTRFS_SCAN_DEV) {
+                       if (where == BTRFS_SCAN_PROC) {
                                /* we need to do this because
                                 * legacy BTRFS_SCAN_DEV
                                 * provides /dev/dm-x paths
@@ -623,7 +623,7 @@ static int cmd_show(int argc, char **argv)
                }
        }
 
-       if (where == BTRFS_SCAN_DEV)
+       if (where == BTRFS_SCAN_PROC)
                goto devs_only;
 
        /* show mounted btrfs */