diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/ide-disk.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index df3d91ba1c96..c22e6226e9e9 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -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 | ||
430 | static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) | 430 | static 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 | ||
453 | ide_devset_get(multcount, mult_count); | 460 | ide_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, NULL); |
547 | } | 553 | } |
548 | 554 | ||
549 | ide_devset_get_flag(wcache, IDE_DFLAG_WCACHE); | 555 | ide_devset_get_flag(wcache, IDE_DFLAG_WCACHE); |