]> err.no Git - linux-2.6/commitdiff
[SCSI] sd: fix issue_flush
authorJames Bottomley <James.Bottomley@steeleye.com>
Tue, 8 Nov 2005 14:21:07 +0000 (09:21 -0500)
committerJames Bottomley <jejb@mulgrave.(none)>
Wed, 9 Nov 2005 14:31:46 +0000 (09:31 -0500)
sd_issue_flush() is called from atomic context so we can't use the
semaphore based routines to get a reference to the scsi_disk.  Assume
something else already got the reference so we can safely use it.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/sd.c

index bb5b242ac6b497f8abf3e7cab9da6f1cfc296ebd..8613a1317712c9d40df22c26dc546d1c8b6aea28 100644 (file)
@@ -769,20 +769,16 @@ static void sd_end_flush(request_queue_t *q, struct request *flush_rq)
 static int sd_prepare_flush(request_queue_t *q, struct request *rq)
 {
        struct scsi_device *sdev = q->queuedata;
-       struct scsi_disk *sdkp = scsi_disk_get_from_dev(&sdev->sdev_gendev);
-       int ret = 0;
+       struct scsi_disk *sdkp = dev_get_drvdata(&sdev->sdev_gendev);
 
-       if (sdkp) {
-               if (sdkp->WCE) {
-                       memset(rq->cmd, 0, sizeof(rq->cmd));
-                       rq->flags |= REQ_BLOCK_PC | REQ_SOFTBARRIER;
-                       rq->timeout = SD_TIMEOUT;
-                       rq->cmd[0] = SYNCHRONIZE_CACHE;
-                       ret = 1;
-               }
-               scsi_disk_put(sdkp);
-       }
-       return ret;
+       if (!sdkp || !sdkp->WCE)
+               return 0;
+
+       memset(rq->cmd, 0, sizeof(rq->cmd));
+       rq->flags |= REQ_BLOCK_PC | REQ_SOFTBARRIER;
+       rq->timeout = SD_TIMEOUT;
+       rq->cmd[0] = SYNCHRONIZE_CACHE;
+       return 1;
 }
 
 static void sd_rescan(struct device *dev)