ide: set REQ_PREEMPT request flag in ide_do_drive_cmd() users
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Tue, 15 Jul 2008 19:21:41 +0000 (21:21 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Tue, 15 Jul 2008 19:21:41 +0000 (21:21 +0200)
* Set REQ_PREEMPT request flag in ide_do_drive_cmd() users
  for ide_preempt and ide_head_wait action types.

* Remove setting REQ_PREEMPT from ide_do_drive_cmd().

While at it:

* Set 'where' variable outside ide_lock.

This is a preparation for converting IDE to use blk_execute_rq().

There should be no functional changes caused by this patch.

Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-cd.c
drivers/ide/ide-floppy.c
drivers/ide/ide-io.c
drivers/ide/ide-tape.c
drivers/ide/ide.c
drivers/scsi/ide-scsi.c

index 68e7f19dc03662b405363ca23bf0081db73baa4a..ff8815937d32862f4b60a88d6a7459cbc0559667 100644 (file)
@@ -216,6 +216,7 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense,
        rq->data_len = 18;
 
        rq->cmd_type = REQ_TYPE_SENSE;
+       rq->cmd_flags |= REQ_PREEMPT;
 
        /* NOTE! Save the failed command in "rq->buffer" */
        rq->buffer = (void *) failed_command;
index f05fbc2bd7a89ac597c1261acfc143f6df21d173..7d75240c2e2643070e515abe9d27d66867c28cbd 100644 (file)
@@ -289,6 +289,7 @@ static void idefloppy_queue_pc_head(ide_drive_t *drive, struct ide_atapi_pc *pc,
        ide_init_drive_cmd(rq);
        rq->buffer = (char *) pc;
        rq->cmd_type = REQ_TYPE_SPECIAL;
+       rq->cmd_flags |= REQ_PREEMPT;
        rq->rq_disk = floppy->disk;
        (void) ide_do_drive_cmd(drive, rq, ide_preempt);
 }
index 696525342e9a56977c1d2ac88d72497be5a7e866..5aed79ed458661cfacd5e60d505e3aff39f458b3 100644 (file)
@@ -1600,13 +1600,12 @@ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t actio
                rq->end_io = blk_end_sync_rq;
        }
 
+       if (action == ide_preempt || action == ide_head_wait)
+               where = ELEVATOR_INSERT_FRONT;
+
        spin_lock_irqsave(&ide_lock, flags);
        if (action == ide_preempt)
                hwgroup->rq = NULL;
-       if (action == ide_preempt || action == ide_head_wait) {
-               where = ELEVATOR_INSERT_FRONT;
-               rq->cmd_flags |= REQ_PREEMPT;
-       }
        __elv_add_request(drive->queue, rq, where, 0);
        ide_do_request(hwgroup, IDE_NO_IRQ);
        spin_unlock_irqrestore(&ide_lock, flags);
index 1a96cc50399443dea54531ba4ba981361dfb6726..d67a17891786c3aad0a00a079141cce011b7652e 100644 (file)
@@ -688,6 +688,7 @@ static void idetape_queue_pc_head(ide_drive_t *drive, struct ide_atapi_pc *pc,
        struct ide_tape_obj *tape = drive->driver_data;
 
        idetape_init_rq(rq, REQ_IDETAPE_PC1);
+       rq->cmd_flags |= REQ_PREEMPT;
        rq->buffer = (char *) pc;
        rq->rq_disk = tape->disk;
        (void) ide_do_drive_cmd(drive, rq, ide_preempt);
index 300431d080a97310ca829beff00f8b7dd49bb3aa..c9a05721360e2341a6aa12fe48488854c6fd78ed 100644 (file)
@@ -606,6 +606,7 @@ static int generic_ide_resume(struct device *dev)
        memset(&rqpm, 0, sizeof(rqpm));
        memset(&args, 0, sizeof(args));
        rq.cmd_type = REQ_TYPE_PM_RESUME;
+       rq.cmd_flags |= REQ_PREEMPT;
        rq.special = &args;
        rq.data = &rqpm;
        rqpm.pm_step = ide_pm_state_start_resume;
index 44d8d5163a1a357e2e4a41b22544f28df25823ce..89ecf013219105488950a1d9505919ab0032f393 100644 (file)
@@ -235,6 +235,7 @@ static int idescsi_check_condition(ide_drive_t *drive,
        pc->c[0] = REQUEST_SENSE;
        pc->c[4] = pc->req_xfer = pc->buf_size = SCSI_SENSE_BUFFERSIZE;
        rq->cmd_type = REQ_TYPE_SENSE;
+       rq->cmd_flags |= REQ_PREEMPT;
        pc->timeout = jiffies + WAIT_READY;
        /* NOTE! Save the failed packet command in "rq->buffer" */
        rq->buffer = (void *) failed_cmd->special;