linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: [PATCH 1/3] btrfs-progs: scan /proc/partitions not all of /dev with "-d"
Date: Wed, 20 Aug 2014 17:22:13 -0500	[thread overview]
Message-ID: <53F51F95.8060400@redhat.com> (raw)
In-Reply-To: <53F51F4D.2090203@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>
---
diff --git a/cmds-device.c b/cmds-device.c
index b6772b9..519681a 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -224,7 +224,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 bf87bbe..0ad7e8f 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -614,7 +614,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;
@@ -638,7 +638,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
@@ -681,7 +681,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 */


  reply	other threads:[~2014-08-20 22:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20 22:21 [PATCH 0/3] btrfs-progs: remove full /dev scanning Eric Sandeen
2014-08-20 22:22 ` Eric Sandeen [this message]
2014-08-26  8:27   ` [PATCH 1/3] btrfs-progs: scan /proc/partitions not all of /dev with "-d" Anand Jain
2014-08-20 22:23 ` [PATCH 2/3] btrfs-progs: don't fall back to recursive /dev scan Eric Sandeen
2014-08-26  8:27   ` Anand Jain
2014-08-20 22:24 ` [PATCH 3/3] btrfs-progs: remove BTRFS_SCAN_DEV and btrfs_scan_one_dir Eric Sandeen
2014-08-26  8:29   ` Anand Jain
2014-08-21  8:44 ` [PATCH 0/3] btrfs-progs: remove full /dev scanning Anand Jain
2014-08-21 14:29   ` Eric Sandeen
2014-08-26  8:24     ` Anand Jain
2014-08-26 11:08     ` David Sterba
2014-08-21 18:08 ` Goffredo Baroncelli
2014-08-26 10:55   ` David Sterba
2014-08-26 14:51     ` Eric Sandeen
2014-08-26 14:53       ` Chris Mason
2014-08-26 22:56         ` Anand Jain
2014-08-26  9:52 ` Anand Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53F51F95.8060400@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).