aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_aux.c
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2010-02-17 05:18:50 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-02-17 18:46:19 -0500
commitb6bd2fb92a7bb9f1f3feecd9945c21e6c227dd51 (patch)
tree764374b8317b504336ef0c9ba4160ff7124c3e10 /drivers/s390/scsi/zfcp_aux.c
parente60a6d69f1f84c2ef1cc63aefaadfe7ae9f12934 (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_aux.c')
-rw-r--r--drivers/s390/scsi/zfcp_aux.c36
1 files changed, 3 insertions, 33 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 9d0c941b7d3..f42da9d5709 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -32,6 +32,7 @@
32#include <linux/seq_file.h> 32#include <linux/seq_file.h>
33#include "zfcp_ext.h" 33#include "zfcp_ext.h"
34#include "zfcp_fc.h" 34#include "zfcp_fc.h"
35#include "zfcp_reqlist.h"
35 36
36#define ZFCP_BUS_ID_SIZE 20 37#define ZFCP_BUS_ID_SIZE 20
37 38
@@ -49,36 +50,6 @@ static struct kmem_cache *zfcp_cache_hw_align(const char *name,
49 return kmem_cache_create(name, size, roundup_pow_of_two(size), 0, NULL); 50 return kmem_cache_create(name, size, roundup_pow_of_two(size), 0, NULL);
50} 51}
51 52
52static int zfcp_reqlist_alloc(struct zfcp_adapter *adapter)
53{
54 int idx;
55
56 adapter->req_list = kcalloc(REQUEST_LIST_SIZE, sizeof(struct list_head),
57 GFP_KERNEL);
58 if (!adapter->req_list)
59 return -ENOMEM;
60
61 for (idx = 0; idx < REQUEST_LIST_SIZE; idx++)
62 INIT_LIST_HEAD(&adapter->req_list[idx]);
63 return 0;
64}
65
66/**
67 * zfcp_reqlist_isempty - is the request list empty
68 * @adapter: pointer to struct zfcp_adapter
69 *
70 * Returns: true if list is empty, false otherwise
71 */
72int zfcp_reqlist_isempty(struct zfcp_adapter *adapter)
73{
74 unsigned int idx;
75
76 for (idx = 0; idx < REQUEST_LIST_SIZE; idx++)
77 if (!list_empty(&adapter->req_list[idx]))
78 return 0;
79 return 1;
80}
81
82static void __init zfcp_init_device_configure(char *busid, u64 wwpn, u64 lun) 53static void __init zfcp_init_device_configure(char *busid, u64 wwpn, u64 lun)
83{ 54{
84 struct ccw_device *cdev; 55 struct ccw_device *cdev;
@@ -539,7 +510,8 @@ struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *ccw_device)
539 if (zfcp_allocate_low_mem_buffers(adapter)) 510 if (zfcp_allocate_low_mem_buffers(adapter))
540 goto failed; 511 goto failed;
541 512
542 if (zfcp_reqlist_alloc(adapter)) 513 adapter->req_list = zfcp_reqlist_alloc();
514 if (!adapter->req_list)
543 goto failed; 515 goto failed;
544 516
545 if (zfcp_dbf_adapter_register(adapter)) 517 if (zfcp_dbf_adapter_register(adapter))
@@ -560,8 +532,6 @@ struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *ccw_device)
560 INIT_LIST_HEAD(&adapter->erp_ready_head); 532 INIT_LIST_HEAD(&adapter->erp_ready_head);
561 INIT_LIST_HEAD(&adapter->erp_running_head); 533 INIT_LIST_HEAD(&adapter->erp_running_head);
562 534
563 spin_lock_init(&adapter->req_list_lock);
564
565 rwlock_init(&adapter->erp_lock); 535 rwlock_init(&adapter->erp_lock);
566 rwlock_init(&adapter->abort_lock); 536 rwlock_init(&adapter->abort_lock);
567 537