diff options
author | Anand Jain <anand.jain@oracle.com> | 2013-07-15 13:30:50 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2013-08-09 14:32:36 +0200 |
commit | 5333445574adf8415ce3b7e8b13cf8feeb39b836 (patch) | |
tree | 824ba45bb8bb56b341e8c40be7b9eb7f71cf497a /utils.c | |
parent | 8f7c5897e96607ef0b47ecbc2f0d3cb4df2b8c07 (diff) |
btrfs-progs: congregate dev scan
the dev scan to find btrfs is performed at two locations
all most the same way one at filesystem show and another
at device scan. They both follow the same steps. This
patch does not alter anything except that it brings these
two same logic into the function scan_for_btrfs so that
we can play tweaking it.
the patch which recommends to use /dev/mapper
will also need it
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -1135,9 +1135,9 @@ int btrfs_scan_for_fsid(int run_ioctls) { int ret; - ret = btrfs_scan_block_devices(run_ioctls); + ret = scan_for_btrfs(BTRFS_SCAN_PROC, run_ioctls); if (ret) - ret = btrfs_scan_one_dir("/dev", run_ioctls); + ret = scan_for_btrfs(BTRFS_SCAN_DEV, run_ioctls); return ret; } @@ -1835,3 +1835,21 @@ int test_dev_for_mkfs(char *file, int force_overwrite, char *estr) close(fd); return 0; } + +/* + * scans devs for the btrfs +*/ +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_DEV: + ret = btrfs_scan_one_dir("/dev", update_kernel); + break; + } + return ret; +} |