summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2014-08-20 17:22:13 -0500
committerDavid Sterba <dsterba@suse.cz>2014-10-10 09:32:11 +0200
commit4e85e481887abba8141ff43597c09b5f91d70ee4 (patch)
tree87ba73c818ff1749fcc403474bf96c7c7b0bbd81
parent6420192e870cedb3f43dac2095ce9fd7729a63e3 (diff)
btrfs-progs: scan /proc/partitions not all of /dev with "-d"
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>
-rw-r--r--cmds-device.c2
-rw-r--r--cmds-filesystem.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/cmds-device.c b/cmds-device.c
index 0475bf6b..b6470243 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -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:
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 0301442f..1638f0bf 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -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 */