Commit 22ce0a7c authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

ide: don't use req->special

Just replace it with a field of the same name in struct ide_req.
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 289d088b
...@@ -94,7 +94,7 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk, ...@@ -94,7 +94,7 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk,
rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, 0); rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, 0);
ide_req(rq)->type = ATA_PRIV_MISC; ide_req(rq)->type = ATA_PRIV_MISC;
rq->special = (char *)pc; ide_req(rq)->special = pc;
if (buf && bufflen) { if (buf && bufflen) {
error = blk_rq_map_kern(drive->queue, rq, buf, bufflen, error = blk_rq_map_kern(drive->queue, rq, buf, bufflen,
...@@ -244,7 +244,7 @@ int ide_queue_sense_rq(ide_drive_t *drive, void *special) ...@@ -244,7 +244,7 @@ int ide_queue_sense_rq(ide_drive_t *drive, void *special)
return -ENOMEM; return -ENOMEM;
} }
sense_rq->special = special; ide_req(sense_rq)->special = special;
drive->sense_rq_armed = false; drive->sense_rq_armed = false;
drive->hwif->rq = NULL; drive->hwif->rq = NULL;
......
...@@ -211,12 +211,12 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive, ...@@ -211,12 +211,12 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive,
static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq) static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq)
{ {
/* /*
* For ATA_PRIV_SENSE, "rq->special" points to the original * For ATA_PRIV_SENSE, "ide_req(rq)->special" points to the original
* failed request. Also, the sense data should be read * failed request. Also, the sense data should be read
* directly from rq which might be different from the original * directly from rq which might be different from the original
* sense buffer if it got copied during mapping. * sense buffer if it got copied during mapping.
*/ */
struct request *failed = (struct request *)rq->special; struct request *failed = ide_req(rq)->special;
void *sense = bio_data(rq->bio); void *sense = bio_data(rq->bio);
if (failed) { if (failed) {
......
...@@ -171,7 +171,7 @@ int ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting, ...@@ -171,7 +171,7 @@ int ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting,
scsi_req(rq)->cmd_len = 5; scsi_req(rq)->cmd_len = 5;
scsi_req(rq)->cmd[0] = REQ_DEVSET_EXEC; scsi_req(rq)->cmd[0] = REQ_DEVSET_EXEC;
*(int *)&scsi_req(rq)->cmd[1] = arg; *(int *)&scsi_req(rq)->cmd[1] = arg;
rq->special = setting->set; ide_req(rq)->special = setting->set;
blk_execute_rq(q, NULL, rq, 0); blk_execute_rq(q, NULL, rq, 0);
ret = scsi_req(rq)->result; ret = scsi_req(rq)->result;
...@@ -182,7 +182,7 @@ int ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting, ...@@ -182,7 +182,7 @@ int ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting,
ide_startstop_t ide_do_devset(ide_drive_t *drive, struct request *rq) ide_startstop_t ide_do_devset(ide_drive_t *drive, struct request *rq)
{ {
int err, (*setfunc)(ide_drive_t *, int) = rq->special; int err, (*setfunc)(ide_drive_t *, int) = ide_req(rq)->special;
err = setfunc(drive, *(int *)&scsi_req(rq)->cmd[1]); err = setfunc(drive, *(int *)&scsi_req(rq)->cmd[1]);
if (err) if (err)
......
...@@ -434,8 +434,8 @@ static bool idedisk_prep_rq(ide_drive_t *drive, struct request *rq) ...@@ -434,8 +434,8 @@ static bool idedisk_prep_rq(ide_drive_t *drive, struct request *rq)
if (req_op(rq) != REQ_OP_FLUSH) if (req_op(rq) != REQ_OP_FLUSH)
return true; return true;
if (rq->special) { if (ide_req(rq)->special) {
cmd = rq->special; cmd = ide_req(rq)->special;
memset(cmd, 0, sizeof(*cmd)); memset(cmd, 0, sizeof(*cmd));
} else { } else {
cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC); cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC);
...@@ -455,7 +455,7 @@ static bool idedisk_prep_rq(ide_drive_t *drive, struct request *rq) ...@@ -455,7 +455,7 @@ static bool idedisk_prep_rq(ide_drive_t *drive, struct request *rq)
rq->cmd_flags &= ~REQ_OP_MASK; rq->cmd_flags &= ~REQ_OP_MASK;
rq->cmd_flags |= REQ_OP_DRV_OUT; rq->cmd_flags |= REQ_OP_DRV_OUT;
ide_req(rq)->type = ATA_PRIV_TASKFILE; ide_req(rq)->type = ATA_PRIV_TASKFILE;
rq->special = cmd; ide_req(rq)->special = cmd;
cmd->rq = rq; cmd->rq = rq;
return true; return true;
......
...@@ -125,7 +125,7 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat) ...@@ -125,7 +125,7 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat)
/* retry only "normal" I/O: */ /* retry only "normal" I/O: */
if (blk_rq_is_passthrough(rq)) { if (blk_rq_is_passthrough(rq)) {
if (ata_taskfile_request(rq)) { if (ata_taskfile_request(rq)) {
struct ide_cmd *cmd = rq->special; struct ide_cmd *cmd = ide_req(rq)->special;
if (cmd) if (cmd)
ide_complete_cmd(drive, cmd, stat, err); ide_complete_cmd(drive, cmd, stat, err);
......
...@@ -276,7 +276,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, ...@@ -276,7 +276,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
switch (ide_req(rq)->type) { switch (ide_req(rq)->type) {
case ATA_PRIV_MISC: case ATA_PRIV_MISC:
case ATA_PRIV_SENSE: case ATA_PRIV_SENSE:
pc = (struct ide_atapi_pc *)rq->special; pc = (struct ide_atapi_pc *)ide_req(rq)->special;
break; break;
default: default:
BUG(); BUG();
......
...@@ -111,7 +111,7 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) ...@@ -111,7 +111,7 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err)
} }
if (rq && ata_taskfile_request(rq)) { if (rq && ata_taskfile_request(rq)) {
struct ide_cmd *orig_cmd = rq->special; struct ide_cmd *orig_cmd = ide_req(rq)->special;
if (cmd->tf_flags & IDE_TFLAG_DYN) if (cmd->tf_flags & IDE_TFLAG_DYN)
kfree(orig_cmd); kfree(orig_cmd);
...@@ -261,7 +261,7 @@ EXPORT_SYMBOL_GPL(ide_init_sg_cmd); ...@@ -261,7 +261,7 @@ EXPORT_SYMBOL_GPL(ide_init_sg_cmd);
static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
struct request *rq) struct request *rq)
{ {
struct ide_cmd *cmd = rq->special; struct ide_cmd *cmd = ide_req(rq)->special;
if (cmd) { if (cmd) {
if (cmd->protocol == ATA_PROT_PIO) { if (cmd->protocol == ATA_PROT_PIO) {
...@@ -352,7 +352,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq) ...@@ -352,7 +352,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
if (ata_taskfile_request(rq)) if (ata_taskfile_request(rq))
return execute_drive_cmd(drive, rq); return execute_drive_cmd(drive, rq);
else if (ata_pm_request(rq)) { else if (ata_pm_request(rq)) {
struct ide_pm_state *pm = rq->special; struct ide_pm_state *pm = ide_req(rq)->special;
#ifdef DEBUG_PM #ifdef DEBUG_PM
printk("%s: start_power_step(step: %d)\n", printk("%s: start_power_step(step: %d)\n",
drive->name, pm->pm_step); drive->name, pm->pm_step);
...@@ -460,16 +460,20 @@ blk_status_t ide_queue_rq(struct blk_mq_hw_ctx *hctx, ...@@ -460,16 +460,20 @@ blk_status_t ide_queue_rq(struct blk_mq_hw_ctx *hctx,
ide_drive_t *drive = hctx->queue->queuedata; ide_drive_t *drive = hctx->queue->queuedata;
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
struct ide_host *host = hwif->host; struct ide_host *host = hwif->host;
struct request *rq = NULL; struct request *rq = bd->rq;
ide_startstop_t startstop; ide_startstop_t startstop;
if (!(rq->rq_flags & RQF_DONTPREP)) {
rq->rq_flags |= RQF_DONTPREP;
ide_req(rq)->special = NULL;
}
/* HLD do_request() callback might sleep, make sure it's okay */ /* HLD do_request() callback might sleep, make sure it's okay */
might_sleep(); might_sleep();
if (ide_lock_host(host, hwif)) if (ide_lock_host(host, hwif))
return BLK_STS_DEV_RESOURCE; return BLK_STS_DEV_RESOURCE;
rq = bd->rq;
blk_mq_start_request(rq); blk_mq_start_request(rq);
spin_lock_irq(&hwif->lock); spin_lock_irq(&hwif->lock);
......
...@@ -36,7 +36,7 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout) ...@@ -36,7 +36,7 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout)
scsi_req(rq)->cmd[0] = REQ_PARK_HEADS; scsi_req(rq)->cmd[0] = REQ_PARK_HEADS;
scsi_req(rq)->cmd_len = 1; scsi_req(rq)->cmd_len = 1;
ide_req(rq)->type = ATA_PRIV_MISC; ide_req(rq)->type = ATA_PRIV_MISC;
rq->special = &timeout; ide_req(rq)->special = &timeout;
blk_execute_rq(q, NULL, rq, 1); blk_execute_rq(q, NULL, rq, 1);
rc = scsi_req(rq)->result ? -EIO : 0; rc = scsi_req(rq)->result ? -EIO : 0;
blk_put_request(rq); blk_put_request(rq);
...@@ -67,7 +67,7 @@ ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq) ...@@ -67,7 +67,7 @@ ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq)
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
if (scsi_req(rq)->cmd[0] == REQ_PARK_HEADS) { if (scsi_req(rq)->cmd[0] == REQ_PARK_HEADS) {
drive->sleep = *(unsigned long *)rq->special; drive->sleep = *(unsigned long *)ide_req(rq)->special;
drive->dev_flags |= IDE_DFLAG_SLEEPING; drive->dev_flags |= IDE_DFLAG_SLEEPING;
tf->command = ATA_CMD_IDLEIMMEDIATE; tf->command = ATA_CMD_IDLEIMMEDIATE;
tf->feature = 0x44; tf->feature = 0x44;
......
...@@ -21,7 +21,7 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg) ...@@ -21,7 +21,7 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg)
memset(&rqpm, 0, sizeof(rqpm)); memset(&rqpm, 0, sizeof(rqpm));
rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, 0); rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, 0);
ide_req(rq)->type = ATA_PRIV_PM_SUSPEND; ide_req(rq)->type = ATA_PRIV_PM_SUSPEND;
rq->special = &rqpm; ide_req(rq)->special = &rqpm;
rqpm.pm_step = IDE_PM_START_SUSPEND; rqpm.pm_step = IDE_PM_START_SUSPEND;
if (mesg.event == PM_EVENT_PRETHAW) if (mesg.event == PM_EVENT_PRETHAW)
mesg.event = PM_EVENT_FREEZE; mesg.event = PM_EVENT_FREEZE;
...@@ -82,7 +82,7 @@ int generic_ide_resume(struct device *dev) ...@@ -82,7 +82,7 @@ int generic_ide_resume(struct device *dev)
memset(&rqpm, 0, sizeof(rqpm)); memset(&rqpm, 0, sizeof(rqpm));
rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, BLK_MQ_REQ_PREEMPT); rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, BLK_MQ_REQ_PREEMPT);
ide_req(rq)->type = ATA_PRIV_PM_RESUME; ide_req(rq)->type = ATA_PRIV_PM_RESUME;
rq->special = &rqpm; ide_req(rq)->special = &rqpm;
rqpm.pm_step = IDE_PM_START_RESUME; rqpm.pm_step = IDE_PM_START_RESUME;
rqpm.pm_state = PM_EVENT_ON; rqpm.pm_state = PM_EVENT_ON;
...@@ -101,7 +101,7 @@ int generic_ide_resume(struct device *dev) ...@@ -101,7 +101,7 @@ int generic_ide_resume(struct device *dev)
void ide_complete_power_step(ide_drive_t *drive, struct request *rq) void ide_complete_power_step(ide_drive_t *drive, struct request *rq)
{ {
struct ide_pm_state *pm = rq->special; struct ide_pm_state *pm = ide_req(rq)->special;
#ifdef DEBUG_PM #ifdef DEBUG_PM
printk(KERN_INFO "%s: complete_power_step(step: %d)\n", printk(KERN_INFO "%s: complete_power_step(step: %d)\n",
...@@ -131,7 +131,7 @@ void ide_complete_power_step(ide_drive_t *drive, struct request *rq) ...@@ -131,7 +131,7 @@ void ide_complete_power_step(ide_drive_t *drive, struct request *rq)
ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq)
{ {
struct ide_pm_state *pm = rq->special; struct ide_pm_state *pm = ide_req(rq)->special;
struct ide_cmd cmd = { }; struct ide_cmd cmd = { };
switch (pm->pm_step) { switch (pm->pm_step) {
...@@ -203,7 +203,7 @@ ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) ...@@ -203,7 +203,7 @@ ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq)
void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq) void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq)
{ {
struct request_queue *q = drive->queue; struct request_queue *q = drive->queue;
struct ide_pm_state *pm = rq->special; struct ide_pm_state *pm = ide_req(rq)->special;
unsigned long flags; unsigned long flags;
ide_complete_power_step(drive, rq); ide_complete_power_step(drive, rq);
...@@ -228,7 +228,7 @@ void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq) ...@@ -228,7 +228,7 @@ void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq)
void ide_check_pm_state(ide_drive_t *drive, struct request *rq) void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
{ {
struct ide_pm_state *pm = rq->special; struct ide_pm_state *pm = ide_req(rq)->special;
if (blk_rq_is_private(rq) && if (blk_rq_is_private(rq) &&
ide_req(rq)->type == ATA_PRIV_PM_SUSPEND && ide_req(rq)->type == ATA_PRIV_PM_SUSPEND &&
......
...@@ -639,7 +639,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, ...@@ -639,7 +639,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
goto out; goto out;
} }
if (req->cmd[13] & REQ_IDETAPE_PC1) { if (req->cmd[13] & REQ_IDETAPE_PC1) {
pc = (struct ide_atapi_pc *)rq->special; pc = (struct ide_atapi_pc *)ide_req(rq)->special;
req->cmd[13] &= ~(REQ_IDETAPE_PC1); req->cmd[13] &= ~(REQ_IDETAPE_PC1);
req->cmd[13] |= REQ_IDETAPE_PC2; req->cmd[13] |= REQ_IDETAPE_PC2;
goto out; goto out;
......
...@@ -440,7 +440,7 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf, ...@@ -440,7 +440,7 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf,
goto put_req; goto put_req;
} }
rq->special = cmd; ide_req(rq)->special = cmd;
cmd->rq = rq; cmd->rq = rq;
blk_execute_rq(drive->queue, NULL, rq, 0); blk_execute_rq(drive->queue, NULL, rq, 0);
......
...@@ -50,6 +50,7 @@ struct ide_request { ...@@ -50,6 +50,7 @@ struct ide_request {
struct scsi_request sreq; struct scsi_request sreq;
u8 sense[SCSI_SENSE_BUFFERSIZE]; u8 sense[SCSI_SENSE_BUFFERSIZE];
u8 type; u8 type;
void *special;
}; };
static inline struct ide_request *ide_req(struct request *rq) static inline struct ide_request *ide_req(struct request *rq)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment