Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH 1/2] btrfs-progs: avoid duplicate checks on user provided devid
@ 2015-06-01  6:25 Anand Jain
  2015-06-01  6:25 ` [PATCH 2/2] btrfs-progs: use function is_block_device() instead Anand Jain
  2015-06-02 15:12 ` [PATCH 1/2] btrfs-progs: avoid duplicate checks on user provided devid David Sterba
  0 siblings, 2 replies; 7+ messages in thread
From: Anand Jain @ 2015-06-01  6:25 UTC (permalink / raw)
  To: linux-btrfs

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

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-06-05 15:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-01  6:25 [PATCH 1/2] btrfs-progs: avoid duplicate checks on user provided devid Anand Jain
2015-06-01  6:25 ` [PATCH 2/2] btrfs-progs: use function is_block_device() instead Anand Jain
2015-06-02 15:17   ` David Sterba
2015-06-02 15:12 ` [PATCH 1/2] btrfs-progs: avoid duplicate checks on user provided devid David Sterba
2015-06-03  7:49   ` Anand Jain
2015-06-04  3:09     ` Anand Jain
2015-06-05 15:36       ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox