[PATCH] target/iblock: use se_dev_udev_path instead of ibd_udev_path

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

 



This is probably a leftover from a rework. According to the wiki
| echo iblock_major=254,iblock_minor=2 > $TARGET/iblock_0/lvm_test0/control

should be issued. However the code matches for udev_path and force.
Since we have already udev_path handling in target_core_configfs lets
use it. I remove the major/minor thingy since there is no evidence that
this is used.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
---
 drivers/target/target_core_iblock.c |   77 +++++------------------------------
 drivers/target/target_core_iblock.h |    3 -
 2 files changed, 10 insertions(+), 70 deletions(-)

diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 0c7f26e..4526cd3 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -137,13 +137,14 @@ static struct se_device *iblock_create_virtdevice(
 	}
 	pr_debug("IBLOCK: Created bio_set()\n");
 	/*
-	 * iblock_check_configfs_dev_params() ensures that ib_dev->ibd_udev_path
-	 * must already have been set in order for echo 1 > $HBA/$DEV/enable to run.
+	 * iblock_check_configfs_dev_params() ensures that
+	 * se_dev->se_dev_udev_path must already have been set in order for
+	 * echo 1 > $HBA/$DEV/enable to run.
 	 */
 	pr_debug( "IBLOCK: Claiming struct block_device: %s\n",
-			ib_dev->ibd_udev_path);
+			se_dev->se_dev_udev_path);
 
-	bd = blkdev_get_by_path(ib_dev->ibd_udev_path,
+	bd = blkdev_get_by_path(se_dev->se_dev_udev_path,
 				FMODE_WRITE|FMODE_READ|FMODE_EXCL, ib_dev);
 	if (IS_ERR(bd)) {
 		ret = PTR_ERR(bd);
@@ -366,79 +367,21 @@ static void iblock_free_task(struct se_task *task)
 	kfree(IBLOCK_REQ(task));
 }
 
-enum {
-	Opt_udev_path, Opt_force, Opt_err
-};
-
-static match_table_t tokens = {
-	{Opt_udev_path, "udev_path=%s"},
-	{Opt_force, "force=%d"},
-	{Opt_err, NULL}
-};
-
 static ssize_t iblock_set_configfs_dev_params(struct se_hba *hba,
 					       struct se_subsystem_dev *se_dev,
 					       const char *page, ssize_t count)
 {
-	struct iblock_dev *ib_dev = se_dev->se_dev_su_ptr;
-	char *orig, *ptr, *arg_p, *opts;
-	substring_t args[MAX_OPT_ARGS];
-	int ret = 0, token;
-
-	opts = kstrdup(page, GFP_KERNEL);
-	if (!opts)
-		return -ENOMEM;
-
-	orig = opts;
-
-	while ((ptr = strsep(&opts, ",\n")) != NULL) {
-		if (!*ptr)
-			continue;
-
-		token = match_token(ptr, tokens, args);
-		switch (token) {
-		case Opt_udev_path:
-			if (ib_dev->ibd_bd) {
-				pr_err("Unable to set udev_path= while"
-					" ib_dev->ibd_bd exists\n");
-				ret = -EEXIST;
-				goto out;
-			}
-			arg_p = match_strdup(&args[0]);
-			if (!arg_p) {
-				ret = -ENOMEM;
-				break;
-			}
-			snprintf(ib_dev->ibd_udev_path, SE_UDEV_PATH_LEN,
-					"%s", arg_p);
-			kfree(arg_p);
-			pr_debug("IBLOCK: Referencing UDEV path: %s\n",
-					ib_dev->ibd_udev_path);
-			ib_dev->ibd_flags |= IBDF_HAS_UDEV_PATH;
-			break;
-		case Opt_force:
-			break;
-		default:
-			break;
-		}
-	}
-
-out:
-	kfree(orig);
-	return (!ret) ? count : ret;
+	return -EINVAL;
 }
 
 static ssize_t iblock_check_configfs_dev_params(
 	struct se_hba *hba,
 	struct se_subsystem_dev *se_dev)
 {
-	struct iblock_dev *ibd = se_dev->se_dev_su_ptr;
-
-	if (!(ibd->ibd_flags & IBDF_HAS_UDEV_PATH)) {
-		pr_err("Missing udev_path= parameters for IBLOCK\n");
+	if (!(se_dev->su_dev_flags & SDF_USING_UDEV_PATH)) {
+		pr_err("udev_path attribute has not been set before ENABLE\n");
 		return -EINVAL;
 	}
-
 	return 0;
 }
 
@@ -455,9 +398,9 @@ static ssize_t iblock_show_configfs_dev_params(
 	if (bd)
 		bl += sprintf(b + bl, "iBlock device: %s",
 				bdevname(bd, buf));
-	if (ibd->ibd_flags & IBDF_HAS_UDEV_PATH) {
+	if (se_dev->su_dev_flags & SDF_USING_UDEV_PATH) {
 		bl += sprintf(b + bl, "  UDEV PATH: %s\n",
-				ibd->ibd_udev_path);
+				se_dev->se_dev_udev_path);
 	} else
 		bl += sprintf(b + bl, "\n");
 
diff --git a/drivers/target/target_core_iblock.h b/drivers/target/target_core_iblock.h
index 5cf1860..a385405 100644
--- a/drivers/target/target_core_iblock.h
+++ b/drivers/target/target_core_iblock.h
@@ -12,10 +12,7 @@ struct iblock_req {
 	atomic_t ib_bio_err_cnt;
 } ____cacheline_aligned;
 
-#define IBDF_HAS_UDEV_PATH		0x01
-
 struct iblock_dev {
-	unsigned char ibd_udev_path[SE_UDEV_PATH_LEN];
 	u32	ibd_flags;
 	struct bio_set	*ibd_bio_set;
 	struct block_device *ibd_bd;
-- 
1.7.7.1

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


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux