zfcp updates for 2.6.34
Subsystems (3)
cover zfcp updates for 2.6.34
Here is the series of zfcp patches for the 2.6.34 merge window. The patches apply on top of the current linux-2.6 tree.
--
Christof
PATCH 1/11 zfcp: Remove function zfcp_reqlist_find_safe
From: Christof Schmitt <[email protected]>
Always use the FSF request id as a reference to the FSF request. With this change the function zfcp_reqlist_find_safe is no longer needed and can be removed.
---
drivers/s390/scsi/zfcp_dbf.c | 2 +- drivers/s390/scsi/zfcp_def.h | 17 +---------------- drivers/s390/scsi/zfcp_erp.c | 17 +++++++++-------- drivers/s390/scsi/zfcp_fsf.c | 34 ++++++++++++++++++---------------- 4 files changed, 29 insertions(+), 41 deletions(-)
drivers/s390/scsi/zfcp_dbf.c +1 -1
@@ -668,7 +668,7 @@ void zfcp_dbf_rec_action(char *id2, stru r->u.action.action = (unsigned long )erp_action; r->u.action.status = erp_action->status; r->u.action.step = erp_action->step; - r->u.action.fsf_req = (unsigned long )erp_action->fsf_req; + r->u.action.fsf_req = erp_action->fsf_req_id;debug_event (dbf->rec,5 , r,sizeof (*r));spin_unlock_irqrestore (&dbf->rec_lock, flags); }
drivers/s390/scsi/zfcp_def.h +1 -16
@@ -143,8 +143,7 @@ struct zfcp_erp_action {struct zfcp_unit *unit;u32 status;/* recovery status */ u32 step;/* active step of this erp action */ -struct zfcp_fsf_req *fsf_req;/* fsf request currently pending -for this action */ +unsigned long fsf_req_id;struct timer_list timer; };
@@ -379,18 +378,4 @@ zfcp_reqlist_find(struct zfcp_adapter *a return NULL; } -static inline struct zfcp_fsf_req * -zfcp_reqlist_find_safe (struct zfcp_adapter *adapter,struct zfcp_fsf_req *req) -{ -struct zfcp_fsf_req *request; -unsigned int idx; - -for (idx =0 ; idx <REQUEST_LIST_SIZE ; idx++) { -list_for_each_entry (request, &adapter->req_list[idx], list) -if (request == req) -return request; - } -return NULL ; -} -#endif /* ZFCP_DEF_H */
drivers/s390/scsi/zfcp_erp.c +9 -8
@@ -478,25 +478,26 @@ static void zfcp_erp_action_to_running(sstatic void zfcp_erp_strategy_check_fsfreq (struct zfcp_erp_action *act) {struct zfcp_adapter *adapter = act->adapter; +struct zfcp_fsf_req *req; -if (!act->fsf_req) +if (!act->fsf_req_id)return ;spin_lock (&adapter->req_list_lock); -if (zfcp_reqlist_find_safe (adapter, act->fsf_req) && - act->fsf_req->erp_action == act) { + req =zfcp_reqlist_find (adapter, act->fsf_req_id); +if (req && req->erp_action == act) {if (act->status & (ZFCP_STATUS_ERP_DISMISSED |ZFCP_STATUS_ERP_TIMEDOUT )) { - act->fsf_req->status |=ZFCP_STATUS_FSFREQ_DISMISSED ; + req->status |=ZFCP_STATUS_FSFREQ_DISMISSED ;zfcp_dbf_rec_action ("erscf_1" , act); - act->fsf_req->erp_action =NULL ; + req->erp_action =NULL ; }if (act->status &ZFCP_STATUS_ERP_TIMEDOUT )zfcp_dbf_rec_action ("erscf_2" , act); -if (act->fsf_req->status &ZFCP_STATUS_FSFREQ_DISMISSED ) - act->fsf_req =NULL ; +if (req->status &ZFCP_STATUS_FSFREQ_DISMISSED ) + act->fsf_req_id =0 ; }else - act->fsf_req =NULL ; + act->fsf_req_id =0 ;spin_unlock (&adapter->req_list_lock); }
drivers/s390/scsi/zfcp_fsf.c +18 -16
@@ -773,10 +773,11 @@ static int zfcp_fsf_req_send(struct zfcpunsigned long flags;int idx;int with_qtcb = (req->qtcb !=NULL ); +int req_id = req->req_id;/* put allocated FSF request into hash table */ spin_lock_irqsave (&adapter->req_list_lock, flags); - idx =zfcp_reqlist_hash (req->req_id); + idx =zfcp_reqlist_hash (req_id);list_add_tail (&req->list, &adapter->req_list[idx]);spin_unlock_irqrestore (&adapter->req_list_lock, flags);
@@ -786,7 +787,8 @@ static int zfcp_fsf_req_send(struct zfcpdel_timer (&req->timer);spin_lock_irqsave (&adapter->req_list_lock, flags);/* lookup request again, list might have changed */ -if (zfcp_reqlist_find_safe (adapter, req)) + req =zfcp_reqlist_find (adapter, req_id); +if (req)zfcp_reqlist_remove (adapter, req);spin_unlock_irqrestore (&adapter->req_list_lock, flags);zfcp_erp_adapter_reopen (adapter,0 ,"fsrs__1" , req);
@@ -1262,13 +1264,13 @@ int zfcp_fsf_exchange_config_data(structFSF_FEATURE_UPDATE_ALERT ; req->erp_action = erp_action; req->handler = zfcp_fsf_exchange_config_data_handler; - erp_action->fsf_req = req; + erp_action->fsf_req_id = req->req_id;zfcp_fsf_start_erp_timer (req); retval =zfcp_fsf_req_send (req);if (retval) {zfcp_fsf_req_free (req); - erp_action->fsf_req =NULL ; + erp_action->fsf_req_id =0 ; } out:spin_unlock_bh (&qdio->req_q_lock);
@@ -1355,13 +1357,13 @@ int zfcp_fsf_exchange_port_data(struct z req->handler = zfcp_fsf_exchange_port_data_handler; req->erp_action = erp_action; - erp_action->fsf_req = req; + erp_action->fsf_req_id = req->req_id;zfcp_fsf_start_erp_timer (req); retval =zfcp_fsf_req_send (req);if (retval) {zfcp_fsf_req_free (req); - erp_action->fsf_req =NULL ; + erp_action->fsf_req_id =0 ; } out:spin_unlock_bh (&qdio->req_q_lock);
@@ -1521,14 +1523,14 @@ int zfcp_fsf_open_port(struct zfcp_erp_ahton24 (req->qtcb->bottom.support.d_id, port->d_id); req->data = port; req->erp_action = erp_action; - erp_action->fsf_req = req; + erp_action->fsf_req_id = req->req_id;get_device (&port->sysfs_device);zfcp_fsf_start_erp_timer (req); retval =zfcp_fsf_req_send (req);if (retval) {zfcp_fsf_req_free (req); - erp_action->fsf_req =NULL ; + erp_action->fsf_req_id =0 ;put_device (&port->sysfs_device); } out:
@@ -1591,13 +1593,13 @@ int zfcp_fsf_close_port(struct zfcp_erp_ req->data = erp_action->port; req->erp_action = erp_action; req->qtcb->header.port_handle = erp_action->port->handle; - erp_action->fsf_req = req; + erp_action->fsf_req_id = req->req_id;zfcp_fsf_start_erp_timer (req); retval =zfcp_fsf_req_send (req);if (retval) {zfcp_fsf_req_free (req); - erp_action->fsf_req =NULL ; + erp_action->fsf_req_id =0 ; } out:spin_unlock_bh (&qdio->req_q_lock);
@@ -1817,13 +1819,13 @@ int zfcp_fsf_close_physical_port(struct req->qtcb->header.port_handle = erp_action->port->handle; req->erp_action = erp_action; req->handler = zfcp_fsf_close_physical_port_handler; - erp_action->fsf_req = req; + erp_action->fsf_req_id = req->req_id;zfcp_fsf_start_erp_timer (req); retval =zfcp_fsf_req_send (req);if (retval) {zfcp_fsf_req_free (req); - erp_action->fsf_req =NULL ; + erp_action->fsf_req_id =0 ; } out:spin_unlock_bh (&qdio->req_q_lock);
@@ -1991,7 +1993,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_a req->handler = zfcp_fsf_open_unit_handler; req->data = erp_action->unit; req->erp_action = erp_action; - erp_action->fsf_req = req; + erp_action->fsf_req_id = req->req_id;if (!(adapter->connection_features &FSF_FEATURE_NPIV_MODE )) req->qtcb->bottom.support.option =FSF_OPEN_LUN_SUPPRESS_BOXING ;
@@ -2000,7 +2002,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_a retval =zfcp_fsf_req_send (req);if (retval) {zfcp_fsf_req_free (req); - erp_action->fsf_req =NULL ; + erp_action->fsf_req_id =0 ; } out:spin_unlock_bh (&qdio->req_q_lock);
@@ -2077,13 +2079,13 @@ int zfcp_fsf_close_unit(struct zfcp_erp_ req->handler = zfcp_fsf_close_unit_handler; req->data = erp_action->unit; req->erp_action = erp_action; - erp_action->fsf_req = req; + erp_action->fsf_req_id = req->req_id;zfcp_fsf_start_erp_timer (req); retval =zfcp_fsf_req_send (req);if (retval) {zfcp_fsf_req_free (req); - erp_action->fsf_req =NULL ; + erp_action->fsf_req_id =0 ; } out:spin_unlock_bh (&qdio->req_q_lock);
PATCH 2/11 zfcp: Move FSF request tracking code to new file
In reply to Christof SchmittFrom: Christof Schmitt <[email protected]>
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.
---
drivers/s390/scsi/zfcp_aux.c | 36 ------- drivers/s390/scsi/zfcp_ccw.c | 3 drivers/s390/scsi/zfcp_def.h | 34 ------- drivers/s390/scsi/zfcp_erp.c | 7 - drivers/s390/scsi/zfcp_ext.h | 1 drivers/s390/scsi/zfcp_fsf.c | 32 +----- drivers/s390/scsi/zfcp_reqlist.h | 183 +++++++++++++++++++++++++++++++++++++++ drivers/s390/scsi/zfcp_scsi.c | 5 - 8 files changed, 203 insertions(+), 98 deletions(-)
drivers/s390/scsi/zfcp_aux.c +3 -33
@@ -32,6 +32,7 @@#include <linux/seq_file.h> #include "zfcp_ext.h" #include "zfcp_fc.h" +#include "zfcp_reqlist.h" #define ZFCP_BUS_ID_SIZE 20
@@ -49,36 +50,6 @@ static struct kmem_cache *zfcp_cache_hw_return kmem_cache_create (name, size,roundup_pow_of_two (size),0 ,NULL ); } -static int zfcp_reqlist_alloc (struct zfcp_adapter *adapter) -{ -int idx; - - adapter->req_list =kcalloc (REQUEST_LIST_SIZE ,sizeof (struct list_head ), -GFP_KERNEL ); -if (!adapter->req_list) -return -ENOMEM ; - -for (idx =0 ; idx <REQUEST_LIST_SIZE ; idx++) -INIT_LIST_HEAD (&adapter->req_list[idx]); -return 0 ; -} - -/** -* zfcp_reqlist_isempty - is the request list empty -* @adapter: pointer to struct zfcp_adapter -* -* Returns: true if list is empty, false otherwise -*/ -int zfcp_reqlist_isempty (struct zfcp_adapter *adapter) -{ -unsigned int idx; - -for (idx =0 ; idx <REQUEST_LIST_SIZE ; idx++) -if (!list_empty (&adapter->req_list[idx])) -return 0 ; -return 1 ; -} -static void __init zfcp_init_device_configure (char *busid,u64 wwpn,u64 lun) {struct ccw_device *cdev;
@@ -539,7 +510,8 @@ struct zfcp_adapter *zfcp_adapter_enqueuif (zfcp_allocate_low_mem_buffers (adapter)) goto failed; -if (zfcp_reqlist_alloc (adapter)) + adapter->req_list =zfcp_reqlist_alloc (); +if (!adapter->req_list) goto failed;if (zfcp_dbf_adapter_register (adapter))
@@ -560,8 +532,6 @@ struct zfcp_adapter *zfcp_adapter_enqueuINIT_LIST_HEAD (&adapter->erp_ready_head);INIT_LIST_HEAD (&adapter->erp_running_head); -spin_lock_init (&adapter->req_list_lock); -rwlock_init (&adapter->erp_lock);rwlock_init (&adapter->abort_lock);
drivers/s390/scsi/zfcp_ccw.c +2 -1
@@ -10,6 +10,7 @@#define pr_fmt (fmt) KMSG_COMPONENT ": " fmt#include "zfcp_ext.h" +#include "zfcp_reqlist.h" #define ZFCP_MODEL_PRIV 0x4
@@ -162,7 +163,7 @@ static int zfcp_ccw_set_online(struct cc }/* initialize request counter */ -BUG_ON (!zfcp_reqlist_isempty (adapter)); +BUG_ON (!zfcp_reqlist_isempty (adapter->req_list)); adapter->req_no =0 ; zfcp_erp_modify_adapter_status(adapter, "ccsonl1", NULL,
drivers/s390/scsi/zfcp_def.h +2 -32
@@ -39,9 +39,7 @@#include <asm/sysinfo.h> #include "zfcp_fsf.h" -/********************* GENERAL DEFINES *********************************/ - -#define REQUEST_LIST_SIZE 128 +struct zfcp_reqlist ;/********************* SCSI SPECIFIC DEFINES *********************************/ #define ZFCP_SCSI_ER_TIMEOUT (10*HZ)
@@ -206,8 +204,7 @@ struct zfcp_adapter {struct list_head port_list;/* remote port list */ rwlock_t port_list_lock;/* port list lock */ unsigned long req_no;/* unique FSF req number */ -struct list_head *req_list;/* list of pending reqs */ -spinlock_t req_list_lock;/* request list lock */ +struct zfcp_reqlist *req_list;u32 fsf_req_seq_no;/* FSF cmnd seq number */ rwlock_t abort_lock;/* Protects against SCSI stack abort/command
@@ -351,31 +348,4 @@ struct zfcp_data {#define ZFCP_SET 0x00000100#define ZFCP_CLEAR 0x00000200 -/* -* 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_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 ; -} -#endif /* ZFCP_DEF_H */
drivers/s390/scsi/zfcp_erp.c +4 -3
@@ -11,6 +11,7 @@#include <linux/kthread.h> #include "zfcp_ext.h" +#include "zfcp_reqlist.h" #define ZFCP_MAX_ERPS 3
@@ -483,8 +484,8 @@ static void zfcp_erp_strategy_check_fsfrif (!act->fsf_req_id)return ; -spin_lock (&adapter->req_list_lock); - req =zfcp_reqlist_find (adapter, act->fsf_req_id); +spin_lock (&adapter->req_list->lock); + req =_zfcp_reqlist_find (adapter->req_list, act->fsf_req_id);if (req && req->erp_action == act) {if (act->status & (ZFCP_STATUS_ERP_DISMISSED |ZFCP_STATUS_ERP_TIMEDOUT )) {
@@ -498,7 +499,7 @@ static void zfcp_erp_strategy_check_fsfr act->fsf_req_id =0 ; }else act->fsf_req_id =0 ; -spin_unlock (&adapter->req_list_lock); +spin_unlock (&adapter->req_list->lock); }/**
drivers/s390/scsi/zfcp_ext.h +0 -1
@@ -21,7 +21,6 @@ extern struct zfcp_adapter *zfcp_adapterextern struct zfcp_port *zfcp_port_enqueue (struct zfcp_adapter *,u64 ,u32 ,u32 );extern struct zfcp_unit *zfcp_unit_enqueue (struct zfcp_port *,u64 ); -extern int zfcp_reqlist_isempty (struct zfcp_adapter *);extern void zfcp_sg_free_table (struct scatterlist *,int );extern int zfcp_sg_setup_table (struct scatterlist *,int ); extern void zfcp_device_unregister(struct device *,
drivers/s390/scsi/zfcp_fsf.c +7 -25
@@ -14,6 +14,7 @@#include "zfcp_ext.h" #include "zfcp_fc.h" #include "zfcp_dbf.h" +#include "zfcp_reqlist.h" static void zfcp_fsf_request_timeout_handler (unsigned long data) {
@@ -457,15 +458,10 @@ static void zfcp_fsf_req_complete(structvoid zfcp_fsf_req_dismiss_all (struct zfcp_adapter *adapter) {struct zfcp_fsf_req *req, *tmp; -unsigned long flags;LIST_HEAD (remove_queue); -unsigned int i;BUG_ON (atomic_read (&adapter->status) &ZFCP_STATUS_ADAPTER_QDIOUP ); -spin_lock_irqsave (&adapter->req_list_lock, flags); -for (i =0 ; i <REQUEST_LIST_SIZE ; i++) -list_splice_init (&adapter->req_list[i], &remove_queue); -spin_unlock_irqrestore (&adapter->req_list_lock, flags); +zfcp_reqlist_move (adapter->req_list, &remove_queue);list_for_each_entry_safe (req, tmp, &remove_queue, list) {list_del (&req->list);
@@ -770,27 +766,17 @@ static int zfcp_fsf_req_send(struct zfcp {struct zfcp_adapter *adapter = req->adapter;struct zfcp_qdio *qdio = adapter->qdio; -unsigned long flags; -int idx; -int with_qtcb = (req->qtcb !=NULL ); +int with_qtcb = (req->qtcb !=NULL );int req_id = req->req_id; -/* put allocated FSF request into hash table */ -spin_lock_irqsave (&adapter->req_list_lock, flags); - idx =zfcp_reqlist_hash (req_id); -list_add_tail (&req->list, &adapter->req_list[idx]); -spin_unlock_irqrestore (&adapter->req_list_lock, flags); +zfcp_reqlist_add (adapter->req_list, req); req->queue_req.qdio_outb_usage =atomic_read (&qdio->req_q.count); req->issued =get_clock ();if (zfcp_qdio_send (qdio, &req->queue_req)) {del_timer (&req->timer); -spin_lock_irqsave (&adapter->req_list_lock, flags);/* lookup request again, list might have changed */ - req =zfcp_reqlist_find (adapter, req_id); -if (req) -zfcp_reqlist_remove (adapter, req); -spin_unlock_irqrestore (&adapter->req_list_lock, flags); +zfcp_reqlist_find_rm (adapter->req_list, req_id);zfcp_erp_adapter_reopen (adapter,0 ,"fsrs__1" , req);return -EIO ; }
@@ -2518,15 +2504,14 @@ void zfcp_fsf_reqid_check(struct zfcp_qdstruct qdio_buffer *sbal = qdio->resp_q.sbal[sbal_idx];struct qdio_buffer_element *sbale;struct zfcp_fsf_req *fsf_req; -unsigned long flags, req_id; +unsigned long req_id;int idx;for (idx =0 ; idx <QDIO_MAX_ELEMENTS_PER_BUFFER ; idx++) { sbale = &sbal->element[idx]; req_id = (unsigned long ) sbale->addr; -spin_lock_irqsave (&adapter->req_list_lock, flags); - fsf_req =zfcp_reqlist_find (adapter, req_id); + fsf_req =zfcp_reqlist_find_rm (adapter->req_list, req_id);if (!fsf_req)/*
@@ -2536,9 +2521,6 @@ void zfcp_fsf_reqid_check(struct zfcp_qdpanic ("error: unknown req_id (%lx) on adapter %s.\n" , req_id,dev_name (&adapter->ccw_device->dev)); -list_del (&fsf_req->list); -spin_unlock_irqrestore (&adapter->req_list_lock, flags); - fsf_req->queue_req.sbal_response = sbal_idx; fsf_req->queue_req.qdio_inb_usage =atomic_read (&qdio->resp_q.count);
drivers/s390/scsi/zfcp_reqlist.h +183 -0
183 lines not on this page · raw message
drivers/s390/scsi/zfcp_scsi.c +2 -3
@@ -15,6 +15,7 @@#include "zfcp_ext.h" #include "zfcp_dbf.h" #include "zfcp_fc.h" +#include "zfcp_reqlist.h" static unsigned int default_depth =32 ;module_param_named (queue_depth, default_depth, uint,0600 );
@@ -189,9 +190,7 @@ static int zfcp_scsi_eh_abort_handler(st/* avoid race condition between late normal completion and abort */ write_lock_irqsave (&adapter->abort_lock, flags); -spin_lock (&adapter->req_list_lock); - old_req =zfcp_reqlist_find (adapter, old_reqid); -spin_unlock (&adapter->req_list_lock); + old_req =zfcp_reqlist_find (adapter->req_list, old_reqid);if (!old_req) {write_unlock_irqrestore (&adapter->abort_lock, flags); zfcp_dbf_scsi_abort("lte1", adapter->dbf, scpnt, NULL,
PATCH 3/11 zfcp: Remove two FIXME comments
In reply to Christof SchmittFrom: Christof Schmitt <[email protected]>
On a link down, the adapter reopen is not strictly necessary, but it helps flushing pending requests as quickly as possible. Add a comment mentioning this.
qdio returning a problem on the response queue is an unlikely event. The recovery mentioned in the comment might resolve it, so implement it. This also has the advantage that it creates an entry in the recovery trace to see if and when this is occurring.
---
drivers/s390/scsi/zfcp_fsf.c | 2 +- drivers/s390/scsi/zfcp_qdio.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/s390/scsi/zfcp_fsf.c +1 -1
@@ -394,7 +394,7 @@ static void zfcp_fsf_protstatus_eval(strcase FSF_PROT_LINK_DOWN :zfcp_fsf_link_down_info_eval (req,"fspse_5" , &psq->link_down_info); -/* FIXME: reopening adapter now? better wait for link up */ +/* go through reopen to flush pending requests */ zfcp_erp_adapter_reopen (adapter,0 ,"fspse_6" , req);break ;case FSF_PROT_REEST_QUEUE :
drivers/s390/scsi/zfcp_qdio.c +1 -1
@@ -106,7 +106,7 @@ static void zfcp_qdio_resp_put_back(struif (unlikely (retval)) {atomic_set (&queue->count, count); -/* FIXME: Recover this with an adapter reopen? */ +zfcp_erp_adapter_reopen (qdio->adapter,0 ,"qdrpb_1" ,NULL ); }else { queue->first += count; queue->first %=QDIO_MAX_BUFFERS_PER_Q ;
PATCH 4/11 zfcp: Remove unused payload field from zfcp_dbf_san_record
In reply to Christof SchmittFrom: Christof Schmitt <[email protected]>
Remove the unused payload field from the struct zfcp_dbf_san_record, saving some space in the SAN trace.
---
drivers/s390/scsi/zfcp_dbf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/s390/scsi/zfcp_dbf.h +2 -2
@@ -192,10 +192,10 @@ struct zfcp_dbf_san_record {struct zfcp_dbf_san_record_ct_response ct_resp;struct zfcp_dbf_san_record_els els; } u; -#define ZFCP_DBF_SAN_MAX_PAYLOAD 1024 -u8 payload[32 ]; } __attribute__ ((packed)); +#define ZFCP_DBF_SAN_MAX_PAYLOAD 1024 +struct zfcp_dbf_scsi_record {u8 tag[ZFCP_DBF_TAG_SIZE ];u8 tag2[ZFCP_DBF_TAG_SIZE ];
PATCH 5/11 zfcp: Fix warnings from smatch
In reply to Christof SchmittFrom: Christof Schmitt <[email protected]>
The smatch tool from http://repo.or.cz/w/smatch.git warns about this:
drivers/s390/scsi/zfcp_scsi.c +64 zfcp_scsi_command_fail(5) warn: variable dereferenced before check 'scpnt->device' drivers/s390/scsi/zfcp_scsi.c +64 zfcp_scsi_command_fail(5) warn: variable dereferenced before check 'scpnt->device->host' drivers/s390/scsi/zfcp_scsi.c +93 zfcp_scsi_queuecommand(23) warn: variable dereferenced before check 'unit'
Fix the first two warnings by removing the checks for scpnt->device and -> host: As long as the SCSI command exists, there is also a scsi_device and a Scsi_Host.
Fix the last warning by removing the BUG_ON checks in zfcp_scsi_queuecommand, they are leftovers from previous paranoia about wrong pointers between data structures.
---
drivers/s390/scsi/zfcp_scsi.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/s390/scsi/zfcp_scsi.c +2 -11
@@ -60,10 +60,9 @@ static void zfcp_scsi_command_fail(struc {struct zfcp_adapter *adapter = (struct zfcp_adapter *) scpnt->device->host->hostdata[0 ]; +set_host_byte (scpnt, result); -if ((scpnt->device !=NULL ) && (scpnt->device->host !=NULL )) -zfcp_dbf_scsi_result ("fail" ,4 , adapter->dbf, scpnt,NULL ); -/* return directly */ +zfcp_dbf_scsi_result ("fail" ,4 , adapter->dbf, scpnt,NULL ); scpnt->scsi_done (scpnt); }
@@ -87,14 +86,6 @@ static int zfcp_scsi_queuecommand(struct adapter = (struct zfcp_adapter *) scpnt->device->host->hostdata[0 ]; unit = scpnt->device->hostdata; -BUG_ON (!adapter || (adapter != unit->port->adapter)); -BUG_ON (!scpnt->scsi_done); - -if (unlikely (!unit)) { -zfcp_scsi_command_fail (scpnt,DID_NO_CONNECT ); -return 0 ; - } - scsi_result =fc_remote_port_chkready (rport);if (unlikely (scsi_result)) { scpnt->result = scsi_result;
PATCH 6/11 zfcp: Dont use 0 to indicate invalid LUN in rec trace
In reply to Christof SchmittFrom: Christof Schmitt <[email protected]>
0 is a valid value for a LUN. It is slightly confusing to also see 0 in the trace entries relating to adapter and port. Change this to use 0xFFFFFFFFFFFFFFFF in the LUN field when the trace entry does not relate to a LUN or unit.
---
drivers/s390/scsi/zfcp_dbf.c | 12 ++++++------ drivers/s390/scsi/zfcp_dbf.h | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/s390/scsi/zfcp_dbf.c +6 -6
@@ -576,7 +576,8 @@ void zfcp_dbf_rec_adapter(char *id, voidstruct zfcp_adapter *adapter = dbf->adapter;zfcp_dbf_rec_target (id, ref, dbf, &adapter->status, - &adapter->erp_counter,0 ,0 ,0 ); + &adapter->erp_counter,0 ,0 , +ZFCP_DBF_INVALID_LUN ); }/**
@@ -590,8 +591,8 @@ void zfcp_dbf_rec_port(char *id, void *rstruct zfcp_dbf *dbf = port->adapter->dbf;zfcp_dbf_rec_target (id, ref, dbf, &port->status, - &port->erp_counter, port->wwpn, port->d_id, -0 ); + &port->erp_counter, port->wwpn, port->d_id, +ZFCP_DBF_INVALID_LUN ); }/**
@@ -642,10 +643,9 @@ void zfcp_dbf_rec_trigger(char *id2, voi r->u.trigger.ps =atomic_read (&port->status); r->u.trigger.wwpn = port->wwpn; } -if (unit) { +if (unit) r->u.trigger.us =atomic_read (&unit->status); - r->u.trigger.fcp_lun = unit->fcp_lun; - } + r->u.trigger.fcp_lun = unit ? unit->fcp_lun :ZFCP_DBF_INVALID_LUN ;debug_event (dbf->rec, action ?1 :4 , r,sizeof (*r));spin_unlock_irqrestore (&dbf->rec_lock, flags); }
drivers/s390/scsi/zfcp_dbf.h +2 -0
@@ -30,6 +30,8 @@#define ZFCP_DBF_TAG_SIZE 4#define ZFCP_DBF_ID_SIZE 7 +#define ZFCP_DBF_INVALID_LUN 0xFFFFFFFFFFFFFFFFull +struct zfcp_dbf_dump {u8 tag[ZFCP_DBF_TAG_SIZE ];u32 total_size;/* size of total dump data */
PATCH 7/11 zfcp: Remove duplicate assignment of req_seq_no
In reply to Christof SchmittFrom: Christof Schmitt <[email protected]>
zfcp_fsf_req_create assigns the same value twice to req_seq_no. Remove one assignment and move the req_id and seq_no assignments to one place.
---
drivers/s390/scsi/zfcp_fsf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/s390/scsi/zfcp_fsf.c +1 -2
@@ -741,6 +741,7 @@ static struct zfcp_fsf_req *zfcp_fsf_reqreturn ERR_PTR (-ENOMEM ); } + req->seq_no = adapter->fsf_req_seq_no; req->qtcb->prefix.req_seq_no = adapter->fsf_req_seq_no; req->qtcb->prefix.req_id = req->req_id; req->qtcb->prefix.ulp_info =26 ;
@@ -748,8 +749,6 @@ static struct zfcp_fsf_req *zfcp_fsf_req req->qtcb->prefix.qtcb_version =FSF_QTCB_CURRENT_VERSION ; req->qtcb->header.req_handle = req->req_id; req->qtcb->header.fsf_command = req->fsf_command; - req->seq_no = adapter->fsf_req_seq_no; - req->qtcb->prefix.req_seq_no = adapter->fsf_req_seq_no; sbale[1 ].addr = (void *) req->qtcb; sbale[1 ].length =sizeof (struct fsf_qtcb ); }
PATCH 8/11 zfcp: Rename sysfs_device attribute to dev in zfcp_unit and zfcp_port
In reply to Christof SchmittFrom: Christof Schmitt <[email protected]>
Kernel code uses dev as short name for the struct device. Rename the sysfs_device in zfcp_unit and zfcp_port to match this convention.
---
drivers/s390/scsi/zfcp_aux.c | 54 ++++++++++++++++++----------------------- drivers/s390/scsi/zfcp_ccw.c | 8 ++---- drivers/s390/scsi/zfcp_def.h | 6 ++-- drivers/s390/scsi/zfcp_erp.c | 14 +++++----- drivers/s390/scsi/zfcp_fc.c | 23 ++++++++--------- drivers/s390/scsi/zfcp_fsf.c | 14 +++++----- drivers/s390/scsi/zfcp_scsi.c | 18 ++++++------- drivers/s390/scsi/zfcp_sysfs.c | 37 ++++++++++++---------------- 8 files changed, 81 insertions(+), 93 deletions(-)
drivers/s390/scsi/zfcp_aux.c +25 -29
@@ -3,7 +3,7 @@* * Module interface and handling of zfcp data structures. * -* Copyright IBM Corporation 2002, 2009 +* Copyright IBM Corporation 2002, 2010 */ /*
@@ -81,7 +81,7 @@ static void __init zfcp_init_device_confflush_work (&unit->scsi_work); out_unit: -put_device (&port->sysfs_device); +put_device (&port->dev); out_port:zfcp_ccw_adapter_put (adapter); out_ccw_device:
@@ -226,7 +226,7 @@ struct zfcp_unit *zfcp_get_unit_by_lun(sread_lock_irqsave (&port->unit_list_lock, flags);list_for_each_entry (unit, &port->unit_list, list)if (unit->fcp_lun == fcp_lun) { -if (!get_device (&unit->sysfs_device)) +if (!get_device (&unit->dev)) unit =NULL ;read_unlock_irqrestore (&port->unit_list_lock, flags);return unit;
@@ -251,7 +251,7 @@ struct zfcp_port *zfcp_get_port_by_wwpn(read_lock_irqsave (&adapter->port_list_lock, flags);list_for_each_entry (port, &adapter->port_list, list)if (port->wwpn == wwpn) { -if (!get_device (&port->sysfs_device)) +if (!get_device (&port->dev)) port =NULL ;read_unlock_irqrestore (&adapter->port_list_lock, flags);return port;
@@ -269,10 +269,9 @@ struct zfcp_port *zfcp_get_port_by_wwpn(*/ static void zfcp_unit_release (struct device *dev) { - struct zfcp_unit *unit = container_of(dev, struct zfcp_unit, - sysfs_device); + struct zfcp_unit *unit = container_of(dev, struct zfcp_unit, dev); -put_device (&unit->port->sysfs_device); +put_device (&unit->port->dev);kfree (unit); }
@@ -289,11 +288,11 @@ struct zfcp_unit *zfcp_unit_enqueue(strustruct zfcp_unit *unit;int retval = -ENOMEM ; -get_device (&port->sysfs_device); +get_device (&port->dev); unit =zfcp_get_unit_by_lun (port, fcp_lun);if (unit) { -put_device (&unit->sysfs_device); +put_device (&unit->dev); retval = -EEXIST ; goto err_out; }
@@ -304,10 +303,10 @@ struct zfcp_unit *zfcp_unit_enqueue(stru unit->port = port; unit->fcp_lun = fcp_lun; - unit->sysfs_device.parent = &port->sysfs_device; - unit->sysfs_device.release = zfcp_unit_release; + unit->dev.parent = &port->dev; + unit->dev.release = zfcp_unit_release; -if (dev_set_name (&unit->sysfs_device,"0x%016llx" , +if (dev_set_name (&unit->dev,"0x%016llx" , (unsigned long long ) fcp_lun)) {kfree (unit); goto err_out;
@@ -324,13 +323,12 @@ struct zfcp_unit *zfcp_unit_enqueue(stru unit->latencies.cmd.channel.min =0xFFFFFFFF ; unit->latencies.cmd.fabric.min =0xFFFFFFFF ; -if (device_register (&unit->sysfs_device)) { -put_device (&unit->sysfs_device); +if (device_register (&unit->dev)) { +put_device (&unit->dev); goto err_out; } -if (sysfs_create_group (&unit->sysfs_device.kobj, - &zfcp_sysfs_unit_attrs)) +if (sysfs_create_group (&unit->dev.kobj, &zfcp_sysfs_unit_attrs)) goto err_out_put;write_lock_irq (&port->unit_list_lock);
@@ -342,9 +340,9 @@ struct zfcp_unit *zfcp_unit_enqueue(strureturn unit; err_out_put: -device_unregister (&unit->sysfs_device); +device_unregister (&unit->dev); err_out: -put_device (&port->sysfs_device); +put_device (&port->dev);return ERR_PTR (retval); }
@@ -610,8 +608,7 @@ void zfcp_device_unregister(struct devicstatic void zfcp_port_release (struct device *dev) { - struct zfcp_port *port = container_of(dev, struct zfcp_port, - sysfs_device); + struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);zfcp_ccw_adapter_put (port->adapter);kfree (port);
@@ -639,7 +636,7 @@ struct zfcp_port *zfcp_port_enqueue(stru port =zfcp_get_port_by_wwpn (adapter, wwpn);if (port) { -put_device (&port->sysfs_device); +put_device (&port->dev); retval = -EEXIST ; goto err_out; }
@@ -659,22 +656,21 @@ struct zfcp_port *zfcp_port_enqueue(stru port->d_id = d_id; port->wwpn = wwpn; port->rport_task =RPORT_NONE ; - port->sysfs_device.parent = &adapter->ccw_device->dev; - port->sysfs_device.release = zfcp_port_release; + port->dev.parent = &adapter->ccw_device->dev; + port->dev.release = zfcp_port_release; -if (dev_set_name (&port->sysfs_device,"0x%016llx" , - (unsigned long long )wwpn)) { +if (dev_set_name (&port->dev,"0x%016llx" , (unsigned long long )wwpn)) {kfree (port); goto err_out; } retval = -EINVAL ; -if (device_register (&port->sysfs_device)) { -put_device (&port->sysfs_device); +if (device_register (&port->dev)) { +put_device (&port->dev); goto err_out; } -if (sysfs_create_group (&port->sysfs_device.kobj, +if (sysfs_create_group (&port->dev.kobj, &zfcp_sysfs_port_attrs)) goto err_out_put;
@@ -687,7 +683,7 @@ struct zfcp_port *zfcp_port_enqueue(strureturn port; err_out_put: -device_unregister (&port->sysfs_device); +device_unregister (&port->dev); err_out:zfcp_ccw_adapter_put (adapter);return ERR_PTR (retval);
drivers/s390/scsi/zfcp_ccw.c +3 -5
@@ -3,7 +3,7 @@* * Registration and callback for the s390 common I/O layer. * -* Copyright IBM Corporation 2002, 2009 +* Copyright IBM Corporation 2002, 2010 */ #define KMSG_COMPONENT "zfcp"
@@ -123,12 +123,10 @@ static void zfcp_ccw_remove(struct ccw_dzfcp_ccw_adapter_put (adapter);/* put from zfcp_ccw_adapter_by_cdev */ list_for_each_entry_safe (unit, u, &unit_remove_lh, list) -zfcp_device_unregister (&unit->sysfs_device, - &zfcp_sysfs_unit_attrs); +zfcp_device_unregister (&unit->dev, &zfcp_sysfs_unit_attrs);list_for_each_entry_safe (port, p, &port_remove_lh, list) -zfcp_device_unregister (&port->sysfs_device, - &zfcp_sysfs_port_attrs); +zfcp_device_unregister (&port->dev, &zfcp_sysfs_port_attrs);zfcp_adapter_unregister (adapter); }
drivers/s390/scsi/zfcp_def.h +3 -3
@@ -3,7 +3,7 @@* * Global definitions for the zfcp device driver. * -* Copyright IBM Corporation 2002, 2009 +* Copyright IBM Corporation 2002, 2010 */ #ifndef ZFCP_DEF_H
@@ -237,7 +237,7 @@ struct zfcp_adapter { };struct zfcp_port { -struct device sysfs_device;/* sysfs device */ +struct device dev;struct fc_rport *rport;/* rport of fc transport class */ struct list_head list;/* list of remote ports */ struct zfcp_adapter *adapter;/* adapter used to access port */
@@ -259,7 +259,7 @@ struct zfcp_port { };struct zfcp_unit { -struct device sysfs_device;/* sysfs device */ +struct device dev;struct list_head list;/* list of logical units */ struct zfcp_port *port;/* remote port of unit */ atomic_t status;/* status of this logical unit */
drivers/s390/scsi/zfcp_erp.c +7 -7
@@ -3,7 +3,7 @@* * Error Recovery Procedures (ERP). * -* Copyright IBM Corporation 2002, 2009 +* Copyright IBM Corporation 2002, 2010 */ #define KMSG_COMPONENT "zfcp"
@@ -175,7 +175,7 @@ static struct zfcp_erp_action *zfcp_erp_switch (need) {case ZFCP_ERP_ACTION_REOPEN_UNIT : -if (!get_device (&unit->sysfs_device)) +if (!get_device (&unit->dev))return NULL ;atomic_set_mask (ZFCP_STATUS_COMMON_ERP_INUSE , &unit->status); erp_action = &unit->erp_action;
@@ -185,7 +185,7 @@ static struct zfcp_erp_action *zfcp_erp_case ZFCP_ERP_ACTION_REOPEN_PORT :case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED : -if (!get_device (&port->sysfs_device)) +if (!get_device (&port->dev))return NULL ;zfcp_erp_action_dismiss_port (port);atomic_set_mask (ZFCP_STATUS_COMMON_ERP_INUSE , &port->status);
@@ -1181,19 +1181,19 @@ static void zfcp_erp_action_cleanup(struswitch (act->action) {case ZFCP_ERP_ACTION_REOPEN_UNIT :if ((result ==ZFCP_ERP_SUCCEEDED ) && !unit->device) { -get_device (&unit->sysfs_device); +get_device (&unit->dev);if (scsi_queue_work (unit->port->adapter->scsi_host, &unit->scsi_work) <=0 ) -put_device (&unit->sysfs_device); +put_device (&unit->dev); } -put_device (&unit->sysfs_device); +put_device (&unit->dev);break ;case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED :case ZFCP_ERP_ACTION_REOPEN_PORT :if (result ==ZFCP_ERP_SUCCEEDED )zfcp_scsi_schedule_rport_register (port); -put_device (&port->sysfs_device); +put_device (&port->dev);break ;case ZFCP_ERP_ACTION_REOPEN_ADAPTER :
drivers/s390/scsi/zfcp_fc.c +11 -12
@@ -3,7 +3,7 @@* * Fibre Channel related functions for the zfcp device driver. * -* Copyright IBM Corporation 2008, 2009 +* Copyright IBM Corporation 2008, 2010 */ #define KMSG_COMPONENT "zfcp"
@@ -316,7 +316,7 @@ void zfcp_fc_port_did_lookup(struct workzfcp_erp_port_reopen (port,0 ,"fcgpn_3" ,NULL ); out: -put_device (&port->sysfs_device); +put_device (&port->dev); }/**
@@ -325,9 +325,9 @@ out:*/ void zfcp_fc_trigger_did_lookup (struct zfcp_port *port) { -get_device (&port->sysfs_device); +get_device (&port->dev);if (!queue_work (port->adapter->work_queue, &port->gid_pn_work)) -put_device (&port->sysfs_device); +put_device (&port->dev); }/**
@@ -389,7 +389,7 @@ static void zfcp_fc_adisc_handler(void *zfcp_scsi_schedule_rport_register (port); out:atomic_clear_mask (ZFCP_STATUS_PORT_LINK_TEST , &port->status); -put_device (&port->sysfs_device); +put_device (&port->dev);kmem_cache_free (zfcp_data.adisc_cache, adisc); }
@@ -436,7 +436,7 @@ void zfcp_fc_link_test_work(struct work_ container_of(work, struct zfcp_port, test_link_work);int retval; -get_device (&port->sysfs_device); +get_device (&port->dev); port->rport_task =RPORT_DEL ;zfcp_scsi_rport_work (&port->rport_work);
@@ -455,7 +455,7 @@ void zfcp_fc_link_test_work(struct work_zfcp_erp_port_forced_reopen (port,0 ,"fcltwk1" ,NULL ); out: -put_device (&port->sysfs_device); +put_device (&port->dev); }/**
@@ -468,9 +468,9 @@ out:*/ void zfcp_fc_test_link (struct zfcp_port *port) { -get_device (&port->sysfs_device); +get_device (&port->dev);if (!queue_work (port->adapter->work_queue, &port->test_link_work)) -put_device (&port->sysfs_device); +put_device (&port->dev); }static void zfcp_free_sg_env (struct zfcp_fc_gpn_ft *gpn_ft,int buf_num)
@@ -617,8 +617,7 @@ static int zfcp_fc_eval_gpn_ft(struct zflist_for_each_entry_safe (port, tmp, &remove_lh, list) {zfcp_erp_port_shutdown (port,0 ,"fcegpf2" ,NULL ); -zfcp_device_unregister (&port->sysfs_device, - &zfcp_sysfs_port_attrs); +zfcp_device_unregister (&port->dev, &zfcp_sysfs_port_attrs); }return ret;
@@ -731,7 +730,7 @@ static int zfcp_fc_exec_els_job(struct freturn -EINVAL ; d_id = port->d_id; -put_device (&port->sysfs_device); +put_device (&port->dev); }else d_id =ntoh24 (job->request->rqst_data.h_els.port_id);
drivers/s390/scsi/zfcp_fsf.c +7 -7
@@ -3,7 +3,7 @@* * Implementation of FSF commands. * -* Copyright IBM Corporation 2002, 2009 +* Copyright IBM Corporation 2002, 2010 */ #define KMSG_COMPONENT "zfcp"
@@ -1471,7 +1471,7 @@ static void zfcp_fsf_open_port_handler(s } out: -put_device (&port->sysfs_device); +put_device (&port->dev); }/**
@@ -1509,14 +1509,14 @@ int zfcp_fsf_open_port(struct zfcp_erp_a req->data = port; req->erp_action = erp_action; erp_action->fsf_req_id = req->req_id; -get_device (&port->sysfs_device); +get_device (&port->dev);zfcp_fsf_start_erp_timer (req); retval =zfcp_fsf_req_send (req);if (retval) {zfcp_fsf_req_free (req); erp_action->fsf_req_id =0 ; -put_device (&port->sysfs_device); +put_device (&port->dev); } out:spin_unlock_bh (&qdio->req_q_lock);
@@ -2261,7 +2261,7 @@ skip_fsfstatus:else {zfcp_fsf_send_fcp_command_task_handler (req); req->unit =NULL ; -put_device (&unit->sysfs_device); +put_device (&unit->dev); } }
@@ -2299,7 +2299,7 @@ int zfcp_fsf_send_fcp_command_task(struc } req->status |=ZFCP_STATUS_FSFREQ_CLEANUP ; -get_device (&unit->sysfs_device); +get_device (&unit->dev); req->unit = unit; req->data = scsi_cmnd; req->handler = zfcp_fsf_send_fcp_command_handler;
@@ -2356,7 +2356,7 @@ int zfcp_fsf_send_fcp_command_task(struc goto out; failed_scsi_cmnd: -put_device (&unit->sysfs_device); +put_device (&unit->dev);zfcp_fsf_req_free (req); scsi_cmnd->host_scribble =NULL ; out:
drivers/s390/scsi/zfcp_scsi.c +9 -9
@@ -3,7 +3,7 @@* * Interface to Linux SCSI midlayer. * -* Copyright IBM Corporation 2002, 2009 +* Copyright IBM Corporation 2002, 2010 */ #define KMSG_COMPONENT "zfcp"
@@ -44,7 +44,7 @@ static void zfcp_scsi_slave_destroy(stru {struct zfcp_unit *unit = (struct zfcp_unit *) sdpnt->hostdata; unit->device =NULL ; -put_device (&unit->sysfs_device); +put_device (&unit->dev); }static int zfcp_scsi_slave_configure (struct scsi_device *sdp)
@@ -511,7 +511,7 @@ static void zfcp_scsi_terminate_rport_ioif (port) {zfcp_erp_port_reopen (port,0 ,"sctrpi1" ,NULL ); -put_device (&port->sysfs_device); +put_device (&port->dev); } }
@@ -553,23 +553,23 @@ static void zfcp_scsi_rport_block(structvoid zfcp_scsi_schedule_rport_register (struct zfcp_port *port) { -get_device (&port->sysfs_device); +get_device (&port->dev); port->rport_task =RPORT_ADD ;if (!queue_work (port->adapter->work_queue, &port->rport_work)) -put_device (&port->sysfs_device); +put_device (&port->dev); }void zfcp_scsi_schedule_rport_block (struct zfcp_port *port) { -get_device (&port->sysfs_device); +get_device (&port->dev); port->rport_task =RPORT_DEL ;if (port->rport &&queue_work (port->adapter->work_queue, &port->rport_work))return ; -put_device (&port->sysfs_device); +put_device (&port->dev); }void zfcp_scsi_schedule_rports_block (struct zfcp_adapter *adapter)
@@ -598,7 +598,7 @@ void zfcp_scsi_rport_work(struct work_st } } -put_device (&port->sysfs_device); +put_device (&port->dev); }
@@ -616,7 +616,7 @@ void zfcp_scsi_scan(struct work_struct *scsilun_to_int ((struct scsi_lun *) &unit->fcp_lun), 0); -put_device (&unit->sysfs_device); +put_device (&unit->dev); }struct fc_function_template zfcp_transport_functions = {
drivers/s390/scsi/zfcp_sysfs.c +16 -21
@@ -3,7 +3,7 @@* * sysfs attributes. * -* Copyright IBM Corporation 2008, 2009 +* Copyright IBM Corporation 2008, 2010 */ #define KMSG_COMPONENT "zfcp"
@@ -19,8 +19,7 @@ static ssize_t zfcp_sysfs_##_feat##_##_nstruct device_attribute *at,\ char *buf) \ { \ - struct _feat_def *_feat = container_of(dev, struct _feat_def, \ - sysfs_device); \ + struct _feat_def *_feat = container_of(dev, struct _feat_def, dev); \ \return sprintf (buf, _format, _value); \ } \
@@ -87,8 +86,7 @@ static ssize_t zfcp_sysfs_##_feat##_failstruct device_attribute *attr, \ char *buf) \ { \ - struct _feat_def *_feat = container_of(dev, struct _feat_def, \ - sysfs_device); \ + struct _feat_def *_feat = container_of(dev, struct _feat_def, dev); \ \if (atomic_read (&_feat->status) &ZFCP_STATUS_COMMON_ERP_FAILED ) \return sprintf (buf,"1\n" ); \
@@ -99,12 +97,11 @@ static ssize_t zfcp_sysfs_##_feat##_failstruct device_attribute *attr,\ const char *buf, size_t count)\ { \ - struct _feat_def *_feat = container_of(dev, struct _feat_def, \ - sysfs_device); \ + struct _feat_def *_feat = container_of(dev, struct _feat_def, dev); \unsigned long val; \int retval =0 ; \ \ -if (!(_feat &&get_device (&_feat->sysfs_device))) \ +if (!(_feat &&get_device (&_feat->dev))) \return -EBUSY ; \ \if (strict_strtoul (buf,0 , &val) || val !=0 ) { \
@@ -118,7 +115,7 @@ static ssize_t zfcp_sysfs_##_feat##_fail _reopen_id, NULL); \zfcp_erp_wait (_adapter); \ out: \ -put_device (&_feat->sysfs_device); \ +put_device (&_feat->dev); \return retval ? retval : (ssize_t ) count; \ } \ static ZFCP_DEV_ATTR(_feat, failed, S_IWUSR | S_IRUGO, \
@@ -224,10 +221,10 @@ static ssize_t zfcp_sysfs_port_remove_stlist_del (&port->list);write_unlock_irq (&adapter->port_list_lock); -put_device (&port->sysfs_device); +put_device (&port->dev);zfcp_erp_port_shutdown (port,0 ,"syprs_1" ,NULL ); -zfcp_device_unregister (&port->sysfs_device, &zfcp_sysfs_port_attrs); +zfcp_device_unregister (&port->dev, &zfcp_sysfs_port_attrs); out:zfcp_ccw_adapter_put (adapter);return retval ? retval : (ssize_t ) count;
@@ -258,13 +255,12 @@ static ssize_t zfcp_sysfs_unit_add_storestruct device_attribute *attr, const char *buf, size_t count) { - struct zfcp_port *port = container_of(dev, struct zfcp_port, - sysfs_device); + struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);struct zfcp_unit *unit;u64 fcp_lun;int retval = -EINVAL ; -if (!(port &&get_device (&port->sysfs_device))) +if (!(port &&get_device (&port->dev)))return -EBUSY ;if (strict_strtoull (buf,0 , (unsigned long long *) &fcp_lun))
@@ -280,7 +276,7 @@ static ssize_t zfcp_sysfs_unit_add_storezfcp_erp_wait (unit->port->adapter);flush_work (&unit->scsi_work); out: -put_device (&port->sysfs_device); +put_device (&port->dev);return retval ? retval : (ssize_t ) count; } static DEVICE_ATTR(unit_add, S_IWUSR, NULL, zfcp_sysfs_unit_add_store);
@@ -289,13 +285,12 @@ static ssize_t zfcp_sysfs_unit_remove_ststruct device_attribute *attr, const char *buf, size_t count) { - struct zfcp_port *port = container_of(dev, struct zfcp_port, - sysfs_device); + struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);struct zfcp_unit *unit;u64 fcp_lun;int retval = -EINVAL ; -if (!(port &&get_device (&port->sysfs_device))) +if (!(port &&get_device (&port->dev)))return -EBUSY ;if (strict_strtoull (buf,0 , (unsigned long long *) &fcp_lun))
@@ -314,12 +309,12 @@ static ssize_t zfcp_sysfs_unit_remove_stlist_del (&unit->list);write_unlock_irq (&port->unit_list_lock); -put_device (&unit->sysfs_device); +put_device (&unit->dev);zfcp_erp_unit_shutdown (unit,0 ,"syurs_1" ,NULL ); -zfcp_device_unregister (&unit->sysfs_device, &zfcp_sysfs_unit_attrs); +zfcp_device_unregister (&unit->dev, &zfcp_sysfs_unit_attrs); out: -put_device (&port->sysfs_device); +put_device (&port->dev);return retval ? retval : (ssize_t ) count; } static DEVICE_ATTR(unit_remove, S_IWUSR, NULL, zfcp_sysfs_unit_remove_store);
PATCH 9/11 zfcp: Move scsi result tracing decision to zfcp_dbf.h
In reply to Christof SchmittFrom: Christof Schmitt <[email protected]>
Move the decision which trace tag and trace level to use for the scsi result trace to zfcp_dbf.h. zfcp_dbf_scsi_result is already an inline function, so move the trace code there, simplifying the response handling in zfcp_fsf.c.
---
drivers/s390/scsi/zfcp_dbf.h | 28 +++++++++++++++++++++------- drivers/s390/scsi/zfcp_fsf.c | 7 +------ drivers/s390/scsi/zfcp_scsi.c | 4 ++-- 3 files changed, 24 insertions(+), 15 deletions(-)
drivers/s390/scsi/zfcp_dbf.h +21 -7
@@ -303,17 +303,31 @@ void zfcp_dbf_scsi(const char *tag, cons/** * zfcp_dbf_scsi_result - trace event for SCSI command completion -* @tag: tag indicating success or failure of SCSI command -* @level: trace level applicable for this event -* @adapter: adapter that has been used to issue the SCSI command +* @dbf: adapter dbf trace * @scmd: SCSI command pointer -* @fsf_req: request used to issue SCSI command (might be NULL) +* @req: FSF request used to issue SCSI command */ static inline -void zfcp_dbf_scsi_result (const char *tag,int level,struct zfcp_dbf *dbf, -struct scsi_cmnd *scmd,struct zfcp_fsf_req *fsf_req) +void zfcp_dbf_scsi_result (struct zfcp_dbf *dbf,struct scsi_cmnd *scmd, +struct zfcp_fsf_req *req) { -zfcp_dbf_scsi ("rslt" , tag, level, dbf, scmd, fsf_req,0 ); +if (scmd->result !=0 ) +zfcp_dbf_scsi ("rslt" ,"erro" ,3 , dbf, scmd, req,0 ); +else if (scmd->retries >0 ) +zfcp_dbf_scsi ("rslt" ,"retr" ,4 , dbf, scmd, req,0 ); +else +zfcp_dbf_scsi ("rslt" ,"norm" ,6 , dbf, scmd, req,0 ); +} + +/** +* zfcp_dbf_scsi_fail_send - trace event for failure to send SCSI command +* @dbf: adapter dbf trace +* @scmd: SCSI command pointer +*/ +static inline +void zfcp_dbf_scsi_fail_send (struct zfcp_dbf *dbf,struct scsi_cmnd *scmd) +{ +zfcp_dbf_scsi ("rslt" ,"fail" ,4 , dbf, scmd,NULL ,0 ); }/**
drivers/s390/scsi/zfcp_fsf.c +1 -6
@@ -2156,12 +2156,7 @@ static void zfcp_fsf_send_fcp_command_tazfcp_fsf_req_trace (req, scpnt); skip_fsfstatus: -if (scpnt->result !=0 ) -zfcp_dbf_scsi_result ("erro" ,3 , req->adapter->dbf, scpnt, req); -else if (scpnt->retries >0 ) -zfcp_dbf_scsi_result ("retr" ,4 , req->adapter->dbf, scpnt, req); -else -zfcp_dbf_scsi_result ("norm" ,6 , req->adapter->dbf, scpnt, req); +zfcp_dbf_scsi_result (req->adapter->dbf, scpnt, req); scpnt->host_scribble =NULL ; (scpnt->scsi_done) (scpnt);
drivers/s390/scsi/zfcp_scsi.c +2 -2
@@ -62,7 +62,7 @@ static void zfcp_scsi_command_fail(struc (struct zfcp_adapter *) scpnt->device->host->hostdata[0 ];set_host_byte (scpnt, result); -zfcp_dbf_scsi_result ("fail" ,4 , adapter->dbf, scpnt,NULL ); +zfcp_dbf_scsi_fail_send (adapter->dbf, scpnt); scpnt->scsi_done (scpnt); }
@@ -89,7 +89,7 @@ static int zfcp_scsi_queuecommand(struct scsi_result =fc_remote_port_chkready (rport);if (unlikely (scsi_result)) { scpnt->result = scsi_result; -zfcp_dbf_scsi_result ("fail" ,4 , adapter->dbf, scpnt,NULL ); +zfcp_dbf_scsi_fail_send (adapter->dbf, scpnt); scpnt->scsi_done (scpnt);return 0 ; }
PATCH 10/11 zfcp: Replace FC4 constants with information from exchange port
In reply to Christof SchmittFrom: Christof Schmitt <[email protected]>
The FC4 types are already available from exchange port. Use this for reporting the FC4 types, instead of having the value hardcoded in zfcp.
---
drivers/s390/scsi/zfcp_fsf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/s390/scsi/zfcp_fsf.c +4 -2
@@ -491,8 +491,6 @@ static int zfcp_fsf_exchange_config_evalfc_host_port_id (shost) =ntoh24 (bottom->s_id);fc_host_speed (shost) = bottom->fc_link_speed;fc_host_supported_classes (shost) =FC_COS_CLASS2 |FC_COS_CLASS3 ; -fc_host_supported_fc4s (shost)[2 ] =1 ;/* FCP */ -fc_host_active_fc4s (shost)[2 ] =1 ;/* FCP */ adapter->hydra_version = bottom->adapter_type; adapter->timer_ticks = bottom->timer_interval;
@@ -615,6 +613,10 @@ static void zfcp_fsf_exchange_port_evalufc_host_permanent_port_name (shost) =fc_host_port_name (shost);fc_host_maxframe_size (shost) = bottom->maximum_frame_size;fc_host_supported_speeds (shost) = bottom->supported_speed; +memcpy (fc_host_supported_fc4s (shost), bottom->supported_fc4_types, +FC_FC4_LIST_SIZE ); +memcpy (fc_host_active_fc4s (shost), bottom->active_fc4_types, +FC_FC4_LIST_SIZE ); }static void zfcp_fsf_exchange_port_data_handler (struct zfcp_fsf_req *req)
PATCH 11/11 zfcp: Introduce header file for qdio structs and inline functions
In reply to Christof SchmittFrom: Christof Schmitt <[email protected]>
Move the qdio related structs and some helper functions to a new zfcp_qdio.h header file. While doing this, rename the struct zfcp_queue_req to zfcp_qdio_req to adhere to the naming scheme used in zfcp. This allows a better seperation of the qdio code and inlining the helper functions will save some function calls.
---
drivers/s390/scsi/zfcp_dbf.c | 6 +- drivers/s390/scsi/zfcp_def.h | 57 +-------------------- drivers/s390/scsi/zfcp_ext.h | 8 --- drivers/s390/scsi/zfcp_fsf.c | 71 +++++++++++++-------------- drivers/s390/scsi/zfcp_qdio.c | 48 +++--------------- drivers/s390/scsi/zfcp_qdio.h | 109 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 162 insertions(+), 137 deletions(-)
drivers/s390/scsi/zfcp_dbf.c +3 -3
@@ -140,9 +140,9 @@ void _zfcp_dbf_hba_fsf_response(const chmemcpy (response->fsf_status_qual, fsf_status_qual,FSF_STATUS_QUALIFIER_SIZE ); response->fsf_req_status = fsf_req->status; - response->sbal_first = fsf_req->queue_req.sbal_first; - response->sbal_last = fsf_req->queue_req.sbal_last; - response->sbal_response = fsf_req->queue_req.sbal_response; + response->sbal_first = fsf_req->qdio_req.sbal_first; + response->sbal_last = fsf_req->qdio_req.sbal_last; + response->sbal_response = fsf_req->qdio_req.sbal_response; response->pool = fsf_req->pool !=NULL ; response->erp_action = (unsigned long )fsf_req->erp_action;
drivers/s390/scsi/zfcp_def.h +3 -54
95 lines not on this page · raw message
drivers/s390/scsi/zfcp_ext.h +2 -6
@@ -143,13 +143,9 @@ extern void zfcp_fsf_reqid_check(struct/* zfcp_qdio.c */ extern int zfcp_qdio_setup (struct zfcp_adapter *);extern void zfcp_qdio_destroy (struct zfcp_qdio *); -extern int zfcp_qdio_send (struct zfcp_qdio *,struct zfcp_queue_req *); -extern struct qdio_buffer_element - *zfcp_qdio_sbale_req (struct zfcp_qdio *,struct zfcp_queue_req *); -extern struct qdio_buffer_element - *zfcp_qdio_sbale_curr (struct zfcp_qdio *,struct zfcp_queue_req *); +extern int zfcp_qdio_send (struct zfcp_qdio *,struct zfcp_qdio_req *);extern int zfcp_qdio_sbals_from_sg (struct zfcp_qdio *, -struct zfcp_queue_req *,unsigned long , +struct zfcp_qdio_req *,unsigned long ,struct scatterlist *,int );extern int zfcp_qdio_open (struct zfcp_qdio *);extern void zfcp_qdio_close (struct zfcp_qdio *);
drivers/s390/scsi/zfcp_fsf.c +36 -35
233 lines not on this page · raw message
drivers/s390/scsi/zfcp_qdio.c +9 -39
105 lines not on this page · raw message
drivers/s390/scsi/zfcp_qdio.h +109 -0
109 lines not on this page · raw message