btrfsprogs/0167-Btrfs-use-proc-partitions-scanning-for-btrfs_scan_fo.patch

37 lines
1.0 KiB
Diff
Raw Normal View History

From 8ded348cf85fd8572d4ee7fc9d0cad150f4fc2be Mon Sep 17 00:00:00 2001
From: Chris Mason <chris.mason@oracle.com>
Date: Tue, 21 Feb 2012 15:33:20 -0500
Subject: [PATCH 16/18] Btrfs: use /proc/partitions scanning for
btrfs_scan_for_fsid
btrfs_scan_for_fsid is used by open_ctree and by mkfs when it is
checking for mounted devices. It currently scans all of /dev,
which is rarely the right answer.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
---
utils.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/utils.c b/utils.c
index cfb8fde..2d82342 100644
--- a/utils.c
+++ b/utils.c
@@ -1052,7 +1052,12 @@ fail:
int btrfs_scan_for_fsid(struct btrfs_fs_devices *fs_devices, u64 total_devs,
int run_ioctls)
{
- return btrfs_scan_one_dir("/dev", run_ioctls);
+ int ret;
+
+ ret = btrfs_scan_block_devices(run_ioctls);
+ if (ret)
+ ret = btrfs_scan_one_dir("/dev", run_ioctls);
+ return ret;
}
int btrfs_device_already_in_root(struct btrfs_root *root, int fd,
--
1.7.6.233.gd79bc