summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@steeleye.com>2005-11-08 09:21:07 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2005-11-09 09:31:46 -0500
commitc0ed79a331caa68ac027dd6afc02bb5b58ef2798 (patch)
tree5c04d3ac7c7d5d0e98e2ee6858a124dd27ea922c /drivers/scsi/sd.c
parent2ef8919830a262f10fb5e4a685e95f71a64bce6c (diff)
downloadlinux-c0ed79a331caa68ac027dd6afc02bb5b58ef2798.tar.bz2
[SCSI] sd: fix issue_flush
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>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c22
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)
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)