diff options
author | Alexander Motin <mav@FreeBSD.org> | 2017-02-17 04:34:17 +0000 |
---|---|---|
committer | Alexander Motin <mav@FreeBSD.org> | 2017-02-17 04:34:17 +0000 |
commit | 4c9ea0ced9aa5cb778030030a4bf62aa33a8c74b (patch) | |
tree | 556fa5b790fa4e9791f515c167c18b6bec0ab9cf /sys/dev/iscsi/iscsi.c | |
parent | 5b338bc073e7265041d6db40748ab0375e569daf (diff) | |
download | src-4c9ea0ced9aa5cb778030030a4bf62aa33a8c74b.tar.gz src-4c9ea0ced9aa5cb778030030a4bf62aa33a8c74b.zip |
Freeze CAM SIM when request is postponed due to MaxCmdSN.
This allows to avoid resource allocation (especially offload) for requests
that can not be executed at this time any way.
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=313852
Diffstat (limited to 'sys/dev/iscsi/iscsi.c')
-rw-r--r-- | sys/dev/iscsi/iscsi.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c index 0657572b9b12..fc2553d48b9d 100644 --- a/sys/dev/iscsi/iscsi.c +++ b/sys/dev/iscsi/iscsi.c @@ -231,14 +231,16 @@ iscsi_session_send_postponed(struct iscsi_session *is) ISCSI_SESSION_LOCK_ASSERT(is); - while (!STAILQ_EMPTY(&is->is_postponed)) { - request = STAILQ_FIRST(&is->is_postponed); + if (STAILQ_EMPTY(&is->is_postponed)) + return; + while ((request = STAILQ_FIRST(&is->is_postponed)) != NULL) { postpone = iscsi_pdu_prepare(request); if (postpone) - break; + return; STAILQ_REMOVE_HEAD(&is->is_postponed, ip_next); icl_pdu_queue(request); } + xpt_release_simq(is->is_sim, 1); } static void @@ -252,6 +254,8 @@ iscsi_pdu_queue_locked(struct icl_pdu *request) iscsi_session_send_postponed(is); postpone = iscsi_pdu_prepare(request); if (postpone) { + if (STAILQ_EMPTY(&is->is_postponed)) + xpt_freeze_simq(is->is_sim, 1); STAILQ_INSERT_TAIL(&is->is_postponed, request, ip_next); return; } @@ -339,8 +343,9 @@ iscsi_session_cleanup(struct iscsi_session *is, bool destroy_sim) /* * Remove postponed PDUs. */ - while (!STAILQ_EMPTY(&is->is_postponed)) { - pdu = STAILQ_FIRST(&is->is_postponed); + if (!STAILQ_EMPTY(&is->is_postponed)) + xpt_release_simq(is->is_sim, 1); + while ((pdu = STAILQ_FIRST(&is->is_postponed)) != NULL) { STAILQ_REMOVE_HEAD(&is->is_postponed, ip_next); icl_pdu_free(pdu); } |