}
 
        if (rq_data_dir(rq) == READ)
-               hdr->din_resid = sreq->resid_len;
+               hdr->din_resid = scmd->resid_len;
        else
-               hdr->dout_resid = sreq->resid_len;
+               hdr->dout_resid = scmd->resid_len;
 
        blk_rq_unmap_user(bio);
 
 
        ses->data_direction = scmd->sc_data_direction;
        ses->sdb = scmd->sdb;
        ses->result = scmd->result;
-       ses->resid_len = scmd->req.resid_len;
+       ses->resid_len = scmd->resid_len;
        ses->underflow = scmd->underflow;
        ses->prot_op = scmd->prot_op;
        ses->eh_eflags = scmd->eh_eflags;
        memset(scmd->cmnd, 0, sizeof(scmd->cmnd));
        memset(&scmd->sdb, 0, sizeof(scmd->sdb));
        scmd->result = 0;
-       scmd->req.resid_len = 0;
+       scmd->resid_len = 0;
 
        if (sense_bytes) {
                scmd->sdb.length = min_t(unsigned, SCSI_SENSE_BUFFERSIZE,
        scmd->sc_data_direction = ses->data_direction;
        scmd->sdb = ses->sdb;
        scmd->result = ses->result;
-       scmd->req.resid_len = ses->resid_len;
+       scmd->resid_len = ses->resid_len;
        scmd->underflow = ses->underflow;
        scmd->prot_op = ses->prot_op;
        scmd->eh_eflags = ses->eh_eflags;
 
        hdr->info = 0;
        if (hdr->masked_status || hdr->host_status || hdr->driver_status)
                hdr->info |= SG_INFO_CHECK;
-       hdr->resid = req->resid_len;
+       hdr->resid = scmd->resid_len;
        hdr->sb_len_wr = 0;
 
        if (scmd->sense_len && hdr->sbp) {
 
         * is invalid.  Prevent the garbage from being misinterpreted
         * and prevent security leaks by zeroing out the excess data.
         */
-       if (unlikely(rq->resid_len > 0 && rq->resid_len <= bufflen))
-               memset(buffer + (bufflen - rq->resid_len), 0, rq->resid_len);
+       if (unlikely(scmd->resid_len > 0 && scmd->resid_len <= bufflen))
+               memset(buffer + bufflen - scmd->resid_len, 0, scmd->resid_len);
 
        if (resid)
-               *resid = rq->resid_len;
+               *resid = scmd->resid_len;
        if (sense && scmd->sense_len)
                memcpy(sense, scmd->sense_buffer, SCSI_SENSE_BUFFERSIZE);
        if (sshdr)
 
 
        sense = scmd->sense_buffer;
        result = req->result;
-       resid = req->resid_len;
+       resid = scmd->resid_len;
 
        SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sdp,
                                      "sg_cmd_done: pack_id=%d, res=0x%x\n",
 
        struct bio *tmp;
 
        STp->buffer->cmdstat.midlevel_result = SRpnt->result = rq->result;
-       STp->buffer->cmdstat.residual = rq->resid_len;
+       STp->buffer->cmdstat.residual = scmd->resid_len;
 
        st_do_stats(STp, req);
 
 
        switch (host_byte(result)) {
        case DID_OK:
                target_complete_cmd_with_length(cmd, scsi_status,
-                       cmd->data_length - scsi_req(req)->resid_len);
+                       cmd->data_length - scmd->resid_len);
                break;
        default:
                pr_debug("PSCSI Host Byte exception at cmd: %p CDB:"
 
                                   (ie, between disconnect / 
                                   reconnects.   Probably == sector
                                   size */
-
+       unsigned resid_len;     /* residual count */
        unsigned sense_len;
        unsigned char *sense_buffer;
                                /* obtained by REQUEST SENSE when
 
 static inline void scsi_set_resid(struct scsi_cmnd *cmd, unsigned int resid)
 {
-       cmd->req.resid_len = resid;
+       cmd->resid_len = resid;
 }
 
 static inline unsigned int scsi_get_resid(struct scsi_cmnd *cmd)
 {
-       return cmd->req.resid_len;
+       return cmd->resid_len;
 }
 
 #define scsi_for_each_sg(cmd, sg, nseg, __i)                   \
 
 
 struct scsi_request {
        int             result;
-       unsigned int    resid_len;      /* residual count */
        int             retries;
 };