aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-05-02 09:45:22 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2016-05-10 04:19:26 -0400
commit36ec2ddc0d9309d52e14eb84c0807a78604460dc (patch)
treee03ae54dff98c6caadb3eacb0e0c74f312000ebf
parent22d11759a4e7018f8cd7914e4e706ca2c96d6c01 (diff)
target: make close_session optional
Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rwxr-xr-xDocumentation/target/tcm_mod_builder.py8
-rw-r--r--drivers/target/loopback/tcm_loop.c6
-rw-r--r--drivers/target/sbp/sbp_target.c6
-rw-r--r--drivers/target/target_core_configfs.c4
-rw-r--r--drivers/target/target_core_transport.c3
-rw-r--r--drivers/usb/gadget/function/f_tcm.c5
-rw-r--r--drivers/vhost/scsi.c6
-rw-r--r--drivers/xen/xen-scsiback.c5
8 files changed, 2 insertions, 41 deletions
diff --git a/Documentation/target/tcm_mod_builder.py b/Documentation/target/tcm_mod_builder.py
index 6b8aa4086c5d..94bf6944bb1e 100755
--- a/Documentation/target/tcm_mod_builder.py
+++ b/Documentation/target/tcm_mod_builder.py
@@ -294,7 +294,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
294 buf += " .tpg_check_prod_mode_write_protect = " + fabric_mod_name + "_check_false,\n" 294 buf += " .tpg_check_prod_mode_write_protect = " + fabric_mod_name + "_check_false,\n"
295 buf += " .tpg_get_inst_index = " + fabric_mod_name + "_tpg_get_inst_index,\n" 295 buf += " .tpg_get_inst_index = " + fabric_mod_name + "_tpg_get_inst_index,\n"
296 buf += " .release_cmd = " + fabric_mod_name + "_release_cmd,\n" 296 buf += " .release_cmd = " + fabric_mod_name + "_release_cmd,\n"
297 buf += " .close_session = " + fabric_mod_name + "_close_session,\n"
298 buf += " .sess_get_index = " + fabric_mod_name + "_sess_get_index,\n" 297 buf += " .sess_get_index = " + fabric_mod_name + "_sess_get_index,\n"
299 buf += " .sess_get_initiator_sid = NULL,\n" 298 buf += " .sess_get_initiator_sid = NULL,\n"
300 buf += " .write_pending = " + fabric_mod_name + "_write_pending,\n" 299 buf += " .write_pending = " + fabric_mod_name + "_write_pending,\n"
@@ -466,13 +465,6 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
466 buf += "}\n\n" 465 buf += "}\n\n"
467 bufi += "void " + fabric_mod_name + "_release_cmd(struct se_cmd *);\n" 466 bufi += "void " + fabric_mod_name + "_release_cmd(struct se_cmd *);\n"
468 467
469 if re.search('close_session\)\(', fo):
470 buf += "void " + fabric_mod_name + "_close_session(struct se_session *se_sess)\n"
471 buf += "{\n"
472 buf += " return;\n"
473 buf += "}\n\n"
474 bufi += "void " + fabric_mod_name + "_close_session(struct se_session *);\n"
475
476 if re.search('sess_get_index\)\(', fo): 468 if re.search('sess_get_index\)\(', fo):
477 buf += "u32 " + fabric_mod_name + "_sess_get_index(struct se_session *se_sess)\n" 469 buf += "u32 " + fabric_mod_name + "_sess_get_index(struct se_session *se_sess)\n"
478 buf += "{\n" 470 buf += "{\n"
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 0941b2c13f5a..5091b31b3e56 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -601,11 +601,6 @@ static int tcm_loop_get_cmd_state(struct se_cmd *se_cmd)
601 return tl_cmd->sc_cmd_state; 601 return tl_cmd->sc_cmd_state;
602} 602}
603 603
604static void tcm_loop_close_session(struct se_session *se_sess)
605{
606 return;
607};
608
609static int tcm_loop_write_pending(struct se_cmd *se_cmd) 604static int tcm_loop_write_pending(struct se_cmd *se_cmd)
610{ 605{
611 /* 606 /*
@@ -1238,7 +1233,6 @@ static const struct target_core_fabric_ops loop_ops = {
1238 .tpg_get_inst_index = tcm_loop_get_inst_index, 1233 .tpg_get_inst_index = tcm_loop_get_inst_index,
1239 .check_stop_free = tcm_loop_check_stop_free, 1234 .check_stop_free = tcm_loop_check_stop_free,
1240 .release_cmd = tcm_loop_release_cmd, 1235 .release_cmd = tcm_loop_release_cmd,
1241 .close_session = tcm_loop_close_session,
1242 .sess_get_index = tcm_loop_sess_get_index, 1236 .sess_get_index = tcm_loop_sess_get_index,
1243 .write_pending = tcm_loop_write_pending, 1237 .write_pending = tcm_loop_write_pending,
1244 .write_pending_status = tcm_loop_write_pending_status, 1238 .write_pending_status = tcm_loop_write_pending_status,
diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c
index 6c8b8f84a047..58bb6ed18185 100644
--- a/drivers/target/sbp/sbp_target.c
+++ b/drivers/target/sbp/sbp_target.c
@@ -1726,11 +1726,6 @@ static void sbp_release_cmd(struct se_cmd *se_cmd)
1726 sbp_free_request(req); 1726 sbp_free_request(req);
1727} 1727}
1728 1728
1729static void sbp_close_session(struct se_session *se_sess)
1730{
1731 return;
1732}
1733
1734static u32 sbp_sess_get_index(struct se_session *se_sess) 1729static u32 sbp_sess_get_index(struct se_session *se_sess)
1735{ 1730{
1736 return 0; 1731 return 0;
@@ -2344,7 +2339,6 @@ static const struct target_core_fabric_ops sbp_ops = {
2344 .tpg_check_prod_mode_write_protect = sbp_check_false, 2339 .tpg_check_prod_mode_write_protect = sbp_check_false,
2345 .tpg_get_inst_index = sbp_tpg_get_inst_index, 2340 .tpg_get_inst_index = sbp_tpg_get_inst_index,
2346 .release_cmd = sbp_release_cmd, 2341 .release_cmd = sbp_release_cmd,
2347 .close_session = sbp_close_session,
2348 .sess_get_index = sbp_sess_get_index, 2342 .sess_get_index = sbp_sess_get_index,
2349 .write_pending = sbp_write_pending, 2343 .write_pending = sbp_write_pending,
2350 .write_pending_status = sbp_write_pending_status, 2344 .write_pending_status = sbp_write_pending_status,
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index 75c5000ca95e..2001005bef45 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -385,10 +385,6 @@ static int target_fabric_tf_ops_check(const struct target_core_fabric_ops *tfo)
385 pr_err("Missing tfo->release_cmd()\n"); 385 pr_err("Missing tfo->release_cmd()\n");
386 return -EINVAL; 386 return -EINVAL;
387 } 387 }
388 if (!tfo->close_session) {
389 pr_err("Missing tfo->close_session()\n");
390 return -EINVAL;
391 }
392 if (!tfo->sess_get_index) { 388 if (!tfo->sess_get_index) {
393 pr_err("Missing tfo->sess_get_index()\n"); 389 pr_err("Missing tfo->sess_get_index()\n");
394 return -EINVAL; 390 return -EINVAL;
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index ccd3a0eda0c8..2914d4c68fea 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -436,7 +436,8 @@ static void target_release_session(struct kref *kref)
436 struct se_session, sess_kref); 436 struct se_session, sess_kref);
437 struct se_portal_group *se_tpg = se_sess->se_tpg; 437 struct se_portal_group *se_tpg = se_sess->se_tpg;
438 438
439 se_tpg->se_tpg_tfo->close_session(se_sess); 439 if (se_tpg->se_tpg_tfo->close_session)
440 se_tpg->se_tpg_tfo->close_session(se_sess);
440} 441}
441 442
442int target_get_session(struct se_session *se_sess) 443int target_get_session(struct se_session *se_sess)
diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c
index f4ed427e04ce..35fe3c80cfc0 100644
--- a/drivers/usb/gadget/function/f_tcm.c
+++ b/drivers/usb/gadget/function/f_tcm.c
@@ -1290,10 +1290,6 @@ static void usbg_release_cmd(struct se_cmd *se_cmd)
1290 percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag); 1290 percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag);
1291} 1291}
1292 1292
1293static void usbg_close_session(struct se_session *se_sess)
1294{
1295}
1296
1297static u32 usbg_sess_get_index(struct se_session *se_sess) 1293static u32 usbg_sess_get_index(struct se_session *se_sess)
1298{ 1294{
1299 return 0; 1295 return 0;
@@ -1730,7 +1726,6 @@ static const struct target_core_fabric_ops usbg_ops = {
1730 .tpg_check_prod_mode_write_protect = usbg_check_false, 1726 .tpg_check_prod_mode_write_protect = usbg_check_false,
1731 .tpg_get_inst_index = usbg_tpg_get_inst_index, 1727 .tpg_get_inst_index = usbg_tpg_get_inst_index,
1732 .release_cmd = usbg_release_cmd, 1728 .release_cmd = usbg_release_cmd,
1733 .close_session = usbg_close_session,
1734 .sess_get_index = usbg_sess_get_index, 1729 .sess_get_index = usbg_sess_get_index,
1735 .sess_get_initiator_sid = NULL, 1730 .sess_get_initiator_sid = NULL,
1736 .write_pending = usbg_send_write_request, 1731 .write_pending = usbg_send_write_request,
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index d2c60e5c48b3..9d6320e8ff3e 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -333,11 +333,6 @@ static void vhost_scsi_release_cmd(struct se_cmd *se_cmd)
333 percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag); 333 percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag);
334} 334}
335 335
336static void vhost_scsi_close_session(struct se_session *se_sess)
337{
338 return;
339}
340
341static u32 vhost_scsi_sess_get_index(struct se_session *se_sess) 336static u32 vhost_scsi_sess_get_index(struct se_session *se_sess)
342{ 337{
343 return 0; 338 return 0;
@@ -2109,7 +2104,6 @@ static struct target_core_fabric_ops vhost_scsi_ops = {
2109 .tpg_get_inst_index = vhost_scsi_tpg_get_inst_index, 2104 .tpg_get_inst_index = vhost_scsi_tpg_get_inst_index,
2110 .release_cmd = vhost_scsi_release_cmd, 2105 .release_cmd = vhost_scsi_release_cmd,
2111 .check_stop_free = vhost_scsi_check_stop_free, 2106 .check_stop_free = vhost_scsi_check_stop_free,
2112 .close_session = vhost_scsi_close_session,
2113 .sess_get_index = vhost_scsi_sess_get_index, 2107 .sess_get_index = vhost_scsi_sess_get_index,
2114 .sess_get_initiator_sid = NULL, 2108 .sess_get_initiator_sid = NULL,
2115 .write_pending = vhost_scsi_write_pending, 2109 .write_pending = vhost_scsi_write_pending,
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
index 783947a272ab..d6950e0802b7 100644
--- a/drivers/xen/xen-scsiback.c
+++ b/drivers/xen/xen-scsiback.c
@@ -1399,10 +1399,6 @@ static void scsiback_release_cmd(struct se_cmd *se_cmd)
1399 percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag); 1399 percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag);
1400} 1400}
1401 1401
1402static void scsiback_close_session(struct se_session *se_sess)
1403{
1404}
1405
1406static u32 scsiback_sess_get_index(struct se_session *se_sess) 1402static u32 scsiback_sess_get_index(struct se_session *se_sess)
1407{ 1403{
1408 return 0; 1404 return 0;
@@ -1836,7 +1832,6 @@ static const struct target_core_fabric_ops scsiback_ops = {
1836 .tpg_get_inst_index = scsiback_tpg_get_inst_index, 1832 .tpg_get_inst_index = scsiback_tpg_get_inst_index,
1837 .check_stop_free = scsiback_check_stop_free, 1833 .check_stop_free = scsiback_check_stop_free,
1838 .release_cmd = scsiback_release_cmd, 1834 .release_cmd = scsiback_release_cmd,
1839 .close_session = scsiback_close_session,
1840 .sess_get_index = scsiback_sess_get_index, 1835 .sess_get_index = scsiback_sess_get_index,
1841 .sess_get_initiator_sid = NULL, 1836 .sess_get_initiator_sid = NULL,
1842 .write_pending = scsiback_write_pending, 1837 .write_pending = scsiback_write_pending,