[stgt] [PATCH 09/12] Define a new nexus_init interface to be used by thread per target

Chandra Seetharaman sekharan at us.ibm.com
Mon Sep 27 23:07:25 CEST 2010


Define a new interface nexus_init for transport to enable handling of the
tcp events of a target by the thread attached with the target.

Signed-off-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
Signed-off-by: Chandra Seetharaman <sekharan at us.ibm.com>

---
 usr/iscsi/iscsi_rdma.c |    6 ++++++
 usr/iscsi/iscsi_tcp.c  |    6 ++++++
 usr/iscsi/iscsid.c     |    2 +-
 usr/iscsi/transport.h  |    1 +
 4 files changed, 14 insertions(+), 1 deletion(-)

Index: tgt-102236c/usr/iscsi/transport.h
===================================================================
--- tgt-102236c.orig/usr/iscsi/transport.h
+++ tgt-102236c/usr/iscsi/transport.h
@@ -19,6 +19,7 @@ struct iscsi_transport {
 	int (*ep_init) (void);
 	void (*ep_exit) (void);
 	int (*ep_login_complete)(struct iscsi_connection *conn);
+	void (*ep_nexus_init)(struct iscsi_connection *conn);
 	struct iscsi_task *(*alloc_task)(struct iscsi_connection *conn,
 					 size_t ext_len);
 	void (*free_task)(struct iscsi_task *task);
Index: tgt-102236c/usr/iscsi/iscsid.c
===================================================================
--- tgt-102236c.orig/usr/iscsi/iscsid.c
+++ tgt-102236c/usr/iscsi/iscsid.c
@@ -2246,7 +2246,7 @@ finish:
 		else {
 			conn->state = STATE_SCSI;
 			conn_read_pdu(conn);
-			conn->tp->ep_event_modify(conn, EPOLLIN);
+			conn->tp->ep_nexus_init(conn);
 		}
 		break;
 	case STATE_EXIT:
Index: tgt-102236c/usr/iscsi/iscsi_rdma.c
===================================================================
--- tgt-102236c.orig/usr/iscsi/iscsi_rdma.c
+++ tgt-102236c/usr/iscsi/iscsi_rdma.c
@@ -1248,6 +1248,11 @@ static int iscsi_rdma_login_complete(str
 	return ret;
 }
 
+static void iscsi_rdma_nexus_init(struct iscsi_connection *conn)
+{
+       conn->tp->ep_event_modify(conn, EPOLLIN);
+}
+
 /*
  * Copy the remote va and stag that were temporarily saved in conn_info.
  */
@@ -1727,6 +1732,7 @@ static struct iscsi_transport iscsi_iser
 	.data_padding		= 1,
 	.ep_init		= iscsi_rdma_init,
 	.ep_login_complete	= iscsi_rdma_login_complete,
+	.ep_nexus_init		= iscsi_rdma_nexus_init,
 	.alloc_task		= iscsi_iser_alloc_task,
 	.free_task		= iscsi_iser_free_task,
 	.ep_read		= iscsi_iser_read,
Index: tgt-102236c/usr/iscsi/iscsi_tcp.c
===================================================================
--- tgt-102236c.orig/usr/iscsi/iscsi_tcp.c
+++ tgt-102236c/usr/iscsi/iscsi_tcp.c
@@ -263,6 +263,11 @@ static int iscsi_tcp_conn_login_complete
 	return 0;
 }
 
+static void iscsi_tcp_conn_nexus_init(struct iscsi_connection *conn)
+{
+	conn->tp->ep_event_modify(conn, EPOLLIN);
+}
+
 static size_t iscsi_tcp_read(struct iscsi_connection *conn, void *buf,
 			     size_t nbytes)
 {
@@ -391,6 +396,7 @@ static struct iscsi_transport iscsi_tcp 
 	.ep_init		= iscsi_tcp_init,
 	.ep_exit		= iscsi_tcp_exit,
 	.ep_login_complete	= iscsi_tcp_conn_login_complete,
+	.ep_nexus_init		= iscsi_tcp_conn_nexus_init,
 	.alloc_task		= iscsi_tcp_alloc_task,
 	.free_task		= iscsi_tcp_free_task,
 	.ep_read		= iscsi_tcp_read,
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list