[PATCH 1/2] btrfs-progs: avoid duplicate checks on user provided devid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



kernel is already checking it (rightly), we don't need to check that in the user land.

Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
---
 cmds-replace.c | 27 ---------------------------
 1 file changed, 27 deletions(-)

diff --git a/cmds-replace.c b/cmds-replace.c
index 6ea7c61..0787ce3 100644
--- a/cmds-replace.c
+++ b/cmds-replace.c
@@ -118,7 +118,6 @@ static int cmd_start_replace(int argc, char **argv)
 	struct btrfs_ioctl_dev_replace_args start_args = {0};
 	struct btrfs_ioctl_dev_replace_args status_args = {0};
 	int ret;
-	int i;
 	int c;
 	int fdmnt = -1;
 	int fdsrcdev = -1;
@@ -214,33 +213,7 @@ static int cmd_start_replace(int argc, char **argv)
 	}
 
 	if (is_numerical(srcdev)) {
-		struct btrfs_ioctl_fs_info_args fi_args;
-		struct btrfs_ioctl_dev_info_args *di_args = NULL;
-
 		start_args.start.srcdevid = arg_strtou64(srcdev);
-
-		ret = get_fs_info(path, &fi_args, &di_args);
-		if (ret) {
-			fprintf(stderr, "ERROR: getting dev info for devstats failed: "
-					"%s\n", strerror(-ret));
-			free(di_args);
-			goto leave_with_error;
-		}
-		if (!fi_args.num_devices) {
-			fprintf(stderr, "ERROR: no devices found\n");
-			free(di_args);
-			goto leave_with_error;
-		}
-
-		for (i = 0; i < fi_args.num_devices; i++)
-			if (start_args.start.srcdevid == di_args[i].devid)
-				break;
-		free(di_args);
-		if (i == fi_args.num_devices) {
-			fprintf(stderr, "Error: '%s' is not a valid devid for filesystem '%s'\n",
-				srcdev, path);
-			goto leave_with_error;
-		}
 	} else {
 		fdsrcdev = open(srcdev, O_RDWR);
 		if (fdsrcdev < 0) {
-- 
2.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux