diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2007-05-08 11:17:54 +0200 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-05-08 11:56:50 -0500 |
commit | ca2d02c2f9ea476062ae181eec60b8bcd97857d6 (patch) | |
tree | dffe33856db601a173a117263b9ee4799d555ac6 /drivers/s390/scsi/zfcp_def.h | |
parent | 5f852be9e11d62223ea063f6ceed4f9677f54051 (diff) |
[SCSI] zfcp: rework request ID management.
Simplify request ID management and make sure that frequently used
functions are inlined. Also fix a memory leak in zfcp_adapter_enqueue()
which only gets hit in error handling.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/s390/scsi/zfcp_def.h')
-rw-r--r-- | drivers/s390/scsi/zfcp_def.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h index 07b0957b82f3..22649639230b 100644 --- a/drivers/s390/scsi/zfcp_def.h +++ b/drivers/s390/scsi/zfcp_def.h @@ -1090,6 +1090,42 @@ extern void _zfcp_hex_dump(char *, int); #define zfcp_get_busid_by_unit(unit) (zfcp_get_busid_by_port(unit->port)) /* + * Helper functions for request ID management. + */ +static inline int zfcp_reqlist_hash(unsigned long req_id) +{ + return req_id % REQUEST_LIST_SIZE; +} + +static inline void zfcp_reqlist_add(struct zfcp_adapter *adapter, + struct zfcp_fsf_req *fsf_req) +{ + unsigned int idx; + + idx = zfcp_reqlist_hash(fsf_req->req_id); + list_add_tail(&fsf_req->list, &adapter->req_list[idx]); +} + +static inline void zfcp_reqlist_remove(struct zfcp_adapter *adapter, + struct zfcp_fsf_req *fsf_req) +{ + list_del(&fsf_req->list); +} + +static inline struct zfcp_fsf_req * +zfcp_reqlist_find(struct zfcp_adapter *adapter, unsigned long req_id) +{ + struct zfcp_fsf_req *request; + unsigned int idx; + + idx = zfcp_reqlist_hash(req_id); + list_for_each_entry(request, &adapter->req_list[idx], list) + if (request->req_id == req_id) + return request; + return NULL; +} + +/* * functions needed for reference/usage counting */ |