diff options
author | Steffen Maier <maier@linux.ibm.com> | 2018-11-08 15:44:45 +0100 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-11-15 15:01:17 -0500 |
commit | f9eca022760079c0556cb311e3aa9091a3921a31 (patch) | |
tree | 95242c128b66bf465f03c7f6ebfe913b5b2c425b /drivers/s390/scsi/zfcp_def.h | |
parent | 2c53d8a0cce4f8490a1829867930b519e65db2b4 (diff) | |
download | lwn-f9eca022760079c0556cb311e3aa9091a3921a31.tar.gz lwn-f9eca022760079c0556cb311e3aa9091a3921a31.zip |
scsi: zfcp: drop duplicate fsf_command from zfcp_fsf_req which is also in QTCB header
Status read buffers (SRBs, unsolicited notifications) never use a QTCB
[zfcp_fsf_req_create()]. zfcp_fsf_req_send() already uses this to
distinguish SRBs from other FSF request types. We can re-use this method in
zfcp_fsf_req_complete(). Introduce a helper function to make the check for
req->qtcb less magic.
SRBs always are FSF_QTCB_UNSOLICITED_STATUS, so we can hard-code this for
the two trace functions dealing with SRBs.
All other FSF request types have a QTCB and we can get the fsf_command from
there.
zfcp_dbf_hba_fsf_response() and thus zfcp_dbf_hba_fsf_res() are only called
for non-SRB requests so it's safe to dereference the QTCB
[zfcp_fsf_req_complete() returns early on SRB, else calls
zfcp_fsf_protstatus_eval() which calls zfcp_dbf_hba_fsf_response()]. In
zfcp_scsi_forget_cmnd() we guard the QTCB dereference with a preceding NULL
check and rely on boolean shortcut evaluation.
As a side effect, this causes an alignment hole which we can close in
a later patch after having cleaned up all fields of struct zfcp_fsf_req.
Before:
$ pahole -C zfcp_fsf_req drivers/s390/scsi/zfcp.ko
...
u32 status; /* 136 4 */
u32 fsf_command; /* 140 4 */
struct fsf_qtcb * qtcb; /* 144 8 */
...
After:
$ pahole -C zfcp_fsf_req drivers/s390/scsi/zfcp.ko
...
u32 status; /* 136 4 */
/* XXX 4 bytes hole, try to pack */
struct fsf_qtcb * qtcb; /* 144 8 */
...
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/s390/scsi/zfcp_def.h')
-rw-r--r-- | drivers/s390/scsi/zfcp_def.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h index 572debf2f528..d65adb0ae9f1 100644 --- a/drivers/s390/scsi/zfcp_def.h +++ b/drivers/s390/scsi/zfcp_def.h @@ -277,7 +277,6 @@ static inline u64 zfcp_scsi_dev_lun(struct scsi_device *sdev) * @qdio_req: qdio queue related values * @completion: used to signal the completion of the request * @status: status of the request - * @fsf_command: FSF command issued * @qtcb: associated QTCB * @seq_no: sequence number of this request * @data: private data @@ -294,7 +293,6 @@ struct zfcp_fsf_req { struct zfcp_qdio_req qdio_req; struct completion completion; u32 status; - u32 fsf_command; struct fsf_qtcb *qtcb; u32 seq_no; void *data; @@ -311,4 +309,9 @@ int zfcp_adapter_multi_buffer_active(struct zfcp_adapter *adapter) return atomic_read(&adapter->status) & ZFCP_STATUS_ADAPTER_MB_ACT; } +static inline bool zfcp_fsf_req_is_status_read_buffer(struct zfcp_fsf_req *req) +{ + return req->qtcb == NULL; +} + #endif /* ZFCP_DEF_H */ |