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 2/3] btrfs-progs: don't fall back to recursive /dev scan
Date: Wed, 20 Aug 2014 17:23:20 -0500	[thread overview]
Message-ID: <53F51FD8.4020800@redhat.com> (raw)
In-Reply-To: <53F51F4D.2090203@redhat.com>

If we didn't find what we are looking for in /proc/partitions,
we're not going to find it by scanning every node under /dev, either.

But that's just what btrfs_scan_for_fsid() does.

Remove that fallback; at that point btrfs_scan_for_fsid() just calls
scan_for_btrfs(), so remove the wrapper & call it directly.

Side note: so, these paths always use /proc/partitions, not libblkid.
Userspace-intiated scans default to libblkid.  I presume this is
part of the design, and intentional?  Anyway, not changing it now!

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/disk-io.c b/disk-io.c
index d10d647..077eb7e 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -1018,7 +1018,7 @@ int btrfs_scan_fs_devices(int fd, const char *path,
 	}
 
 	if (total_devs != 1) {
-		ret = btrfs_scan_for_fsid(run_ioctl);
+		ret = scan_for_btrfs(BTRFS_SCAN_PROC, run_ioctl);
 		if (ret)
 			return ret;
 	}
diff --git a/utils.c b/utils.c
index d61cbec..12ed7a2 100644
--- a/utils.c
+++ b/utils.c
@@ -1151,7 +1151,7 @@ int check_mounted_where(int fd, const char *file, char *where, int size,
 
 	/* scan other devices */
 	if (is_btrfs && total_devs > 1) {
-		if ((ret = btrfs_scan_for_fsid(!BTRFS_UPDATE_KERNEL)))
+		if ((ret = scan_for_btrfs(BTRFS_SCAN_PROC, !BTRFS_UPDATE_KERNEL)))
 			return ret;
 	}
 
@@ -1339,16 +1339,6 @@ fail:
 	return ret;
 }
 
-int btrfs_scan_for_fsid(int run_ioctls)
-{
-	int ret;
-
-	ret = scan_for_btrfs(BTRFS_SCAN_PROC, run_ioctls);
-	if (ret)
-		ret = scan_for_btrfs(BTRFS_SCAN_DEV, run_ioctls);
-	return ret;
-}
-
 int btrfs_device_already_in_root(struct btrfs_root *root, int fd,
 				 int super_offset)
 {


  parent reply	other threads:[~2014-08-20 22:23 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 ` [PATCH 1/3] btrfs-progs: scan /proc/partitions not all of /dev with "-d" Eric Sandeen
2014-08-26  8:27   ` Anand Jain
2014-08-20 22:23 ` Eric Sandeen [this message]
2014-08-26  8:27   ` [PATCH 2/3] btrfs-progs: don't fall back to recursive /dev scan 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=53F51FD8.4020800@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).