diff options
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r-- | drivers/scsi/sd.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index bb5b242ac6b4..8613a1317712 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -769,20 +769,16 @@ static void sd_end_flush(request_queue_t *q, struct request *flush_rq) | |||
769 | static int sd_prepare_flush(request_queue_t *q, struct request *rq) | 769 | static int sd_prepare_flush(request_queue_t *q, struct request *rq) |
770 | { | 770 | { |
771 | struct scsi_device *sdev = q->queuedata; | 771 | struct scsi_device *sdev = q->queuedata; |
772 | struct scsi_disk *sdkp = scsi_disk_get_from_dev(&sdev->sdev_gendev); | 772 | struct scsi_disk *sdkp = dev_get_drvdata(&sdev->sdev_gendev); |
773 | int ret = 0; | ||
774 | 773 | ||
775 | if (sdkp) { | 774 | if (!sdkp || !sdkp->WCE) |
776 | if (sdkp->WCE) { | 775 | return 0; |
777 | memset(rq->cmd, 0, sizeof(rq->cmd)); | 776 | |
778 | rq->flags |= REQ_BLOCK_PC | REQ_SOFTBARRIER; | 777 | memset(rq->cmd, 0, sizeof(rq->cmd)); |
779 | rq->timeout = SD_TIMEOUT; | 778 | rq->flags |= REQ_BLOCK_PC | REQ_SOFTBARRIER; |
780 | rq->cmd[0] = SYNCHRONIZE_CACHE; | 779 | rq->timeout = SD_TIMEOUT; |
781 | ret = 1; | 780 | rq->cmd[0] = SYNCHRONIZE_CACHE; |
782 | } | 781 | return 1; |
783 | scsi_disk_put(sdkp); | ||
784 | } | ||
785 | return ret; | ||
786 | } | 782 | } |
787 | 783 | ||
788 | static void sd_rescan(struct device *dev) | 784 | static void sd_rescan(struct device *dev) |