aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-disk.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-disk.c')
-rw-r--r--drivers/ide/ide-disk.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 33d65039cce9..7433e07de30e 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -184,7 +184,7 @@ static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
184 ide_hwif_t *hwif = drive->hwif; 184 ide_hwif_t *hwif = drive->hwif;
185 185
186 BUG_ON(drive->dev_flags & IDE_DFLAG_BLOCKED); 186 BUG_ON(drive->dev_flags & IDE_DFLAG_BLOCKED);
187 BUG_ON(!blk_fs_request(rq)); 187 BUG_ON(rq->cmd_type != REQ_TYPE_FS);
188 188
189 ledtrig_ide_activity(); 189 ledtrig_ide_activity();
190 190
@@ -427,10 +427,15 @@ static void ide_disk_unlock_native_capacity(ide_drive_t *drive)
427 drive->dev_flags |= IDE_DFLAG_NOHPA; /* disable HPA on resume */ 427 drive->dev_flags |= IDE_DFLAG_NOHPA; /* disable HPA on resume */
428} 428}
429 429
430static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) 430static int idedisk_prep_fn(struct request_queue *q, struct request *rq)
431{ 431{
432 ide_drive_t *drive = q->queuedata; 432 ide_drive_t *drive = q->queuedata;
433 struct ide_cmd *cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC); 433 struct ide_cmd *cmd;
434
435 if (!(rq->cmd_flags & REQ_FLUSH))
436 return BLKPREP_OK;
437
438 cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC);
434 439
435 /* FIXME: map struct ide_taskfile on rq->cmd[] */ 440 /* FIXME: map struct ide_taskfile on rq->cmd[] */
436 BUG_ON(cmd == NULL); 441 BUG_ON(cmd == NULL);
@@ -448,6 +453,8 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
448 rq->cmd_type = REQ_TYPE_ATA_TASKFILE; 453 rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
449 rq->special = cmd; 454 rq->special = cmd;
450 cmd->rq = rq; 455 cmd->rq = rq;
456
457 return BLKPREP_OK;
451} 458}
452 459
453ide_devset_get(multcount, mult_count); 460ide_devset_get(multcount, mult_count);
@@ -513,7 +520,6 @@ static void update_ordered(ide_drive_t *drive)
513{ 520{
514 u16 *id = drive->id; 521 u16 *id = drive->id;
515 unsigned ordered = QUEUE_ORDERED_NONE; 522 unsigned ordered = QUEUE_ORDERED_NONE;
516 prepare_flush_fn *prep_fn = NULL;
517 523
518 if (drive->dev_flags & IDE_DFLAG_WCACHE) { 524 if (drive->dev_flags & IDE_DFLAG_WCACHE) {
519 unsigned long long capacity; 525 unsigned long long capacity;
@@ -538,12 +544,12 @@ static void update_ordered(ide_drive_t *drive)
538 544
539 if (barrier) { 545 if (barrier) {
540 ordered = QUEUE_ORDERED_DRAIN_FLUSH; 546 ordered = QUEUE_ORDERED_DRAIN_FLUSH;
541 prep_fn = idedisk_prepare_flush; 547 blk_queue_prep_rq(drive->queue, idedisk_prep_fn);
542 } 548 }
543 } else 549 } else
544 ordered = QUEUE_ORDERED_DRAIN; 550 ordered = QUEUE_ORDERED_DRAIN;
545 551
546 blk_queue_ordered(drive->queue, ordered, prep_fn); 552 blk_queue_ordered(drive->queue, ordered);
547} 553}
548 554
549ide_devset_get_flag(wcache, IDE_DFLAG_WCACHE); 555ide_devset_get_flag(wcache, IDE_DFLAG_WCACHE);