Anand Jain
2014-Sep-13 01:21 UTC
[PATCH 1/5] btrfs-progs: scan /proc/partitions not all of /dev with "-d"
From: Eric Sandeen <sandeen@redhat.com>
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>
---
cmds-device.c | 2 +-
cmds-filesystem.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/cmds-device.c b/cmds-device.c
index d7af090..ad0bd35 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 d8b6938..818e05f 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -563,7 +563,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;
@@ -587,7 +587,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
@@ -618,7 +618,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 */
--
2.0.0.153.g79dcccc
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs"
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html