[stgt] [PATCH] iscsi: disable pthread per target if iser is initialized
FUJITA Tomonori
fujita.tomonori at lab.ntt.co.jp
Tue Jun 8 16:18:15 CEST 2010
This is the last patch of the pthread patchset.
The patchset doesn't break anything (if I don't miss anything,
hopefully). I'll merge the patchset soon (unless someone finds a
problem).
=
From: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
Subject: [PATCH] iscsi: disable pthread per target if iser is initialized
We can't use both the pthread-per-target or the pthread-for-all model
for one target. Until we convert iser to the pthread-per-target model,
we need to disable the pthread-per-target for tcp when iser is
initialized.
Signed-off-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
---
usr/iscsi/iscsi_rdma.c | 2 ++
usr/iscsi/iscsi_tcp.c | 2 +-
usr/iscsi/iscsid.c | 7 +++++++
usr/iscsi/iscsid.h | 2 ++
usr/iscsi/target.c | 2 +-
usr/iscsi/transport.h | 2 ++
6 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/usr/iscsi/iscsi_rdma.c b/usr/iscsi/iscsi_rdma.c
index 8d03b90..115d774 100644
--- a/usr/iscsi/iscsi_rdma.c
+++ b/usr/iscsi/iscsi_rdma.c
@@ -1194,6 +1194,8 @@ static int iscsi_rdma_init(void)
INIT_LIST_HEAD(&iser_conn_list);
INIT_LIST_HEAD(&temp_conn);
+ iscsi_rdma_enabled = 1;
+
return ret;
}
diff --git a/usr/iscsi/iscsi_tcp.c b/usr/iscsi/iscsi_tcp.c
index 9563802..471eea0 100644
--- a/usr/iscsi/iscsi_tcp.c
+++ b/usr/iscsi/iscsi_tcp.c
@@ -280,7 +280,7 @@ static void iscsi_tcp_conn_nexus_init(struct iscsi_connection *conn)
struct iscsi_tcp_connection *tcp_conn = TCP_CONN(conn);
struct iscsi_target *target = conn->session->target;
- if (sig_fd >= 0) {
+ if (iscsi_pthread_per_target()) {
/* remove the conn from the main thread. */
conn->tp->ep_event_modify(conn, 0);
do_tgt_event_add(target->efd, &target->events_list,
diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index 63ac89c..b4e0969 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -73,6 +73,13 @@ enum {
IOSTATE_TX_END,
};
+int iscsi_rdma_enabled;
+
+int iscsi_pthread_per_target(void)
+{
+ return sig_fd >= 0 && !iscsi_rdma_enabled;
+}
+
void conn_read_pdu(struct iscsi_connection *conn)
{
conn->rx_iostate = IOSTATE_RX_BHS;
diff --git a/usr/iscsi/iscsid.h b/usr/iscsi/iscsid.h
index 91e40d6..40f3ff4 100644
--- a/usr/iscsi/iscsid.h
+++ b/usr/iscsi/iscsid.h
@@ -316,6 +316,8 @@ extern int iscsi_target_show(int mode, int tid, uint64_t sid, uint32_t cid,
int iscsi_target_update(int mode, int op, int tid, uint64_t sid, uint64_t lun,
uint32_t cid, char *name);
+int iscsi_pthread_per_target(void);
+
/* param.c */
int param_index_by_name(char *name, struct iscsi_key *keys);
diff --git a/usr/iscsi/target.c b/usr/iscsi/target.c
index 3b3eecc..cd45fb0 100644
--- a/usr/iscsi/target.c
+++ b/usr/iscsi/target.c
@@ -358,7 +358,7 @@ int iscsi_target_create(struct target *t)
isns_target_register(tgt_targetname(tid));
- if (sig_fd >= 0) {
+ if (iscsi_pthread_per_target()) {
pthread_create(&target->bsfin.thread, NULL, iscsi_thread_fn, target);
pthread_mutex_init(&target->bsfin.finished_lock, NULL);
diff --git a/usr/iscsi/transport.h b/usr/iscsi/transport.h
index e5c380d..c94b86b 100644
--- a/usr/iscsi/transport.h
+++ b/usr/iscsi/transport.h
@@ -4,6 +4,8 @@
#include <sys/socket.h>
#include "list.h"
+extern int iscsi_rdma_enabled;
+
struct iscsi_connection;
struct iscsi_task;
--
1.6.5
--
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