update scsi_wait_req to new format for blk_rq_map_kern()
authorJames Bottomley <jejb@titanic.(none)>
Wed, 15 Jun 2005 23:16:09 +0000 (18:16 -0500)
committerJames Bottomley <jejb@titanic.(none)>
Sun, 28 Aug 2005 15:46:39 +0000 (10:46 -0500)
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/scsi_lib.c

index 253c1a98d159cd897a18813272e70c9fb93fa36a..60f07b6a5ffc62ba7341448813175bb49c3a97bd 100644 (file)
@@ -246,15 +246,18 @@ void scsi_wait_req(struct scsi_request *sreq, const void *cmnd, void *buffer,
                   unsigned bufflen, int timeout, int retries)
 {
        DECLARE_COMPLETION(wait);
+       int write = sreq->sr_data_direction == DMA_TO_DEVICE;
        struct request *req;
 
-       if (bufflen)
-               req = blk_rq_map_kern(sreq->sr_device->request_queue,
-                                     sreq->sr_data_direction == DMA_TO_DEVICE,
-                                     buffer, bufflen, __GFP_WAIT);
-       else
-               req = blk_get_request(sreq->sr_device->request_queue, READ,
-                                     __GFP_WAIT);
+       req = blk_get_request(sreq->sr_device->request_queue, write,
+                             __GFP_WAIT);
+       if (bufflen && blk_rq_map_kern(sreq->sr_device->request_queue, req,
+                                      buffer, bufflen, __GFP_WAIT)) {
+               sreq->sr_result = DRIVER_ERROR << 24;
+               blk_put_request(req);
+               return;
+       }
+
        req->flags |= REQ_NOMERGE;
        req->waiting = &wait;
        req->end_io = scsi_wait_req_end_io;