Commit e3eac124 authored by Bart Van Assche's avatar Bart Van Assche Committed by Nicholas Bellinger

xen/scsiback: Replace a waitqueue and a counter by a completion

This patch simplifies the implementation of the scsiback driver
but does not change its behavior.
Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: David Disseldorp <ddiss@suse.de>
Cc: xen-devel@lists.xenproject.org
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 9f4ab18a
...@@ -135,8 +135,7 @@ struct vscsibk_pend { ...@@ -135,8 +135,7 @@ struct vscsibk_pend {
struct se_cmd se_cmd; struct se_cmd se_cmd;
atomic_t tmr_complete; struct completion tmr_done;
wait_queue_head_t tmr_wait;
}; };
#define VSCSI_DEFAULT_SESSION_TAGS 128 #define VSCSI_DEFAULT_SESSION_TAGS 128
...@@ -600,7 +599,7 @@ static void scsiback_device_action(struct vscsibk_pend *pending_req, ...@@ -600,7 +599,7 @@ static void scsiback_device_action(struct vscsibk_pend *pending_req,
u64 unpacked_lun = pending_req->v2p->lun; u64 unpacked_lun = pending_req->v2p->lun;
int rc, err = FAILED; int rc, err = FAILED;
init_waitqueue_head(&pending_req->tmr_wait); init_completion(&pending_req->tmr_done);
rc = target_submit_tmr(&pending_req->se_cmd, nexus->tvn_se_sess, rc = target_submit_tmr(&pending_req->se_cmd, nexus->tvn_se_sess,
&pending_req->sense_buffer[0], &pending_req->sense_buffer[0],
...@@ -609,8 +608,7 @@ static void scsiback_device_action(struct vscsibk_pend *pending_req, ...@@ -609,8 +608,7 @@ static void scsiback_device_action(struct vscsibk_pend *pending_req,
if (rc) if (rc)
goto err; goto err;
wait_event(pending_req->tmr_wait, wait_for_completion(&pending_req->tmr_done);
atomic_read(&pending_req->tmr_complete));
err = (se_cmd->se_tmr_req->response == TMR_FUNCTION_COMPLETE) ? err = (se_cmd->se_tmr_req->response == TMR_FUNCTION_COMPLETE) ?
SUCCESS : FAILED; SUCCESS : FAILED;
...@@ -1443,8 +1441,7 @@ static void scsiback_queue_tm_rsp(struct se_cmd *se_cmd) ...@@ -1443,8 +1441,7 @@ static void scsiback_queue_tm_rsp(struct se_cmd *se_cmd)
struct vscsibk_pend *pending_req = container_of(se_cmd, struct vscsibk_pend *pending_req = container_of(se_cmd,
struct vscsibk_pend, se_cmd); struct vscsibk_pend, se_cmd);
atomic_set(&pending_req->tmr_complete, 1); complete(&pending_req->tmr_done);
wake_up(&pending_req->tmr_wait);
} }
static void scsiback_aborted_task(struct se_cmd *se_cmd) static void scsiback_aborted_task(struct se_cmd *se_cmd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment