rq->rq_flags |= RQF_QUIET;
blk_execute_rq(rq, false);
- if (scsi_req(rq)->result)
+ if (scmd->result)
ret = -EIO;
out:
blk_mq_free_request(rq);
static int scsi_bsg_sg_io_fn(struct request_queue *q, struct sg_io_v4 *hdr,
fmode_t mode, unsigned int timeout)
{
- struct scsi_request *sreq;
struct scsi_cmnd *scmd;
struct request *rq;
struct bio *bio;
rq->timeout = timeout;
ret = -ENOMEM;
- sreq = scsi_req(rq);
scmd = blk_mq_rq_to_pdu(rq);
scmd->cmd_len = hdr->request_len;
if (scmd->cmd_len > sizeof(scmd->cmnd)) {
/*
* fill in all the output members
*/
- hdr->device_status = sreq->result & 0xff;
- hdr->transport_status = host_byte(sreq->result);
+ hdr->device_status = scmd->result & 0xff;
+ hdr->transport_status = host_byte(scmd->result);
hdr->driver_status = 0;
- if (scsi_status_is_check_condition(sreq->result))
+ if (scsi_status_is_check_condition(scmd->result))
hdr->driver_status = DRIVER_SENSE;
hdr->info = 0;
if (hdr->device_status || hdr->transport_status || hdr->driver_status)
struct bio *bio)
{
struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(rq);
- struct scsi_request *req = scsi_req(rq);
int r, ret = 0;
/*
* fill in all the output members
*/
- hdr->status = req->result & 0xff;
- hdr->masked_status = status_byte(req->result);
+ hdr->status = scmd->result & 0xff;
+ hdr->masked_status = status_byte(scmd->result);
hdr->msg_status = COMMAND_COMPLETE;
- hdr->host_status = host_byte(req->result);
+ hdr->host_status = host_byte(scmd->result);
hdr->driver_status = 0;
if (scsi_status_is_check_condition(hdr->status))
hdr->driver_status = DRIVER_SENSE;
blk_execute_rq(rq, false);
- err = req->result & 0xff; /* only 8 bit SCSI status */
+ err = scmd->result & 0xff; /* only 8 bit SCSI status */
if (err) {
if (scmd->sense_len && scmd->sense_buffer) {
/* limit sense len for backward compatibility */
if (sshdr)
scsi_normalize_sense(scmd->sense_buffer, scmd->sense_len,
sshdr);
- ret = rq->result;
+ ret = scmd->result;
out:
blk_mq_free_request(req);
if (unlikely(result)) /* a nz result may or may not be an error */
result = scsi_io_completion_nz_result(cmd, result, &blk_stat);
- if (unlikely(blk_rq_is_passthrough(req))) {
- /*
- * scsi_result_to_blk_status may have reset the host_byte
- */
- scsi_req(req)->result = cmd->result;
- }
-
/*
* Next deal with any sectors which we were able to correctly
* handle.
ret = BLK_STS_DEV_RESOURCE;
break;
case BLK_STS_AGAIN:
- scsi_req(req)->result = DID_BUS_BUSY << 16;
+ cmd->result = DID_BUS_BUSY << 16;
if (req->rq_flags & RQF_DONTPREP)
scsi_mq_uninit_cmd(cmd);
break;
default:
if (unlikely(!scsi_device_online(sdev)))
- scsi_req(req)->result = DID_NO_CONNECT << 16;
+ cmd->result = DID_NO_CONNECT << 16;
else
- scsi_req(req)->result = DID_ERROR << 16;
+ cmd->result = DID_ERROR << 16;
/*
* Make sure to release all allocated resources when
* we hit an error, as we will never see this command
{
struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(rq);
struct sg_request *srp = rq->end_io_data;
- struct scsi_request *req = scsi_req(rq);
Sg_device *sdp;
Sg_fd *sfp;
unsigned long iflags;
pr_info("%s: device detaching\n", __func__);
sense = scmd->sense_buffer;
- result = req->result;
+ result = scmd->result;
resid = scmd->resid_len;
SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sdp,
bio = rq->bio;
blk_execute_rq(rq, false);
- if (scsi_req(rq)->result) {
+ if (scmd->result) {
struct scsi_sense_hdr sshdr;
scsi_normalize_sense(scmd->sense_buffer, scmd->sense_len,
atomic64_add(ktime_to_ns(now), &STp->stats->tot_write_time);
atomic64_add(ktime_to_ns(now), &STp->stats->tot_io_time);
atomic64_inc(&STp->stats->write_cnt);
- if (scsi_req(req)->result) {
+ if (scmd->result) {
atomic64_add(atomic_read(&STp->stats->last_write_size)
- STp->buffer->cmdstat.residual,
&STp->stats->write_byte_cnt);
atomic64_add(ktime_to_ns(now), &STp->stats->tot_read_time);
atomic64_add(ktime_to_ns(now), &STp->stats->tot_io_time);
atomic64_inc(&STp->stats->read_cnt);
- if (scsi_req(req)->result) {
+ if (scmd->result) {
atomic64_add(atomic_read(&STp->stats->last_read_size)
- STp->buffer->cmdstat.residual,
&STp->stats->read_byte_cnt);
{
struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(req);
struct st_request *SRpnt = req->end_io_data;
- struct scsi_request *rq = scsi_req(req);
struct scsi_tape *STp = SRpnt->stp;
struct bio *tmp;
- STp->buffer->cmdstat.midlevel_result = SRpnt->result = rq->result;
+ STp->buffer->cmdstat.midlevel_result = SRpnt->result = scmd->result;
STp->buffer->cmdstat.residual = scmd->resid_len;
st_do_stats(STp, req);
{
struct se_cmd *cmd = req->end_io_data;
struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(req);
- int result = scsi_req(req)->result;
- enum sam_status scsi_status = result & 0xff;
+ enum sam_status scsi_status = scmd->result & 0xff;
u8 *cdb = cmd->priv;
if (scsi_status != SAM_STAT_GOOD) {
pr_debug("PSCSI Status Byte exception at cmd: %p CDB:"
- " 0x%02x Result: 0x%08x\n", cmd, cdb[0], result);
+ " 0x%02x Result: 0x%08x\n", cmd, cdb[0], scmd->result);
}
pscsi_complete_cmd(cmd, scsi_status, scmd->sense_buffer);
- switch (host_byte(result)) {
+ switch (host_byte(scmd->result)) {
case DID_OK:
target_complete_cmd_with_length(cmd, scsi_status,
cmd->data_length - scmd->resid_len);
break;
default:
pr_debug("PSCSI Host Byte exception at cmd: %p CDB:"
- " 0x%02x Result: 0x%08x\n", cmd, cdb[0], result);
+ " 0x%02x Result: 0x%08x\n", cmd, cdb[0], scmd->result);
target_complete_cmd(cmd, SAM_STAT_CHECK_CONDITION);
break;
}
#include <linux/blk-mq.h>
struct scsi_request {
- int result;
int retries;
};