* [PATCH v2 1/5] tcmu: Support emulate_write_cache
2017-05-30 18:31 [PATCH v2 0/5] TCMU Enable Reconfiguration Patches Bryant G. Ly
@ 2017-05-30 18:31 ` Bryant G. Ly
2017-05-30 18:31 ` [PATCH v2 2/5] tcmu: Add netlink for device reconfiguration Bryant G. Ly
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Bryant G. Ly @ 2017-05-30 18:31 UTC (permalink / raw)
To: nab, mchristi; +Cc: seroyer, linux-scsi, target-devel, Bryant G. Ly
This will enable the toggling of write_cache in tcmu through targetcli-fb
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Reviewed-By: Mike Christie <mchristi@redhat.com>
---
drivers/target/target_core_user.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index beb5f09..0c797cc 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1290,6 +1290,8 @@ static int tcmu_configure_device(struct se_device *dev)
/* Other attributes can be configured in userspace */
if (!dev->dev_attrib.hw_max_sectors)
dev->dev_attrib.hw_max_sectors = 128;
+ if (!dev->dev_attrib.emulate_write_cache)
+ dev->dev_attrib.emulate_write_cache = 0;
dev->dev_attrib.hw_queue_depth = 128;
/*
@@ -1546,6 +1548,32 @@ static ssize_t tcmu_cmd_time_out_store(struct config_item *item, const char *pag
}
CONFIGFS_ATTR(tcmu_, cmd_time_out);
+static ssize_t tcmu_emulate_write_cache_show(struct config_item *item,
+ char *page)
+{
+ struct se_dev_attrib *da = container_of(to_config_group(item),
+ struct se_dev_attrib, da_group);
+
+ return snprintf(page, PAGE_SIZE, "%i\n", da->emulate_write_cache);
+}
+
+static ssize_t tcmu_emulate_write_cache_store(struct config_item *item,
+ const char *page, size_t count)
+{
+ struct se_dev_attrib *da = container_of(to_config_group(item),
+ struct se_dev_attrib, da_group);
+ int val;
+ int ret;
+
+ ret = kstrtouint(page, 0, &val);
+ if (ret < 0)
+ return ret;
+
+ da->emulate_write_cache = val;
+ return count;
+}
+CONFIGFS_ATTR(tcmu_, emulate_write_cache);
+
static struct configfs_attribute **tcmu_attrs;
static struct target_backend_ops tcmu_ops = {
@@ -1682,6 +1710,8 @@ static int __init tcmu_module_init(void)
tcmu_attrs[i] = passthrough_attrib_attrs[i];
}
tcmu_attrs[i] = &tcmu_attr_cmd_time_out;
+ i++;
+ tcmu_attrs[i] = &tcmu_attr_emulate_write_cache;
tcmu_ops.tb_dev_attrib_attrs = tcmu_attrs;
ret = transport_backend_register(&tcmu_ops);
--
2.5.4 (Apple Git-61)
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 2/5] tcmu: Add netlink for device reconfiguration
2017-05-30 18:31 [PATCH v2 0/5] TCMU Enable Reconfiguration Patches Bryant G. Ly
2017-05-30 18:31 ` [PATCH v2 1/5] tcmu: Support emulate_write_cache Bryant G. Ly
@ 2017-05-30 18:31 ` Bryant G. Ly
2017-05-30 18:31 ` [PATCH v2 3/5] tcmu: Make dev_size configurable via userspace Bryant G. Ly
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Bryant G. Ly @ 2017-05-30 18:31 UTC (permalink / raw)
To: nab, mchristi; +Cc: seroyer, linux-scsi, target-devel, Bryant G. Ly
This gives tcmu the ability to handle events that can cause
reconfiguration, such as resize, path changes, write_cache, etc...
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Reviewed-By: Mike Christie <mchristi@redhat.com>
---
drivers/target/target_core_user.c | 12 ++++++++++++
include/uapi/linux/target_core_user.h | 1 +
2 files changed, 13 insertions(+)
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 0c797cc..ae91822 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1562,6 +1562,7 @@ static ssize_t tcmu_emulate_write_cache_store(struct config_item *item,
{
struct se_dev_attrib *da = container_of(to_config_group(item),
struct se_dev_attrib, da_group);
+ struct tcmu_dev *udev = TCMU_DEV(da->da_dev);
int val;
int ret;
@@ -1570,6 +1571,17 @@ static ssize_t tcmu_emulate_write_cache_store(struct config_item *item,
return ret;
da->emulate_write_cache = val;
+
+ /* Check if device has been configured before */
+ if (tcmu_dev_configured(udev)) {
+ ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
+ udev->uio_info.name,
+ udev->uio_info.uio_dev->minor);
+ if (ret) {
+ pr_err("Unable to reconfigure device\n");
+ return ret;
+ }
+ }
return count;
}
CONFIGFS_ATTR(tcmu_, emulate_write_cache);
diff --git a/include/uapi/linux/target_core_user.h b/include/uapi/linux/target_core_user.h
index af17b41..403a61f 100644
--- a/include/uapi/linux/target_core_user.h
+++ b/include/uapi/linux/target_core_user.h
@@ -130,6 +130,7 @@ enum tcmu_genl_cmd {
TCMU_CMD_UNSPEC,
TCMU_CMD_ADDED_DEVICE,
TCMU_CMD_REMOVED_DEVICE,
+ TCMU_CMD_RECONFIG_DEVICE,
__TCMU_CMD_MAX,
};
#define TCMU_CMD_MAX (__TCMU_CMD_MAX - 1)
--
2.5.4 (Apple Git-61)
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 3/5] tcmu: Make dev_size configurable via userspace
2017-05-30 18:31 [PATCH v2 0/5] TCMU Enable Reconfiguration Patches Bryant G. Ly
2017-05-30 18:31 ` [PATCH v2 1/5] tcmu: Support emulate_write_cache Bryant G. Ly
2017-05-30 18:31 ` [PATCH v2 2/5] tcmu: Add netlink for device reconfiguration Bryant G. Ly
@ 2017-05-30 18:31 ` Bryant G. Ly
2017-05-30 18:31 ` [PATCH v2 4/5] tcmu: Make dev_config configurable Bryant G. Ly
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Bryant G. Ly @ 2017-05-30 18:31 UTC (permalink / raw)
To: nab, mchristi; +Cc: seroyer, linux-scsi, target-devel, Bryant G. Ly
Allow tcmu backstores to be able to set the device size
after it has been configured via set attribute.
Part of support in userspace to support certain backstores
changing device size.
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
---
drivers/target/target_core_user.c | 59 +++++++++++++++++++++++++++++++++++----
1 file changed, 54 insertions(+), 5 deletions(-)
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index ae91822..c8c84b7 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1548,6 +1548,44 @@ static ssize_t tcmu_cmd_time_out_store(struct config_item *item, const char *pag
}
CONFIGFS_ATTR(tcmu_, cmd_time_out);
+static ssize_t tcmu_dev_size_show(struct config_item *item, char *page)
+{
+ struct se_dev_attrib *da = container_of(to_config_group(item),
+ struct se_dev_attrib, da_group);
+ struct tcmu_dev *udev = TCMU_DEV(da->da_dev);
+
+ return snprintf(page, PAGE_SIZE, "%zu\n", udev->dev_size);
+}
+
+static ssize_t tcmu_dev_size_store(struct config_item *item, const char *page,
+ size_t count)
+{
+ struct se_dev_attrib *da = container_of(to_config_group(item),
+ struct se_dev_attrib, da_group);
+ struct tcmu_dev *udev = TCMU_DEV(da->da_dev);
+ unsigned long val;
+ int ret;
+
+ ret = kstrtoul(page, 0, &val);
+ if (ret < 0)
+ return ret;
+ udev->dev_size = val;
+
+ /* Check if device has been configured before */
+ if (tcmu_dev_configured(udev)) {
+ ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
+ udev->uio_info.name,
+ udev->uio_info.uio_dev->minor);
+ if (ret) {
+ pr_err("Unable to reconfigure device\n");
+ return ret;
+ }
+ }
+
+ return count;
+}
+CONFIGFS_ATTR(tcmu_, dev_size);
+
static ssize_t tcmu_emulate_write_cache_show(struct config_item *item,
char *page)
{
@@ -1586,6 +1624,13 @@ static ssize_t tcmu_emulate_write_cache_store(struct config_item *item,
}
CONFIGFS_ATTR(tcmu_, emulate_write_cache);
+struct configfs_attribute *tcmu_attrib_attrs[] = {
+ &tcmu_attr_cmd_time_out,
+ &tcmu_attr_dev_size,
+ &tcmu_attr_emulate_write_cache,
+ NULL,
+};
+
static struct configfs_attribute **tcmu_attrs;
static struct target_backend_ops tcmu_ops = {
@@ -1685,7 +1730,7 @@ static int unmap_thread_fn(void *data)
static int __init tcmu_module_init(void)
{
- int ret, i, len = 0;
+ int ret, i, k, len = 0;
BUILD_BUG_ON((sizeof(struct tcmu_cmd_entry) % TCMU_OP_ALIGN_SIZE) != 0);
@@ -1710,7 +1755,10 @@ static int __init tcmu_module_init(void)
for (i = 0; passthrough_attrib_attrs[i] != NULL; i++) {
len += sizeof(struct configfs_attribute *);
}
- len += sizeof(struct configfs_attribute *) * 2;
+ for (i = 0; tcmu_attrib_attrs[i] != NULL; i++) {
+ len += sizeof(struct configfs_attribute *);
+ }
+ len += sizeof(struct configfs_attribute *);
tcmu_attrs = kzalloc(len, GFP_KERNEL);
if (!tcmu_attrs) {
@@ -1721,9 +1769,10 @@ static int __init tcmu_module_init(void)
for (i = 0; passthrough_attrib_attrs[i] != NULL; i++) {
tcmu_attrs[i] = passthrough_attrib_attrs[i];
}
- tcmu_attrs[i] = &tcmu_attr_cmd_time_out;
- i++;
- tcmu_attrs[i] = &tcmu_attr_emulate_write_cache;
+ for (k = 0; tcmu_attrib_attrs[k] != NULL; k++) {
+ tcmu_attrs[i] = tcmu_attrib_attrs[k];
+ i++;
+ }
tcmu_ops.tb_dev_attrib_attrs = tcmu_attrs;
ret = transport_backend_register(&tcmu_ops);
--
2.5.4 (Apple Git-61)
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 4/5] tcmu: Make dev_config configurable
2017-05-30 18:31 [PATCH v2 0/5] TCMU Enable Reconfiguration Patches Bryant G. Ly
` (2 preceding siblings ...)
2017-05-30 18:31 ` [PATCH v2 3/5] tcmu: Make dev_size configurable via userspace Bryant G. Ly
@ 2017-05-30 18:31 ` Bryant G. Ly
2017-05-30 23:21 ` kbuild test robot
2017-06-06 2:02 ` Mike Christie
2017-05-30 18:31 ` [PATCH v2 5/5] tcmu: Add Type of reconfig into netlink Bryant G. Ly
2017-06-03 6:58 ` [PATCH v2 0/5] TCMU Enable Reconfiguration Patches Nicholas A. Bellinger
5 siblings, 2 replies; 10+ messages in thread
From: Bryant G. Ly @ 2017-05-30 18:31 UTC (permalink / raw)
To: nab, mchristi; +Cc: seroyer, linux-scsi, target-devel, Bryant G. Ly
This allows for userspace to change the device path after
it has been created. Thus giving the user the ability to change
the path. The use case for this is to allow for virtual optical
to have media change.
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
---
drivers/target/target_core_user.c | 41 +++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index c8c84b7..7575bc9 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1548,6 +1548,46 @@ static ssize_t tcmu_cmd_time_out_store(struct config_item *item, const char *pag
}
CONFIGFS_ATTR(tcmu_, cmd_time_out);
+static ssize_t tcmu_dev_path_show(struct config_item *item, char *page)
+{
+ struct se_dev_attrib *da = container_of(to_config_group(item),
+ struct se_dev_attrib, da_group);
+ struct tcmu_dev *udev = TCMU_DEV(da->da_dev);
+
+ return snprintf(page, PAGE_SIZE, "%s\n", udev->dev_config);
+}
+
+static ssize_t tcmu_dev_path_store(struct config_item *item, const char *page,
+ size_t count)
+{
+ struct se_dev_attrib *da = container_of(to_config_group(item),
+ struct se_dev_attrib, da_group);
+ struct tcmu_dev *udev = TCMU_DEV(da->da_dev);
+ char *copy = NULL;
+ int ret;
+
+ copy = kstrdup(page, GFP_KERNEL);
+ if (!copy) {
+ kree(copy);
+ return -EINVAL;
+ }
+ strcpy(udev->dev_config, copy);
+
+ /* Check if device has been configured before */
+ if (tcmu_dev_configured(udev)) {
+ ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
+ udev->uio_info.name,
+ udev->uio_info.uio_dev->minor);
+ if (ret) {
+ pr_err("Unable to reconfigure device\n");
+ return ret;
+ }
+ }
+
+ return count;
+}
+CONFIGFS_ATTR(tcmu_, dev_path);
+
static ssize_t tcmu_dev_size_show(struct config_item *item, char *page)
{
struct se_dev_attrib *da = container_of(to_config_group(item),
@@ -1626,6 +1666,7 @@ CONFIGFS_ATTR(tcmu_, emulate_write_cache);
struct configfs_attribute *tcmu_attrib_attrs[] = {
&tcmu_attr_cmd_time_out,
+ &tcmu_attr_dev_path,
&tcmu_attr_dev_size,
&tcmu_attr_emulate_write_cache,
NULL,
--
2.5.4 (Apple Git-61)
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v2 4/5] tcmu: Make dev_config configurable
2017-05-30 18:31 ` [PATCH v2 4/5] tcmu: Make dev_config configurable Bryant G. Ly
@ 2017-05-30 23:21 ` kbuild test robot
2017-06-06 2:02 ` Mike Christie
1 sibling, 0 replies; 10+ messages in thread
From: kbuild test robot @ 2017-05-30 23:21 UTC (permalink / raw)
Cc: kbuild-all, nab, mchristi, seroyer, linux-scsi, target-devel,
Bryant G. Ly
[-- Attachment #1: Type: text/plain, Size: 1989 bytes --]
Hi Bryant,
[auto build test ERROR on target/master]
[also build test ERROR on v4.12-rc3 next-20170530]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Bryant-G-Ly/TCMU-Enable-Reconfiguration-Patches/20170531-062328
base: https://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git master
config: i386-randconfig-x005-201722 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
drivers//target/target_core_user.c: In function 'tcmu_dev_path_store':
>> drivers//target/target_core_user.c:1571:3: error: implicit declaration of function 'kree' [-Werror=implicit-function-declaration]
kree(copy);
^~~~
cc1: some warnings being treated as errors
vim +/kree +1571 drivers//target/target_core_user.c
1555 struct tcmu_dev *udev = TCMU_DEV(da->da_dev);
1556
1557 return snprintf(page, PAGE_SIZE, "%s\n", udev->dev_config);
1558 }
1559
1560 static ssize_t tcmu_dev_path_store(struct config_item *item, const char *page,
1561 size_t count)
1562 {
1563 struct se_dev_attrib *da = container_of(to_config_group(item),
1564 struct se_dev_attrib, da_group);
1565 struct tcmu_dev *udev = TCMU_DEV(da->da_dev);
1566 char *copy = NULL;
1567 int ret;
1568
1569 copy = kstrdup(page, GFP_KERNEL);
1570 if (!copy) {
> 1571 kree(copy);
1572 return -EINVAL;
1573 }
1574 strcpy(udev->dev_config, copy);
1575
1576 /* Check if device has been configured before */
1577 if (tcmu_dev_configured(udev)) {
1578 ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
1579 udev->uio_info.name,
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27110 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH v2 4/5] tcmu: Make dev_config configurable
2017-05-30 18:31 ` [PATCH v2 4/5] tcmu: Make dev_config configurable Bryant G. Ly
2017-05-30 23:21 ` kbuild test robot
@ 2017-06-06 2:02 ` Mike Christie
1 sibling, 0 replies; 10+ messages in thread
From: Mike Christie @ 2017-06-06 2:02 UTC (permalink / raw)
To: Bryant G. Ly, nab; +Cc: seroyer, linux-scsi, target-devel
On 05/30/2017 01:31 PM, Bryant G. Ly wrote:
> This allows for userspace to change the device path after
> it has been created. Thus giving the user the ability to change
> the path. The use case for this is to allow for virtual optical
> to have media change.
>
> Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
> ---
> drivers/target/target_core_user.c | 41 +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 41 insertions(+)
>
> diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
> index c8c84b7..7575bc9 100644
> --- a/drivers/target/target_core_user.c
> +++ b/drivers/target/target_core_user.c
> @@ -1548,6 +1548,46 @@ static ssize_t tcmu_cmd_time_out_store(struct config_item *item, const char *pag
> }
> CONFIGFS_ATTR(tcmu_, cmd_time_out);
>
> +static ssize_t tcmu_dev_path_show(struct config_item *item, char *page)
> +{
> + struct se_dev_attrib *da = container_of(to_config_group(item),
> + struct se_dev_attrib, da_group);
> + struct tcmu_dev *udev = TCMU_DEV(da->da_dev);
> +
> + return snprintf(page, PAGE_SIZE, "%s\n", udev->dev_config);
> +}
> +
> +static ssize_t tcmu_dev_path_store(struct config_item *item, const char *page,
> + size_t count)
> +{
> + struct se_dev_attrib *da = container_of(to_config_group(item),
> + struct se_dev_attrib, da_group);
> + struct tcmu_dev *udev = TCMU_DEV(da->da_dev);
> + char *copy = NULL;
> + int ret;
> +
> + copy = kstrdup(page, GFP_KERNEL);
> + if (!copy) {
> + kree(copy);
> + return -EINVAL;
> + }
> + strcpy(udev->dev_config, copy);
I think we need to do strlcpy with TCMU_CONFIG_LEN here.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 5/5] tcmu: Add Type of reconfig into netlink
2017-05-30 18:31 [PATCH v2 0/5] TCMU Enable Reconfiguration Patches Bryant G. Ly
` (3 preceding siblings ...)
2017-05-30 18:31 ` [PATCH v2 4/5] tcmu: Make dev_config configurable Bryant G. Ly
@ 2017-05-30 18:31 ` Bryant G. Ly
2017-06-06 2:10 ` Mike Christie
2017-06-03 6:58 ` [PATCH v2 0/5] TCMU Enable Reconfiguration Patches Nicholas A. Bellinger
5 siblings, 1 reply; 10+ messages in thread
From: Bryant G. Ly @ 2017-05-30 18:31 UTC (permalink / raw)
To: nab, mchristi; +Cc: seroyer, linux-scsi, target-devel, Bryant G. Ly
This patch adds more info about the attribute being changed,
so that usersapce can easily figure out what is happening.
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
---
drivers/target/target_core_user.c | 27 +++++++++++++++++++++------
include/uapi/linux/target_core_user.h | 1 +
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 7575bc9..2d461c4 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -190,6 +190,13 @@ static struct genl_family tcmu_genl_family __ro_after_init = {
.netnsok = true,
};
+enum tcmu_reconfig_types {
+ No_reconfig,
+ Config_path,
+ Config_size,
+ Config_writecache
+};
+
#define tcmu_cmd_set_dbi_cur(cmd, index) ((cmd)->dbi_cur = (index))
#define tcmu_cmd_reset_dbi_cur(cmd) tcmu_cmd_set_dbi_cur(cmd, 0)
#define tcmu_cmd_set_dbi(cmd, index) ((cmd)->dbi[(cmd)->dbi_cur++] = (index))
@@ -1176,7 +1183,8 @@ static int tcmu_release(struct uio_info *info, struct inode *inode)
return 0;
}
-static int tcmu_netlink_event(enum tcmu_genl_cmd cmd, const char *name, int minor)
+static int tcmu_netlink_event(enum tcmu_genl_cmd cmd, const char *name,
+ int minor, int type)
{
struct sk_buff *skb;
void *msg_header;
@@ -1198,6 +1206,10 @@ static int tcmu_netlink_event(enum tcmu_genl_cmd cmd, const char *name, int mino
if (ret < 0)
goto free_skb;
+ ret = nla_put_u32(skb, TCMU_ATTR_TYPE, type);
+ if (ret < 0)
+ goto free_skb;
+
genlmsg_end(skb, msg_header);
ret = genlmsg_multicast_allns(&tcmu_genl_family, skb, 0,
@@ -1301,7 +1313,7 @@ static int tcmu_configure_device(struct se_device *dev)
kref_get(&udev->kref);
ret = tcmu_netlink_event(TCMU_CMD_ADDED_DEVICE, udev->uio_info.name,
- udev->uio_info.uio_dev->minor);
+ udev->uio_info.uio_dev->minor, No_reconfig);
if (ret)
goto err_netlink;
@@ -1383,7 +1395,7 @@ static void tcmu_free_device(struct se_device *dev)
if (tcmu_dev_configured(udev)) {
tcmu_netlink_event(TCMU_CMD_REMOVED_DEVICE, udev->uio_info.name,
- udev->uio_info.uio_dev->minor);
+ udev->uio_info.uio_dev->minor, No_reconfig);
uio_unregister_device(&udev->uio_info);
}
@@ -1577,7 +1589,8 @@ static ssize_t tcmu_dev_path_store(struct config_item *item, const char *page,
if (tcmu_dev_configured(udev)) {
ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
udev->uio_info.name,
- udev->uio_info.uio_dev->minor);
+ udev->uio_info.uio_dev->minor,
+ Config_path);
if (ret) {
pr_err("Unable to reconfigure device\n");
return ret;
@@ -1615,7 +1628,8 @@ static ssize_t tcmu_dev_size_store(struct config_item *item, const char *page,
if (tcmu_dev_configured(udev)) {
ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
udev->uio_info.name,
- udev->uio_info.uio_dev->minor);
+ udev->uio_info.uio_dev->minor,
+ Config_size);
if (ret) {
pr_err("Unable to reconfigure device\n");
return ret;
@@ -1654,7 +1668,8 @@ static ssize_t tcmu_emulate_write_cache_store(struct config_item *item,
if (tcmu_dev_configured(udev)) {
ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
udev->uio_info.name,
- udev->uio_info.uio_dev->minor);
+ udev->uio_info.uio_dev->minor,
+ Config_writecache);
if (ret) {
pr_err("Unable to reconfigure device\n");
return ret;
diff --git a/include/uapi/linux/target_core_user.h b/include/uapi/linux/target_core_user.h
index 403a61f..ebad1f8 100644
--- a/include/uapi/linux/target_core_user.h
+++ b/include/uapi/linux/target_core_user.h
@@ -139,6 +139,7 @@ enum tcmu_genl_attr {
TCMU_ATTR_UNSPEC,
TCMU_ATTR_DEVICE,
TCMU_ATTR_MINOR,
+ TCMU_ATTR_TYPE,
__TCMU_ATTR_MAX,
};
#define TCMU_ATTR_MAX (__TCMU_ATTR_MAX - 1)
--
2.5.4 (Apple Git-61)
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v2 5/5] tcmu: Add Type of reconfig into netlink
2017-05-30 18:31 ` [PATCH v2 5/5] tcmu: Add Type of reconfig into netlink Bryant G. Ly
@ 2017-06-06 2:10 ` Mike Christie
0 siblings, 0 replies; 10+ messages in thread
From: Mike Christie @ 2017-06-06 2:10 UTC (permalink / raw)
To: Bryant G. Ly, nab; +Cc: seroyer, linux-scsi, target-devel
On 05/30/2017 01:31 PM, Bryant G. Ly wrote:
> This patch adds more info about the attribute being changed,
> so that usersapce can easily figure out what is happening.
>
> Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
> ---
> drivers/target/target_core_user.c | 27 +++++++++++++++++++++------
> include/uapi/linux/target_core_user.h | 1 +
> 2 files changed, 22 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
> index 7575bc9..2d461c4 100644
> --- a/drivers/target/target_core_user.c
> +++ b/drivers/target/target_core_user.c
> @@ -190,6 +190,13 @@ static struct genl_family tcmu_genl_family __ro_after_init = {
> .netnsok = true,
> };
>
> +enum tcmu_reconfig_types {
> + No_reconfig,
> + Config_path,
> + Config_size,
> + Config_writecache
This this goes in target_core_user.h.
Let's just do all caps for the names to make the style in there.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 0/5] TCMU Enable Reconfiguration Patches
2017-05-30 18:31 [PATCH v2 0/5] TCMU Enable Reconfiguration Patches Bryant G. Ly
` (4 preceding siblings ...)
2017-05-30 18:31 ` [PATCH v2 5/5] tcmu: Add Type of reconfig into netlink Bryant G. Ly
@ 2017-06-03 6:58 ` Nicholas A. Bellinger
5 siblings, 0 replies; 10+ messages in thread
From: Nicholas A. Bellinger @ 2017-06-03 6:58 UTC (permalink / raw)
To: Bryant G. Ly; +Cc: mchristi, seroyer, linux-scsi, target-devel
Hi Bryant & Co,
On Tue, 2017-05-30 at 13:31 -0500, Bryant G. Ly wrote:
> This patch consists of adding a netlink to allow for reconfiguration
> of a device in tcmu.
>
> It also changes and adds some attributes that are reconfigurable:
> write_cache, device size, and device path.
>
> Bryant G. Ly (5):
> tcmu: Support emulate_write_cache
> tcmu: Add netlink for device reconfiguration
> tcmu: Make dev_size configurable via userspace
> tcmu: Make dev_config configurable
> tcmu: Add Type of reconfig into netlink
>
> drivers/target/target_core_user.c | 159 ++++++++++++++++++++++++++++++++--
> include/uapi/linux/target_core_user.h | 2 +
> 2 files changed, 155 insertions(+), 6 deletions(-)
>
Are these ready for merge..?
MNC..?
^ permalink raw reply [flat|nested] 10+ messages in thread