diff options
author | James Bottomley <James.Bottomley@steeleye.com> | 2007-08-03 16:41:11 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-08-04 08:37:04 -0500 |
commit | 03a5743a12b58e10eaa936a02498539db645ba4e (patch) | |
tree | dd3d80da57e3efd26a60f4d369224b41b7008947 /drivers/scsi | |
parent | 66dbfbe6fde35c881deda5cebb6ecaa0dcc1c975 (diff) |
[SCSI] sd: disentangle barriers in SCSI
Our current implementation has a generic set of barrier functions that
go through the SCSI driver model. Realistically, this is unnecessary,
because the only device that can use barriers (sd) can set the flush
functions up at probe or revalidate time. This patch pulls the barrier
functions out of the mid layer and scsi driver model and relocates them
directly in sd.
Acked-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/scsi_lib.c | 17 | ||||
-rw-r--r-- | drivers/scsi/sd.c | 14 |
2 files changed, 11 insertions, 20 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 21c075d44db1..a417a6ff9f97 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1038,22 +1038,6 @@ static int scsi_init_io(struct scsi_cmnd *cmd) return BLKPREP_KILL; } -static int scsi_issue_flush_fn(struct request_queue *q, struct gendisk *disk, - sector_t *error_sector) -{ - struct scsi_device *sdev = q->queuedata; - struct scsi_driver *drv; - - if (sdev->sdev_state != SDEV_RUNNING) - return -ENXIO; - - drv = *(struct scsi_driver **) disk->private_data; - if (drv->issue_flush) - return drv->issue_flush(&sdev->sdev_gendev, error_sector); - - return -EOPNOTSUPP; -} - static struct scsi_cmnd *scsi_get_cmd_from_req(struct scsi_device *sdev, struct request *req) { @@ -1596,7 +1580,6 @@ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev) return NULL; blk_queue_prep_rq(q, scsi_prep_fn); - blk_queue_issue_flush_fn(q, scsi_issue_flush_fn); blk_queue_softirq_done(q, scsi_softirq_done); return q; } 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 = { }, .rescan = sd_rescan, .init_command = sd_init_command, - .issue_flush = sd_issue_flush, }; /* @@ -800,10 +799,17 @@ static int sd_sync_cache(struct scsi_disk *sdkp) return 0; } -static int sd_issue_flush(struct device *dev, sector_t *error_sector) +static int sd_issue_flush(struct request_queue *q, struct gendisk *disk, + sector_t *error_sector) { int ret = 0; - struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); + struct scsi_device *sdp = q->queuedata; + struct scsi_disk *sdkp; + + if (sdp->sdev_state != SDEV_RUNNING) + return -ENXIO; + + sdkp = scsi_disk_get_from_dev(&sdp->sdev_gendev); if (!sdkp) return -ENODEV; @@ -1663,6 +1669,8 @@ static int sd_probe(struct device *dev) sd_revalidate_disk(gd); + blk_queue_issue_flush_fn(sdp->request_queue, sd_issue_flush); + gd->driverfs_dev = &sdp->sdev_gendev; gd->flags = GENHD_FL_DRIVERFS; if (sdp->removable) |