aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index e21c7142a3ea..2c6116fd4578 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -241,7 +241,6 @@ static struct scsi_driver sd_template = {
241 }, 241 },
242 .rescan = sd_rescan, 242 .rescan = sd_rescan,
243 .init_command = sd_init_command, 243 .init_command = sd_init_command,
244 .issue_flush = sd_issue_flush,
245}; 244};
246 245
247/* 246/*
@@ -800,10 +799,17 @@ static int sd_sync_cache(struct scsi_disk *sdkp)
800 return 0; 799 return 0;
801} 800}
802 801
803static int sd_issue_flush(struct device *dev, sector_t *error_sector) 802static int sd_issue_flush(struct request_queue *q, struct gendisk *disk,
803 sector_t *error_sector)
804{ 804{
805 int ret = 0; 805 int ret = 0;
806 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); 806 struct scsi_device *sdp = q->queuedata;
807 struct scsi_disk *sdkp;
808
809 if (sdp->sdev_state != SDEV_RUNNING)
810 return -ENXIO;
811
812 sdkp = scsi_disk_get_from_dev(&sdp->sdev_gendev);
807 813
808 if (!sdkp) 814 if (!sdkp)
809 return -ENODEV; 815 return -ENODEV;
@@ -1663,6 +1669,8 @@ static int sd_probe(struct device *dev)
1663 1669
1664 sd_revalidate_disk(gd); 1670 sd_revalidate_disk(gd);
1665 1671
1672 blk_queue_issue_flush_fn(sdp->request_queue, sd_issue_flush);
1673
1666 gd->driverfs_dev = &sdp->sdev_gendev; 1674 gd->driverfs_dev = &sdp->sdev_gendev;
1667 gd->flags = GENHD_FL_DRIVERFS; 1675 gd->flags = GENHD_FL_DRIVERFS;
1668 if (sdp->removable) 1676 if (sdp->removable)