aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/tcm_fc/tcm_fc.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2011-08-26 12:25:38 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2011-09-16 05:50:09 -0400
commit58fc73d10f3e92bfcd1e9a8391eb3e49b68df8e5 (patch)
tree0be84c4241f9080cfa01a369675e883114ed37cf /drivers/target/tcm_fc/tcm_fc.h
parent079587b4eb4d3b78a4d65d142f662aa9d7eedab4 (diff)
tcm_fc: Work queue based approach instead of managing own thread and event based mechanism
Problem: Changed from wake_up_interruptible -> wake_up_process and wait_event_interruptible-> schedule_timeout_interruptible broke the FCoE target. Earlier approach of wake_up_interruptible was also looking at 'queue_cnt' which is not necessary, because it increment of 'queue_cnt' with wake_up_inetrriptible / waker_up_process introduces race condition. Fix: Instead of fixing the code which used wake_up_process and remove 'queue_cnt', using work_queue based approach is cleaner and acheives same result. As well, work queue based approach has less programming overhead and OS manages threads which processes work queues. This patch is developed by Christoph Hellwig and reviwed+validated by Kiran Patil. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kiran Patil <kiran.patil@intel.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/tcm_fc/tcm_fc.h')
-rw-r--r--drivers/target/tcm_fc/tcm_fc.h12
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/target/tcm_fc/tcm_fc.h b/drivers/target/tcm_fc/tcm_fc.h
index bd4fe21a23b..3749d8b4b42 100644
--- a/drivers/target/tcm_fc/tcm_fc.h
+++ b/drivers/target/tcm_fc/tcm_fc.h
@@ -98,8 +98,7 @@ struct ft_tpg {
98 struct list_head list; /* linkage in ft_lport_acl tpg_list */ 98 struct list_head list; /* linkage in ft_lport_acl tpg_list */
99 struct list_head lun_list; /* head of LUNs */ 99 struct list_head lun_list; /* head of LUNs */
100 struct se_portal_group se_tpg; 100 struct se_portal_group se_tpg;
101 struct task_struct *thread; /* processing thread */ 101 struct workqueue_struct *workqueue;
102 struct se_queue_obj qobj; /* queue for processing thread */
103}; 102};
104 103
105struct ft_lport_acl { 104struct ft_lport_acl {
@@ -110,16 +109,10 @@ struct ft_lport_acl {
110 struct se_wwn fc_lport_wwn; 109 struct se_wwn fc_lport_wwn;
111}; 110};
112 111
113enum ft_cmd_state {
114 FC_CMD_ST_NEW = 0,
115 FC_CMD_ST_REJ
116};
117
118/* 112/*
119 * Commands 113 * Commands
120 */ 114 */
121struct ft_cmd { 115struct ft_cmd {
122 enum ft_cmd_state state;
123 u32 lun; /* LUN from request */ 116 u32 lun; /* LUN from request */
124 struct ft_sess *sess; /* session held for cmd */ 117 struct ft_sess *sess; /* session held for cmd */
125 struct fc_seq *seq; /* sequence in exchange mgr */ 118 struct fc_seq *seq; /* sequence in exchange mgr */
@@ -127,7 +120,7 @@ struct ft_cmd {
127 struct fc_frame *req_frame; 120 struct fc_frame *req_frame;
128 unsigned char *cdb; /* pointer to CDB inside frame */ 121 unsigned char *cdb; /* pointer to CDB inside frame */
129 u32 write_data_len; /* data received on writes */ 122 u32 write_data_len; /* data received on writes */
130 struct se_queue_req se_req; 123 struct work_struct work;
131 /* Local sense buffer */ 124 /* Local sense buffer */
132 unsigned char ft_sense_buffer[TRANSPORT_SENSE_BUFFER]; 125 unsigned char ft_sense_buffer[TRANSPORT_SENSE_BUFFER];
133 u32 was_ddp_setup:1; /* Set only if ddp is setup */ 126 u32 was_ddp_setup:1; /* Set only if ddp is setup */
@@ -177,7 +170,6 @@ int ft_is_state_remove(struct se_cmd *);
177/* 170/*
178 * other internal functions. 171 * other internal functions.
179 */ 172 */
180int ft_thread(void *);
181void ft_recv_req(struct ft_sess *, struct fc_frame *); 173void ft_recv_req(struct ft_sess *, struct fc_frame *);
182struct ft_tpg *ft_lport_find_tpg(struct fc_lport *); 174struct ft_tpg *ft_lport_find_tpg(struct fc_lport *);
183struct ft_node_acl *ft_acl_get(struct ft_tpg *, struct fc_rport_priv *); 175struct ft_node_acl *ft_acl_get(struct ft_tpg *, struct fc_rport_priv *);