mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2024-12-04 17:44:43 +08:00
btrfs-progs: remove BTRFS_SCAN_PROC scan method
The libblkid scan method which was introduced later, will also scan devices under /proc/partitions. So we don't have to do the explicit scan of the same. Remove the scan method BTRFS_SCAN_PROC. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
This commit is contained in:
parent
0d84aa903a
commit
5444864e56
@ -199,13 +199,13 @@ static int cmd_rm_dev(int argc, char **argv)
|
||||
static const char * const cmd_scan_dev_usage[] = {
|
||||
"btrfs device scan [(-d|--all-devices)|<device> [<device>...]]",
|
||||
"Scan devices for a btrfs filesystem",
|
||||
" -d|--all-devices (deprecated)",
|
||||
NULL
|
||||
};
|
||||
|
||||
static int cmd_scan_dev(int argc, char **argv)
|
||||
{
|
||||
int i, fd, e;
|
||||
int where = BTRFS_SCAN_LBLKID;
|
||||
int devstart = 1;
|
||||
int all = 0;
|
||||
int ret = 0;
|
||||
@ -223,7 +223,6 @@ static int cmd_scan_dev(int argc, char **argv)
|
||||
break;
|
||||
switch (c) {
|
||||
case 'd':
|
||||
where = BTRFS_SCAN_PROC;
|
||||
all = 1;
|
||||
break;
|
||||
default:
|
||||
@ -236,7 +235,7 @@ static int cmd_scan_dev(int argc, char **argv)
|
||||
|
||||
if (all || argc == 1) {
|
||||
printf("Scanning for Btrfs filesystems\n");
|
||||
ret = scan_for_btrfs(where, BTRFS_UPDATE_KERNEL);
|
||||
ret = btrfs_scan_lblkid(BTRFS_UPDATE_KERNEL);
|
||||
if (ret)
|
||||
fprintf(stderr, "ERROR: error %d while scanning\n", ret);
|
||||
goto out;
|
||||
|
@ -547,7 +547,8 @@ static int cmd_show(int argc, char **argv)
|
||||
struct list_head *cur_uuid;
|
||||
char *search = NULL;
|
||||
int ret;
|
||||
int where = BTRFS_SCAN_LBLKID;
|
||||
/* default, search both kernel and udev */
|
||||
int where = -1;
|
||||
int type = 0;
|
||||
char mp[BTRFS_PATH_NAME_MAX + 1];
|
||||
char path[PATH_MAX];
|
||||
@ -568,7 +569,7 @@ static int cmd_show(int argc, char **argv)
|
||||
break;
|
||||
switch (c) {
|
||||
case 'd':
|
||||
where = BTRFS_SCAN_PROC;
|
||||
where = BTRFS_SCAN_LBLKID;
|
||||
break;
|
||||
case 'm':
|
||||
where = BTRFS_SCAN_MOUNTED;
|
||||
@ -592,7 +593,7 @@ static int cmd_show(int argc, char **argv)
|
||||
* right away
|
||||
*/
|
||||
if (type == BTRFS_ARG_BLKDEV) {
|
||||
if (where == BTRFS_SCAN_PROC) {
|
||||
if (where == BTRFS_SCAN_LBLKID) {
|
||||
/* we need to do this because
|
||||
* legacy BTRFS_SCAN_DEV
|
||||
* provides /dev/dm-x paths
|
||||
@ -623,7 +624,7 @@ static int cmd_show(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (where == BTRFS_SCAN_PROC)
|
||||
if (where == BTRFS_SCAN_LBLKID)
|
||||
goto devs_only;
|
||||
|
||||
/* show mounted btrfs */
|
||||
@ -638,7 +639,7 @@ static int cmd_show(int argc, char **argv)
|
||||
goto out;
|
||||
|
||||
devs_only:
|
||||
ret = scan_for_btrfs(where, !BTRFS_UPDATE_KERNEL);
|
||||
ret = btrfs_scan_lblkid(!BTRFS_UPDATE_KERNEL);
|
||||
|
||||
if (ret) {
|
||||
fprintf(stderr, "ERROR: %d while scanning\n", ret);
|
||||
|
@ -1002,7 +1002,7 @@ int btrfs_scan_fs_devices(int fd, const char *path,
|
||||
}
|
||||
|
||||
if (total_devs != 1) {
|
||||
ret = scan_for_btrfs(BTRFS_SCAN_PROC, run_ioctl);
|
||||
ret = btrfs_scan_lblkid(run_ioctl);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
6
utils.c
6
utils.c
@ -1186,7 +1186,8 @@ int check_mounted_where(int fd, const char *file, char *where, int size,
|
||||
|
||||
/* scan other devices */
|
||||
if (is_btrfs && total_devs > 1) {
|
||||
if ((ret = scan_for_btrfs(BTRFS_SCAN_PROC, !BTRFS_UPDATE_KERNEL)))
|
||||
ret = btrfs_scan_lblkid(!BTRFS_UPDATE_KERNEL);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2158,9 +2159,6 @@ int scan_for_btrfs(int where, int update_kernel)
|
||||
int ret = 0;
|
||||
|
||||
switch (where) {
|
||||
case BTRFS_SCAN_PROC:
|
||||
ret = btrfs_scan_block_devices(update_kernel);
|
||||
break;
|
||||
case BTRFS_SCAN_LBLKID:
|
||||
ret = btrfs_scan_lblkid(update_kernel);
|
||||
break;
|
||||
|
5
utils.h
5
utils.h
@ -26,9 +26,8 @@
|
||||
#define BTRFS_MKFS_SYSTEM_GROUP_SIZE (4 * 1024 * 1024)
|
||||
#define BTRFS_MKFS_SMALL_VOLUME_SIZE (1024 * 1024 * 1024)
|
||||
|
||||
#define BTRFS_SCAN_PROC (1ULL << 0)
|
||||
#define BTRFS_SCAN_MOUNTED (1ULL << 1)
|
||||
#define BTRFS_SCAN_LBLKID (1ULL << 2)
|
||||
#define BTRFS_SCAN_MOUNTED (1ULL << 0)
|
||||
#define BTRFS_SCAN_LBLKID (1ULL << 1)
|
||||
|
||||
#define BTRFS_UPDATE_KERNEL 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user