Revert "scst: Rework the code for waiting until an I/O context is ready"

This reverts commit 32cadc07df.

The only reason for this revert is to avoid merge conflicts with trunk
commit 0a4bce0392.
This commit is contained in:
Bart Van Assche
2015-08-31 19:31:52 -07:00
parent aa0730d5b5
commit 0f13a54539
5 changed files with 14 additions and 22 deletions
-1
View File
@@ -2275,7 +2275,6 @@ struct scst_cmd_threads {
int io_context_refcnt;
bool io_context_ready;
wait_queue_head_t io_context_wait;
/* io_context_mutex protects io_context and io_context_refcnt. */
struct mutex io_context_mutex;
+7 -1
View File
@@ -4725,7 +4725,13 @@ found:
t->acg_dev->acg->acg_io_grouping_type);
} else {
res = t;
scst_wait_ioctx(res->active_cmd_threads);
if (!*(volatile bool *)&res->active_cmd_threads->io_context_ready) {
TRACE_DBG("IO context for t %p not yet "
"initialized, waiting...", t);
msleep(100);
goto found;
}
smp_rmb();
TRACE_DBG("Going to share IO context %p (res %p, ini %s, "
"dev %s, cmd_threads %p, grouping type %d)",
res->active_cmd_threads->io_context, res,
+6 -2
View File
@@ -1925,7 +1925,12 @@ out_wait:
* Wait for io_context gets initialized to avoid possible races
* for it from the sharing it tgt_devs.
*/
scst_wait_ioctx(cmd_threads);
while (!*(volatile bool *)&cmd_threads->io_context_ready) {
TRACE_DBG("Waiting for io_context for cmd_threads %p "
"initialized", cmd_threads);
msleep(50);
}
smp_rmb();
}
if (res != 0)
@@ -2176,7 +2181,6 @@ void scst_init_threads(struct scst_cmd_threads *cmd_threads)
INIT_LIST_HEAD(&cmd_threads->threads_list);
mutex_init(&cmd_threads->io_context_mutex);
spin_lock_init(&cmd_threads->thr_lock);
init_waitqueue_head(&cmd_threads->io_context_wait);
mutex_lock(&scst_cmd_threads_mutex);
list_add_tail(&cmd_threads->lists_list_entry,
-2
View File
@@ -215,8 +215,6 @@ struct scst_cmd_thread_t {
bool being_stopped;
};
void scst_wait_ioctx(struct scst_cmd_threads *tp);
static inline bool scst_set_io_context(struct scst_cmd *cmd,
struct io_context **old)
{
+1 -16
View File
@@ -4714,20 +4714,6 @@ int scst_init_thread(void *arg)
return 0;
}
/**
* scst_wait_ioctx_timeout() - wait until an I/O context becomes available
* @tp: Thread pool to wait on.
*
* Returns the number of jiffies remaining if the I/O context became available
* in time and zero if the I/O context did not become available in time.
*/
void scst_wait_ioctx(struct scst_cmd_threads *tp)
{
wait_event(tp->io_context_wait,
*(volatile bool *)&tp->io_context_ready);
smp_rmb();
}
/**
* scst_ioctx_get() - Associate an I/O context with a thread.
*
@@ -4795,8 +4781,7 @@ See "http://lkml.org/lkml/2012/7/17/515" for more details.
smp_wmb();
p_cmd_threads->io_context_ready = true;
wake_up_all(&p_cmd_threads->io_context_wait);
return;
}
/**