ide: cleanup ->prep_rq calling convention
The return value is just used as a binary yes/no decision, so switch it to a bool instead of the old BLKPREP_* values returned as an int. Also clean up a few related comments. Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Родитель
9d037ad707
Коммит
535ac5d3fe
|
@ -527,8 +527,8 @@ static bool ide_cd_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* standard prep_rq_fn that builds 10 byte cmds */
|
/* standard prep_rq that builds 10 byte cmds */
|
||||||
static int ide_cdrom_prep_fs(struct request_queue *q, struct request *rq)
|
static bool ide_cdrom_prep_fs(struct request_queue *q, struct request *rq)
|
||||||
{
|
{
|
||||||
int hard_sect = queue_logical_block_size(q);
|
int hard_sect = queue_logical_block_size(q);
|
||||||
long block = (long)blk_rq_pos(rq) / (hard_sect >> 9);
|
long block = (long)blk_rq_pos(rq) / (hard_sect >> 9);
|
||||||
|
@ -554,14 +554,14 @@ static int ide_cdrom_prep_fs(struct request_queue *q, struct request *rq)
|
||||||
req->cmd[7] = (blocks >> 8) & 0xff;
|
req->cmd[7] = (blocks >> 8) & 0xff;
|
||||||
req->cmd[8] = blocks & 0xff;
|
req->cmd[8] = blocks & 0xff;
|
||||||
req->cmd_len = 10;
|
req->cmd_len = 10;
|
||||||
return BLKPREP_OK;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Most of the SCSI commands are supported directly by ATAPI devices.
|
* Most of the SCSI commands are supported directly by ATAPI devices.
|
||||||
* This transform handles the few exceptions.
|
* This transform handles the few exceptions.
|
||||||
*/
|
*/
|
||||||
static int ide_cdrom_prep_pc(struct request *rq)
|
static bool ide_cdrom_prep_pc(struct request *rq)
|
||||||
{
|
{
|
||||||
u8 *c = scsi_req(rq)->cmd;
|
u8 *c = scsi_req(rq)->cmd;
|
||||||
|
|
||||||
|
@ -575,7 +575,7 @@ static int ide_cdrom_prep_pc(struct request *rq)
|
||||||
c[1] &= 0xe0;
|
c[1] &= 0xe0;
|
||||||
c[0] += (READ_10 - READ_6);
|
c[0] += (READ_10 - READ_6);
|
||||||
scsi_req(rq)->cmd_len = 10;
|
scsi_req(rq)->cmd_len = 10;
|
||||||
return BLKPREP_OK;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -585,13 +585,13 @@ static int ide_cdrom_prep_pc(struct request *rq)
|
||||||
*/
|
*/
|
||||||
if (c[0] == MODE_SENSE || c[0] == MODE_SELECT) {
|
if (c[0] == MODE_SENSE || c[0] == MODE_SELECT) {
|
||||||
scsi_req(rq)->result = ILLEGAL_REQUEST;
|
scsi_req(rq)->result = ILLEGAL_REQUEST;
|
||||||
return BLKPREP_KILL;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return BLKPREP_OK;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ide_cdrom_prep_fn(ide_drive_t *drive, struct request *rq)
|
static bool ide_cdrom_prep_rq(ide_drive_t *drive, struct request *rq)
|
||||||
{
|
{
|
||||||
if (!blk_rq_is_passthrough(rq)) {
|
if (!blk_rq_is_passthrough(rq)) {
|
||||||
scsi_req_init(scsi_req(rq));
|
scsi_req_init(scsi_req(rq));
|
||||||
|
@ -600,7 +600,7 @@ static int ide_cdrom_prep_fn(ide_drive_t *drive, struct request *rq)
|
||||||
} else if (blk_rq_is_scsi(rq))
|
} else if (blk_rq_is_scsi(rq))
|
||||||
return ide_cdrom_prep_pc(rq);
|
return ide_cdrom_prep_pc(rq);
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
|
static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
|
||||||
|
@ -818,7 +818,7 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq)
|
||||||
* We may be retrying this request after an error. Fix up any
|
* We may be retrying this request after an error. Fix up any
|
||||||
* weirdness which might be present in the request packet.
|
* weirdness which might be present in the request packet.
|
||||||
*/
|
*/
|
||||||
ide_cdrom_prep_fn(drive, rq);
|
ide_cdrom_prep_rq(drive, rq);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fs requests *must* be hardware frame aligned */
|
/* fs requests *must* be hardware frame aligned */
|
||||||
|
@ -1521,7 +1521,7 @@ static int ide_cdrom_setup(ide_drive_t *drive)
|
||||||
|
|
||||||
ide_debug_log(IDE_DBG_PROBE, "enter");
|
ide_debug_log(IDE_DBG_PROBE, "enter");
|
||||||
|
|
||||||
drive->prep_rq = ide_cdrom_prep_fn;
|
drive->prep_rq = ide_cdrom_prep_rq;
|
||||||
blk_queue_dma_alignment(q, 31);
|
blk_queue_dma_alignment(q, 31);
|
||||||
blk_queue_update_dma_pad(q, 15);
|
blk_queue_update_dma_pad(q, 15);
|
||||||
|
|
||||||
|
|
|
@ -427,12 +427,12 @@ static void ide_disk_unlock_native_capacity(ide_drive_t *drive)
|
||||||
drive->dev_flags |= IDE_DFLAG_NOHPA; /* disable HPA on resume */
|
drive->dev_flags |= IDE_DFLAG_NOHPA; /* disable HPA on resume */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int idedisk_prep_fn(ide_drive_t *drive, struct request *rq)
|
static bool idedisk_prep_rq(ide_drive_t *drive, struct request *rq)
|
||||||
{
|
{
|
||||||
struct ide_cmd *cmd;
|
struct ide_cmd *cmd;
|
||||||
|
|
||||||
if (req_op(rq) != REQ_OP_FLUSH)
|
if (req_op(rq) != REQ_OP_FLUSH)
|
||||||
return BLKPREP_OK;
|
return true;
|
||||||
|
|
||||||
if (rq->special) {
|
if (rq->special) {
|
||||||
cmd = rq->special;
|
cmd = rq->special;
|
||||||
|
@ -458,7 +458,7 @@ static int idedisk_prep_fn(ide_drive_t *drive, struct request *rq)
|
||||||
rq->special = cmd;
|
rq->special = cmd;
|
||||||
cmd->rq = rq;
|
cmd->rq = rq;
|
||||||
|
|
||||||
return BLKPREP_OK;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ide_devset_get(multcount, mult_count);
|
ide_devset_get(multcount, mult_count);
|
||||||
|
@ -547,7 +547,7 @@ static void update_flush(ide_drive_t *drive)
|
||||||
|
|
||||||
if (barrier) {
|
if (barrier) {
|
||||||
wc = true;
|
wc = true;
|
||||||
drive->prep_rq = idedisk_prep_fn;
|
drive->prep_rq = idedisk_prep_rq;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -326,7 +326,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
|
||||||
goto kill_rq;
|
goto kill_rq;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drive->prep_rq && drive->prep_rq(drive, rq))
|
if (drive->prep_rq && !drive->prep_rq(drive, rq))
|
||||||
return ide_stopped;
|
return ide_stopped;
|
||||||
|
|
||||||
if (ata_pm_request(rq))
|
if (ata_pm_request(rq))
|
||||||
|
@ -508,7 +508,7 @@ repeat:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* we know that the queue isn't empty, but this can happen
|
* we know that the queue isn't empty, but this can happen
|
||||||
* if the q->prep_rq_fn() decides to kill a request
|
* if ->prep_rq() decides to kill a request
|
||||||
*/
|
*/
|
||||||
if (!rq) {
|
if (!rq) {
|
||||||
rq = bd->rq;
|
rq = bd->rq;
|
||||||
|
|
|
@ -529,7 +529,7 @@ struct ide_drive_s {
|
||||||
|
|
||||||
struct request_queue *queue; /* request queue */
|
struct request_queue *queue; /* request queue */
|
||||||
|
|
||||||
int (*prep_rq)(struct ide_drive_s *, struct request *);
|
bool (*prep_rq)(struct ide_drive_s *, struct request *);
|
||||||
|
|
||||||
struct blk_mq_tag_set tag_set;
|
struct blk_mq_tag_set tag_set;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче