Skip to content

Commit 22ce0a7

Browse files
Christoph Hellwigaxboe
authored andcommitted
ide: don't use req->special
Just replace it with a field of the same name in struct ide_req. Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 289d088 commit 22ce0a7

12 files changed

Lines changed: 31 additions & 26 deletions

File tree

‎drivers/ide/ide-atapi.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk,
9494

9595
rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, 0);
9696
ide_req(rq)->type = ATA_PRIV_MISC;
97-
rq->special = (char *)pc;
97+
ide_req(rq)->special = pc;
9898

9999
if (buf && bufflen) {
100100
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)
244244
return -ENOMEM;
245245
}
246246

247-
sense_rq->special = special;
247+
ide_req(sense_rq)->special = special;
248248
drive->sense_rq_armed = false;
249249

250250
drive->hwif->rq = NULL;

‎drivers/ide/ide-cd.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,12 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive,
211211
static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq)
212212
{
213213
/*
214-
* For ATA_PRIV_SENSE, "rq->special" points to the original
214+
* For ATA_PRIV_SENSE, "ide_req(rq)->special" points to the original
215215
* failed request. Also, the sense data should be read
216216
* directly from rq which might be different from the original
217217
* sense buffer if it got copied during mapping.
218218
*/
219-
struct request *failed = (struct request *)rq->special;
219+
struct request *failed = ide_req(rq)->special;
220220
void *sense = bio_data(rq->bio);
221221

222222
if (failed) {

‎drivers/ide/ide-devsets.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ int ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting,
171171
scsi_req(rq)->cmd_len = 5;
172172
scsi_req(rq)->cmd[0] = REQ_DEVSET_EXEC;
173173
*(int *)&scsi_req(rq)->cmd[1] = arg;
174-
rq->special = setting->set;
174+
ide_req(rq)->special = setting->set;
175175

176176
blk_execute_rq(q, NULL, rq, 0);
177177
ret = scsi_req(rq)->result;
@@ -182,7 +182,7 @@ int ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting,
182182

183183
ide_startstop_t ide_do_devset(ide_drive_t *drive, struct request *rq)
184184
{
185-
int err, (*setfunc)(ide_drive_t *, int) = rq->special;
185+
int err, (*setfunc)(ide_drive_t *, int) = ide_req(rq)->special;
186186

187187
err = setfunc(drive, *(int *)&scsi_req(rq)->cmd[1]);
188188
if (err)

‎drivers/ide/ide-disk.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ static bool idedisk_prep_rq(ide_drive_t *drive, struct request *rq)
434434
if (req_op(rq) != REQ_OP_FLUSH)
435435
return true;
436436

437-
if (rq->special) {
438-
cmd = rq->special;
437+
if (ide_req(rq)->special) {
438+
cmd = ide_req(rq)->special;
439439
memset(cmd, 0, sizeof(*cmd));
440440
} else {
441441
cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC);
@@ -455,7 +455,7 @@ static bool idedisk_prep_rq(ide_drive_t *drive, struct request *rq)
455455
rq->cmd_flags &= ~REQ_OP_MASK;
456456
rq->cmd_flags |= REQ_OP_DRV_OUT;
457457
ide_req(rq)->type = ATA_PRIV_TASKFILE;
458-
rq->special = cmd;
458+
ide_req(rq)->special = cmd;
459459
cmd->rq = rq;
460460

461461
return true;

‎drivers/ide/ide-eh.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat)
125125
/* retry only "normal" I/O: */
126126
if (blk_rq_is_passthrough(rq)) {
127127
if (ata_taskfile_request(rq)) {
128-
struct ide_cmd *cmd = rq->special;
128+
struct ide_cmd *cmd = ide_req(rq)->special;
129129

130130
if (cmd)
131131
ide_complete_cmd(drive, cmd, stat, err);

‎drivers/ide/ide-floppy.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
276276
switch (ide_req(rq)->type) {
277277
case ATA_PRIV_MISC:
278278
case ATA_PRIV_SENSE:
279-
pc = (struct ide_atapi_pc *)rq->special;
279+
pc = (struct ide_atapi_pc *)ide_req(rq)->special;
280280
break;
281281
default:
282282
BUG();

‎drivers/ide/ide-io.c‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err)
111111
}
112112

113113
if (rq && ata_taskfile_request(rq)) {
114-
struct ide_cmd *orig_cmd = rq->special;
114+
struct ide_cmd *orig_cmd = ide_req(rq)->special;
115115

116116
if (cmd->tf_flags & IDE_TFLAG_DYN)
117117
kfree(orig_cmd);
@@ -261,7 +261,7 @@ EXPORT_SYMBOL_GPL(ide_init_sg_cmd);
261261
static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
262262
struct request *rq)
263263
{
264-
struct ide_cmd *cmd = rq->special;
264+
struct ide_cmd *cmd = ide_req(rq)->special;
265265

266266
if (cmd) {
267267
if (cmd->protocol == ATA_PROT_PIO) {
@@ -352,7 +352,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
352352
if (ata_taskfile_request(rq))
353353
return execute_drive_cmd(drive, rq);
354354
else if (ata_pm_request(rq)) {
355-
struct ide_pm_state *pm = rq->special;
355+
struct ide_pm_state *pm = ide_req(rq)->special;
356356
#ifdef DEBUG_PM
357357
printk("%s: start_power_step(step: %d)\n",
358358
drive->name, pm->pm_step);
@@ -460,16 +460,20 @@ blk_status_t ide_queue_rq(struct blk_mq_hw_ctx *hctx,
460460
ide_drive_t *drive = hctx->queue->queuedata;
461461
ide_hwif_t *hwif = drive->hwif;
462462
struct ide_host *host = hwif->host;
463-
struct request *rq = NULL;
463+
struct request *rq = bd->rq;
464464
ide_startstop_t startstop;
465465

466+
if (!(rq->rq_flags & RQF_DONTPREP)) {
467+
rq->rq_flags |= RQF_DONTPREP;
468+
ide_req(rq)->special = NULL;
469+
}
470+
466471
/* HLD do_request() callback might sleep, make sure it's okay */
467472
might_sleep();
468473

469474
if (ide_lock_host(host, hwif))
470475
return BLK_STS_DEV_RESOURCE;
471476

472-
rq = bd->rq;
473477
blk_mq_start_request(rq);
474478

475479
spin_lock_irq(&hwif->lock);

‎drivers/ide/ide-park.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout)
3636
scsi_req(rq)->cmd[0] = REQ_PARK_HEADS;
3737
scsi_req(rq)->cmd_len = 1;
3838
ide_req(rq)->type = ATA_PRIV_MISC;
39-
rq->special = &timeout;
39+
ide_req(rq)->special = &timeout;
4040
blk_execute_rq(q, NULL, rq, 1);
4141
rc = scsi_req(rq)->result ? -EIO : 0;
4242
blk_put_request(rq);
@@ -67,7 +67,7 @@ ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq)
6767

6868
memset(&cmd, 0, sizeof(cmd));
6969
if (scsi_req(rq)->cmd[0] == REQ_PARK_HEADS) {
70-
drive->sleep = *(unsigned long *)rq->special;
70+
drive->sleep = *(unsigned long *)ide_req(rq)->special;
7171
drive->dev_flags |= IDE_DFLAG_SLEEPING;
7272
tf->command = ATA_CMD_IDLEIMMEDIATE;
7373
tf->feature = 0x44;

‎drivers/ide/ide-pm.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg)
2121
memset(&rqpm, 0, sizeof(rqpm));
2222
rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, 0);
2323
ide_req(rq)->type = ATA_PRIV_PM_SUSPEND;
24-
rq->special = &rqpm;
24+
ide_req(rq)->special = &rqpm;
2525
rqpm.pm_step = IDE_PM_START_SUSPEND;
2626
if (mesg.event == PM_EVENT_PRETHAW)
2727
mesg.event = PM_EVENT_FREEZE;
@@ -82,7 +82,7 @@ int generic_ide_resume(struct device *dev)
8282
memset(&rqpm, 0, sizeof(rqpm));
8383
rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, BLK_MQ_REQ_PREEMPT);
8484
ide_req(rq)->type = ATA_PRIV_PM_RESUME;
85-
rq->special = &rqpm;
85+
ide_req(rq)->special = &rqpm;
8686
rqpm.pm_step = IDE_PM_START_RESUME;
8787
rqpm.pm_state = PM_EVENT_ON;
8888

@@ -101,7 +101,7 @@ int generic_ide_resume(struct device *dev)
101101

102102
void ide_complete_power_step(ide_drive_t *drive, struct request *rq)
103103
{
104-
struct ide_pm_state *pm = rq->special;
104+
struct ide_pm_state *pm = ide_req(rq)->special;
105105

106106
#ifdef DEBUG_PM
107107
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)
131131

132132
ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq)
133133
{
134-
struct ide_pm_state *pm = rq->special;
134+
struct ide_pm_state *pm = ide_req(rq)->special;
135135
struct ide_cmd cmd = { };
136136

137137
switch (pm->pm_step) {
@@ -203,7 +203,7 @@ ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq)
203203
void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq)
204204
{
205205
struct request_queue *q = drive->queue;
206-
struct ide_pm_state *pm = rq->special;
206+
struct ide_pm_state *pm = ide_req(rq)->special;
207207
unsigned long flags;
208208

209209
ide_complete_power_step(drive, rq);
@@ -228,7 +228,7 @@ void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq)
228228

229229
void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
230230
{
231-
struct ide_pm_state *pm = rq->special;
231+
struct ide_pm_state *pm = ide_req(rq)->special;
232232

233233
if (blk_rq_is_private(rq) &&
234234
ide_req(rq)->type == ATA_PRIV_PM_SUSPEND &&

‎drivers/ide/ide-tape.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
639639
goto out;
640640
}
641641
if (req->cmd[13] & REQ_IDETAPE_PC1) {
642-
pc = (struct ide_atapi_pc *)rq->special;
642+
pc = (struct ide_atapi_pc *)ide_req(rq)->special;
643643
req->cmd[13] &= ~(REQ_IDETAPE_PC1);
644644
req->cmd[13] |= REQ_IDETAPE_PC2;
645645
goto out;

0 commit comments

Comments
 (0)