diff mbox

[2/3] btrfs-progs: don't fall back to recursive /dev scan

Message ID 53F51FD8.4020800@redhat.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Eric Sandeen Aug. 20, 2014, 10:23 p.m. UTC
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>
---


--
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

Comments

Anand Jain Aug. 26, 2014, 8:27 a.m. UTC | #1
Reviewed-by: Anand Jain <anand.jain@oracle.com>


On 21/08/2014 06:23, Eric Sandeen wrote:
> 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)
>   {
>
> --
> 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
>
--
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
diff mbox

Patch

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)
 {