diff options
author | Christof Schmitt <christof.schmitt@de.ibm.com> | 2010-02-17 05:18:50 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-02-17 18:46:19 -0500 |
commit | b6bd2fb92a7bb9f1f3feecd9945c21e6c227dd51 (patch) | |
tree | 764374b8317b504336ef0c9ba4160ff7124c3e10 /drivers/s390/scsi/zfcp_fsf.c | |
parent | e60a6d69f1f84c2ef1cc63aefaadfe7ae9f12934 (diff) |
[SCSI] zfcp: Move FSF request tracking code to new file
Move the code for tracking FSF requests to new file to have this code
in one place. The functions for adding and removing requests on the
I/O path are already inline. The alloc and free functions are only
called once, so it does not hurt to inline them and add them to the
same file.
Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/s390/scsi/zfcp_fsf.c')
-rw-r--r-- | drivers/s390/scsi/zfcp_fsf.c | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index fd2371b69489..36a6f4a7b8d7 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include "zfcp_ext.h" | 14 | #include "zfcp_ext.h" |
15 | #include "zfcp_fc.h" | 15 | #include "zfcp_fc.h" |
16 | #include "zfcp_dbf.h" | 16 | #include "zfcp_dbf.h" |
17 | #include "zfcp_reqlist.h" | ||
17 | 18 | ||
18 | static void zfcp_fsf_request_timeout_handler(unsigned long data) | 19 | static void zfcp_fsf_request_timeout_handler(unsigned long data) |
19 | { | 20 | { |
@@ -457,15 +458,10 @@ static void zfcp_fsf_req_complete(struct zfcp_fsf_req *req) | |||
457 | void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *adapter) | 458 | void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *adapter) |
458 | { | 459 | { |
459 | struct zfcp_fsf_req *req, *tmp; | 460 | struct zfcp_fsf_req *req, *tmp; |
460 | unsigned long flags; | ||
461 | LIST_HEAD(remove_queue); | 461 | LIST_HEAD(remove_queue); |
462 | unsigned int i; | ||
463 | 462 | ||
464 | BUG_ON(atomic_read(&adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP); | 463 | BUG_ON(atomic_read(&adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP); |
465 | spin_lock_irqsave(&adapter->req_list_lock, flags); | 464 | zfcp_reqlist_move(adapter->req_list, &remove_queue); |
466 | for (i = 0; i < REQUEST_LIST_SIZE; i++) | ||
467 | list_splice_init(&adapter->req_list[i], &remove_queue); | ||
468 | spin_unlock_irqrestore(&adapter->req_list_lock, flags); | ||
469 | 465 | ||
470 | list_for_each_entry_safe(req, tmp, &remove_queue, list) { | 466 | list_for_each_entry_safe(req, tmp, &remove_queue, list) { |
471 | list_del(&req->list); | 467 | list_del(&req->list); |
@@ -770,27 +766,17 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req) | |||
770 | { | 766 | { |
771 | struct zfcp_adapter *adapter = req->adapter; | 767 | struct zfcp_adapter *adapter = req->adapter; |
772 | struct zfcp_qdio *qdio = adapter->qdio; | 768 | struct zfcp_qdio *qdio = adapter->qdio; |
773 | unsigned long flags; | 769 | int with_qtcb = (req->qtcb != NULL); |
774 | int idx; | ||
775 | int with_qtcb = (req->qtcb != NULL); | ||
776 | int req_id = req->req_id; | 770 | int req_id = req->req_id; |
777 | 771 | ||
778 | /* put allocated FSF request into hash table */ | 772 | zfcp_reqlist_add(adapter->req_list, req); |
779 | spin_lock_irqsave(&adapter->req_list_lock, flags); | ||
780 | idx = zfcp_reqlist_hash(req_id); | ||
781 | list_add_tail(&req->list, &adapter->req_list[idx]); | ||
782 | spin_unlock_irqrestore(&adapter->req_list_lock, flags); | ||
783 | 773 | ||
784 | req->queue_req.qdio_outb_usage = atomic_read(&qdio->req_q.count); | 774 | req->queue_req.qdio_outb_usage = atomic_read(&qdio->req_q.count); |
785 | req->issued = get_clock(); | 775 | req->issued = get_clock(); |
786 | if (zfcp_qdio_send(qdio, &req->queue_req)) { | 776 | if (zfcp_qdio_send(qdio, &req->queue_req)) { |
787 | del_timer(&req->timer); | 777 | del_timer(&req->timer); |
788 | spin_lock_irqsave(&adapter->req_list_lock, flags); | ||
789 | /* lookup request again, list might have changed */ | 778 | /* lookup request again, list might have changed */ |
790 | req = zfcp_reqlist_find(adapter, req_id); | 779 | zfcp_reqlist_find_rm(adapter->req_list, req_id); |
791 | if (req) | ||
792 | zfcp_reqlist_remove(adapter, req); | ||
793 | spin_unlock_irqrestore(&adapter->req_list_lock, flags); | ||
794 | zfcp_erp_adapter_reopen(adapter, 0, "fsrs__1", req); | 780 | zfcp_erp_adapter_reopen(adapter, 0, "fsrs__1", req); |
795 | return -EIO; | 781 | return -EIO; |
796 | } | 782 | } |
@@ -2518,15 +2504,14 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx) | |||
2518 | struct qdio_buffer *sbal = qdio->resp_q.sbal[sbal_idx]; | 2504 | struct qdio_buffer *sbal = qdio->resp_q.sbal[sbal_idx]; |
2519 | struct qdio_buffer_element *sbale; | 2505 | struct qdio_buffer_element *sbale; |
2520 | struct zfcp_fsf_req *fsf_req; | 2506 | struct zfcp_fsf_req *fsf_req; |
2521 | unsigned long flags, req_id; | 2507 | unsigned long req_id; |
2522 | int idx; | 2508 | int idx; |
2523 | 2509 | ||
2524 | for (idx = 0; idx < QDIO_MAX_ELEMENTS_PER_BUFFER; idx++) { | 2510 | for (idx = 0; idx < QDIO_MAX_ELEMENTS_PER_BUFFER; idx++) { |
2525 | 2511 | ||
2526 | sbale = &sbal->element[idx]; | 2512 | sbale = &sbal->element[idx]; |
2527 | req_id = (unsigned long) sbale->addr; | 2513 | req_id = (unsigned long) sbale->addr; |
2528 | spin_lock_irqsave(&adapter->req_list_lock, flags); | 2514 | fsf_req = zfcp_reqlist_find_rm(adapter->req_list, req_id); |
2529 | fsf_req = zfcp_reqlist_find(adapter, req_id); | ||
2530 | 2515 | ||
2531 | if (!fsf_req) | 2516 | if (!fsf_req) |
2532 | /* | 2517 | /* |
@@ -2536,9 +2521,6 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx) | |||
2536 | panic("error: unknown req_id (%lx) on adapter %s.\n", | 2521 | panic("error: unknown req_id (%lx) on adapter %s.\n", |
2537 | req_id, dev_name(&adapter->ccw_device->dev)); | 2522 | req_id, dev_name(&adapter->ccw_device->dev)); |
2538 | 2523 | ||
2539 | list_del(&fsf_req->list); | ||
2540 | spin_unlock_irqrestore(&adapter->req_list_lock, flags); | ||
2541 | |||
2542 | fsf_req->queue_req.sbal_response = sbal_idx; | 2524 | fsf_req->queue_req.sbal_response = sbal_idx; |
2543 | fsf_req->queue_req.qdio_inb_usage = | 2525 | fsf_req->queue_req.qdio_inb_usage = |
2544 | atomic_read(&qdio->resp_q.count); | 2526 | atomic_read(&qdio->resp_q.count); |