提交 64ea1b4a 编写于 作者: F FUJITA Tomonori 提交者: Bartlomiej Zolnierkiewicz

ide-tape: convert ide_do_drive_cmd path to use blk_execute_rq

This converts the ide_do_drive_cmd path using ide_wait to use
blk_execute_rq.
Signed-off-by: NFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
上级 154ed280
...@@ -1519,12 +1519,16 @@ static void idetape_create_test_unit_ready_cmd(struct ide_atapi_pc *pc) ...@@ -1519,12 +1519,16 @@ static void idetape_create_test_unit_ready_cmd(struct ide_atapi_pc *pc)
static int idetape_queue_pc_tail(ide_drive_t *drive, struct ide_atapi_pc *pc) static int idetape_queue_pc_tail(ide_drive_t *drive, struct ide_atapi_pc *pc)
{ {
struct ide_tape_obj *tape = drive->driver_data; struct ide_tape_obj *tape = drive->driver_data;
struct request rq; struct request *rq;
int error;
idetape_init_rq(&rq, REQ_IDETAPE_PC1); rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
rq.buffer = (char *) pc; rq->cmd_type = REQ_TYPE_SPECIAL;
rq.rq_disk = tape->disk; rq->cmd[0] = REQ_IDETAPE_PC1;
return ide_do_drive_cmd(drive, &rq, ide_wait); rq->buffer = (char *)pc;
error = blk_execute_rq(drive->queue, tape->disk, rq, 0);
blk_put_request(rq);
return error;
} }
static void idetape_create_load_unload_cmd(ide_drive_t *drive, static void idetape_create_load_unload_cmd(ide_drive_t *drive,
...@@ -1701,26 +1705,33 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int blocks, ...@@ -1701,26 +1705,33 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int blocks,
struct idetape_bh *bh) struct idetape_bh *bh)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
struct request rq; struct request *rq;
int ret, errors;
debug_log(DBG_SENSE, "%s: cmd=%d\n", __func__, cmd); debug_log(DBG_SENSE, "%s: cmd=%d\n", __func__, cmd);
idetape_init_rq(&rq, cmd); rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
rq.rq_disk = tape->disk; rq->cmd_type = REQ_TYPE_SPECIAL;
rq.special = (void *)bh; rq->cmd[0] = cmd;
rq.sector = tape->first_frame; rq->rq_disk = tape->disk;
rq.nr_sectors = blocks; rq->special = (void *)bh;
rq.current_nr_sectors = blocks; rq->sector = tape->first_frame;
(void) ide_do_drive_cmd(drive, &rq, ide_wait); rq->nr_sectors = blocks;
rq->current_nr_sectors = blocks;
blk_execute_rq(drive->queue, tape->disk, rq, 0);
errors = rq->errors;
ret = tape->blk_size * (blocks - rq->current_nr_sectors);
blk_put_request(rq);
if ((cmd & (REQ_IDETAPE_READ | REQ_IDETAPE_WRITE)) == 0) if ((cmd & (REQ_IDETAPE_READ | REQ_IDETAPE_WRITE)) == 0)
return 0; return 0;
if (tape->merge_bh) if (tape->merge_bh)
idetape_init_merge_buffer(tape); idetape_init_merge_buffer(tape);
if (rq.errors == IDETAPE_ERROR_GENERAL) if (errors == IDETAPE_ERROR_GENERAL)
return -EIO; return -EIO;
return (tape->blk_size * (blocks-rq.current_nr_sectors)); return ret;
} }
static void idetape_create_inquiry_cmd(struct ide_atapi_pc *pc) static void idetape_create_inquiry_cmd(struct ide_atapi_pc *pc)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册