summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-11-10 03:30:49 -0500
committerJens Axboe <axboe@kernel.dk>2018-11-10 10:03:52 -0500
commit22ce0a7ccf23d55d1fdaa2974002f8b5ae765665 (patch)
treeeeec96b0413cbbfd95305acc783d7d6574f3ce42
parent289d088b66182076d33b5579417d429371cf9dfd (diff)
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>
-rw-r--r--drivers/ide/ide-atapi.c4
-rw-r--r--drivers/ide/ide-cd.c4
-rw-r--r--drivers/ide/ide-devsets.c4
-rw-r--r--drivers/ide/ide-disk.c6
-rw-r--r--drivers/ide/ide-eh.c2
-rw-r--r--drivers/ide/ide-floppy.c2
-rw-r--r--drivers/ide/ide-io.c14
-rw-r--r--drivers/ide/ide-park.c4
-rw-r--r--drivers/ide/ide-pm.c12
-rw-r--r--drivers/ide/ide-tape.c2
-rw-r--r--drivers/ide/ide-taskfile.c2
-rw-r--r--include/linux/ide.h1
12 files changed, 31 insertions, 26 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index 33210bc67618..da58020a144e 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -94,7 +94,7 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk,
94 94
95 rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, 0); 95 rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, 0);
96 ide_req(rq)->type = ATA_PRIV_MISC; 96 ide_req(rq)->type = ATA_PRIV_MISC;
97 rq->special = (char *)pc; 97 ide_req(rq)->special = pc;
98 98
99 if (buf && bufflen) { 99 if (buf && bufflen) {
100 error = blk_rq_map_kern(drive->queue, rq, buf, bufflen, 100 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 return -ENOMEM; 244 return -ENOMEM;
245 } 245 }
246 246
247 sense_rq->special = special; 247 ide_req(sense_rq)->special = special;
248 drive->sense_rq_armed = false; 248 drive->sense_rq_armed = false;
249 249
250 drive->hwif->rq = NULL; 250 drive->hwif->rq = NULL;
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 69c1aede5f93..1f03884a6808 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -211,12 +211,12 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive,
211static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq) 211static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq)
212{ 212{
213 /* 213 /*
214 * For ATA_PRIV_SENSE, "rq->special" points to the original 214 * For ATA_PRIV_SENSE, "ide_req(rq)->special" points to the original
215 * failed request. Also, the sense data should be read 215 * failed request. Also, the sense data should be read
216 * directly from rq which might be different from the original 216 * directly from rq which might be different from the original
217 * sense buffer if it got copied during mapping. 217 * sense buffer if it got copied during mapping.
218 */ 218 */
219 struct request *failed = (struct request *)rq->special; 219 struct request *failed = ide_req(rq)->special;
220 void *sense = bio_data(rq->bio); 220 void *sense = bio_data(rq->bio);
221 221
222 if (failed) { 222 if (failed) {
diff --git a/drivers/ide/ide-devsets.c b/drivers/ide/ide-devsets.c
index f4f8afdf8bbe..f2f93ed40356 100644
--- a/drivers/ide/ide-devsets.c
+++ b/drivers/ide/ide-devsets.c
@@ -171,7 +171,7 @@ int ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting,
171 scsi_req(rq)->cmd_len = 5; 171 scsi_req(rq)->cmd_len = 5;
172 scsi_req(rq)->cmd[0] = REQ_DEVSET_EXEC; 172 scsi_req(rq)->cmd[0] = REQ_DEVSET_EXEC;
173 *(int *)&scsi_req(rq)->cmd[1] = arg; 173 *(int *)&scsi_req(rq)->cmd[1] = arg;
174 rq->special = setting->set; 174 ide_req(rq)->special = setting->set;
175 175
176 blk_execute_rq(q, NULL, rq, 0); 176 blk_execute_rq(q, NULL, rq, 0);
177 ret = scsi_req(rq)->result; 177 ret = scsi_req(rq)->result;
@@ -182,7 +182,7 @@ int ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting,
182 182
183ide_startstop_t ide_do_devset(ide_drive_t *drive, struct request *rq) 183ide_startstop_t ide_do_devset(ide_drive_t *drive, struct request *rq)
184{ 184{
185 int err, (*setfunc)(ide_drive_t *, int) = rq->special; 185 int err, (*setfunc)(ide_drive_t *, int) = ide_req(rq)->special;
186 186
187 err = setfunc(drive, *(int *)&scsi_req(rq)->cmd[1]); 187 err = setfunc(drive, *(int *)&scsi_req(rq)->cmd[1]);
188 if (err) 188 if (err)
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 724db9af0d82..197912af5c2f 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -434,8 +434,8 @@ static bool idedisk_prep_rq(ide_drive_t *drive, struct request *rq)
434 if (req_op(rq) != REQ_OP_FLUSH) 434 if (req_op(rq) != REQ_OP_FLUSH)
435 return true; 435 return true;
436 436
437 if (rq->special) { 437 if (ide_req(rq)->special) {
438 cmd = rq->special; 438 cmd = ide_req(rq)->special;
439 memset(cmd, 0, sizeof(*cmd)); 439 memset(cmd, 0, sizeof(*cmd));
440 } else { 440 } else {
441 cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC); 441 cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC);
@@ -455,7 +455,7 @@ static bool idedisk_prep_rq(ide_drive_t *drive, struct request *rq)
455 rq->cmd_flags &= ~REQ_OP_MASK; 455 rq->cmd_flags &= ~REQ_OP_MASK;
456 rq->cmd_flags |= REQ_OP_DRV_OUT; 456 rq->cmd_flags |= REQ_OP_DRV_OUT;
457 ide_req(rq)->type = ATA_PRIV_TASKFILE; 457 ide_req(rq)->type = ATA_PRIV_TASKFILE;
458 rq->special = cmd; 458 ide_req(rq)->special = cmd;
459 cmd->rq = rq; 459 cmd->rq = rq;
460 460
461 return true; 461 return true;
diff --git a/drivers/ide/ide-eh.c b/drivers/ide/ide-eh.c
index 47d5f3379748..e1323e058454 100644
--- a/drivers/ide/ide-eh.c
+++ b/drivers/ide/ide-eh.c
@@ -125,7 +125,7 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat)
125 /* retry only "normal" I/O: */ 125 /* retry only "normal" I/O: */
126 if (blk_rq_is_passthrough(rq)) { 126 if (blk_rq_is_passthrough(rq)) {
127 if (ata_taskfile_request(rq)) { 127 if (ata_taskfile_request(rq)) {
128 struct ide_cmd *cmd = rq->special; 128 struct ide_cmd *cmd = ide_req(rq)->special;
129 129
130 if (cmd) 130 if (cmd)
131 ide_complete_cmd(drive, cmd, stat, err); 131 ide_complete_cmd(drive, cmd, stat, err);
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index a8df300f949c..780d33ccc5d8 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -276,7 +276,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
276 switch (ide_req(rq)->type) { 276 switch (ide_req(rq)->type) {
277 case ATA_PRIV_MISC: 277 case ATA_PRIV_MISC:
278 case ATA_PRIV_SENSE: 278 case ATA_PRIV_SENSE:
279 pc = (struct ide_atapi_pc *)rq->special; 279 pc = (struct ide_atapi_pc *)ide_req(rq)->special;
280 break; 280 break;
281 default: 281 default:
282 BUG(); 282 BUG();
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 64e72640acf8..94e9c79c41cf 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -111,7 +111,7 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err)
111 } 111 }
112 112
113 if (rq && ata_taskfile_request(rq)) { 113 if (rq && ata_taskfile_request(rq)) {
114 struct ide_cmd *orig_cmd = rq->special; 114 struct ide_cmd *orig_cmd = ide_req(rq)->special;
115 115
116 if (cmd->tf_flags & IDE_TFLAG_DYN) 116 if (cmd->tf_flags & IDE_TFLAG_DYN)
117 kfree(orig_cmd); 117 kfree(orig_cmd);
@@ -261,7 +261,7 @@ EXPORT_SYMBOL_GPL(ide_init_sg_cmd);
261static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, 261static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
262 struct request *rq) 262 struct request *rq)
263{ 263{
264 struct ide_cmd *cmd = rq->special; 264 struct ide_cmd *cmd = ide_req(rq)->special;
265 265
266 if (cmd) { 266 if (cmd) {
267 if (cmd->protocol == ATA_PROT_PIO) { 267 if (cmd->protocol == ATA_PROT_PIO) {
@@ -352,7 +352,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
352 if (ata_taskfile_request(rq)) 352 if (ata_taskfile_request(rq))
353 return execute_drive_cmd(drive, rq); 353 return execute_drive_cmd(drive, rq);
354 else if (ata_pm_request(rq)) { 354 else if (ata_pm_request(rq)) {
355 struct ide_pm_state *pm = rq->special; 355 struct ide_pm_state *pm = ide_req(rq)->special;
356#ifdef DEBUG_PM 356#ifdef DEBUG_PM
357 printk("%s: start_power_step(step: %d)\n", 357 printk("%s: start_power_step(step: %d)\n",
358 drive->name, pm->pm_step); 358 drive->name, pm->pm_step);
@@ -460,16 +460,20 @@ blk_status_t ide_queue_rq(struct blk_mq_hw_ctx *hctx,
460 ide_drive_t *drive = hctx->queue->queuedata; 460 ide_drive_t *drive = hctx->queue->queuedata;
461 ide_hwif_t *hwif = drive->hwif; 461 ide_hwif_t *hwif = drive->hwif;
462 struct ide_host *host = hwif->host; 462 struct ide_host *host = hwif->host;
463 struct request *rq = NULL; 463 struct request *rq = bd->rq;
464 ide_startstop_t startstop; 464 ide_startstop_t startstop;
465 465
466 if (!(rq->rq_flags & RQF_DONTPREP)) {
467 rq->rq_flags |= RQF_DONTPREP;
468 ide_req(rq)->special = NULL;
469 }
470
466 /* HLD do_request() callback might sleep, make sure it's okay */ 471 /* HLD do_request() callback might sleep, make sure it's okay */
467 might_sleep(); 472 might_sleep();
468 473
469 if (ide_lock_host(host, hwif)) 474 if (ide_lock_host(host, hwif))
470 return BLK_STS_DEV_RESOURCE; 475 return BLK_STS_DEV_RESOURCE;
471 476
472 rq = bd->rq;
473 blk_mq_start_request(rq); 477 blk_mq_start_request(rq);
474 478
475 spin_lock_irq(&hwif->lock); 479 spin_lock_irq(&hwif->lock);
diff --git a/drivers/ide/ide-park.c b/drivers/ide/ide-park.c
index de9e85cf74d1..102aa3bc3e7f 100644
--- a/drivers/ide/ide-park.c
+++ b/drivers/ide/ide-park.c
@@ -36,7 +36,7 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout)
36 scsi_req(rq)->cmd[0] = REQ_PARK_HEADS; 36 scsi_req(rq)->cmd[0] = REQ_PARK_HEADS;
37 scsi_req(rq)->cmd_len = 1; 37 scsi_req(rq)->cmd_len = 1;
38 ide_req(rq)->type = ATA_PRIV_MISC; 38 ide_req(rq)->type = ATA_PRIV_MISC;
39 rq->special = &timeout; 39 ide_req(rq)->special = &timeout;
40 blk_execute_rq(q, NULL, rq, 1); 40 blk_execute_rq(q, NULL, rq, 1);
41 rc = scsi_req(rq)->result ? -EIO : 0; 41 rc = scsi_req(rq)->result ? -EIO : 0;
42 blk_put_request(rq); 42 blk_put_request(rq);
@@ -67,7 +67,7 @@ ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq)
67 67
68 memset(&cmd, 0, sizeof(cmd)); 68 memset(&cmd, 0, sizeof(cmd));
69 if (scsi_req(rq)->cmd[0] == REQ_PARK_HEADS) { 69 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;
71 drive->dev_flags |= IDE_DFLAG_SLEEPING; 71 drive->dev_flags |= IDE_DFLAG_SLEEPING;
72 tf->command = ATA_CMD_IDLEIMMEDIATE; 72 tf->command = ATA_CMD_IDLEIMMEDIATE;
73 tf->feature = 0x44; 73 tf->feature = 0x44;
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c
index ea10507e5190..a8c53c98252d 100644
--- a/drivers/ide/ide-pm.c
+++ b/drivers/ide/ide-pm.c
@@ -21,7 +21,7 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg)
21 memset(&rqpm, 0, sizeof(rqpm)); 21 memset(&rqpm, 0, sizeof(rqpm));
22 rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, 0); 22 rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, 0);
23 ide_req(rq)->type = ATA_PRIV_PM_SUSPEND; 23 ide_req(rq)->type = ATA_PRIV_PM_SUSPEND;
24 rq->special = &rqpm; 24 ide_req(rq)->special = &rqpm;
25 rqpm.pm_step = IDE_PM_START_SUSPEND; 25 rqpm.pm_step = IDE_PM_START_SUSPEND;
26 if (mesg.event == PM_EVENT_PRETHAW) 26 if (mesg.event == PM_EVENT_PRETHAW)
27 mesg.event = PM_EVENT_FREEZE; 27 mesg.event = PM_EVENT_FREEZE;
@@ -82,7 +82,7 @@ int generic_ide_resume(struct device *dev)
82 memset(&rqpm, 0, sizeof(rqpm)); 82 memset(&rqpm, 0, sizeof(rqpm));
83 rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, BLK_MQ_REQ_PREEMPT); 83 rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, BLK_MQ_REQ_PREEMPT);
84 ide_req(rq)->type = ATA_PRIV_PM_RESUME; 84 ide_req(rq)->type = ATA_PRIV_PM_RESUME;
85 rq->special = &rqpm; 85 ide_req(rq)->special = &rqpm;
86 rqpm.pm_step = IDE_PM_START_RESUME; 86 rqpm.pm_step = IDE_PM_START_RESUME;
87 rqpm.pm_state = PM_EVENT_ON; 87 rqpm.pm_state = PM_EVENT_ON;
88 88
@@ -101,7 +101,7 @@ int generic_ide_resume(struct device *dev)
101 101
102void ide_complete_power_step(ide_drive_t *drive, struct request *rq) 102void ide_complete_power_step(ide_drive_t *drive, struct request *rq)
103{ 103{
104 struct ide_pm_state *pm = rq->special; 104 struct ide_pm_state *pm = ide_req(rq)->special;
105 105
106#ifdef DEBUG_PM 106#ifdef DEBUG_PM
107 printk(KERN_INFO "%s: complete_power_step(step: %d)\n", 107 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 131
132ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) 132ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq)
133{ 133{
134 struct ide_pm_state *pm = rq->special; 134 struct ide_pm_state *pm = ide_req(rq)->special;
135 struct ide_cmd cmd = { }; 135 struct ide_cmd cmd = { };
136 136
137 switch (pm->pm_step) { 137 switch (pm->pm_step) {
@@ -203,7 +203,7 @@ out_do_tf:
203void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq) 203void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq)
204{ 204{
205 struct request_queue *q = drive->queue; 205 struct request_queue *q = drive->queue;
206 struct ide_pm_state *pm = rq->special; 206 struct ide_pm_state *pm = ide_req(rq)->special;
207 unsigned long flags; 207 unsigned long flags;
208 208
209 ide_complete_power_step(drive, rq); 209 ide_complete_power_step(drive, rq);
@@ -228,7 +228,7 @@ void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq)
228 228
229void ide_check_pm_state(ide_drive_t *drive, struct request *rq) 229void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
230{ 230{
231 struct ide_pm_state *pm = rq->special; 231 struct ide_pm_state *pm = ide_req(rq)->special;
232 232
233 if (blk_rq_is_private(rq) && 233 if (blk_rq_is_private(rq) &&
234 ide_req(rq)->type == ATA_PRIV_PM_SUSPEND && 234 ide_req(rq)->type == ATA_PRIV_PM_SUSPEND &&
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 34c1165226a4..db1a65f4b490 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -639,7 +639,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
639 goto out; 639 goto out;
640 } 640 }
641 if (req->cmd[13] & REQ_IDETAPE_PC1) { 641 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;
643 req->cmd[13] &= ~(REQ_IDETAPE_PC1); 643 req->cmd[13] &= ~(REQ_IDETAPE_PC1);
644 req->cmd[13] |= REQ_IDETAPE_PC2; 644 req->cmd[13] |= REQ_IDETAPE_PC2;
645 goto out; 645 goto out;
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index c21d5c50ae3a..17b2e379e872 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -440,7 +440,7 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf,
440 goto put_req; 440 goto put_req;
441 } 441 }
442 442
443 rq->special = cmd; 443 ide_req(rq)->special = cmd;
444 cmd->rq = rq; 444 cmd->rq = rq;
445 445
446 blk_execute_rq(drive->queue, NULL, rq, 0); 446 blk_execute_rq(drive->queue, NULL, rq, 0);
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 272704ff21ee..e7d29ae633cd 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -50,6 +50,7 @@ struct ide_request {
50 struct scsi_request sreq; 50 struct scsi_request sreq;
51 u8 sense[SCSI_SENSE_BUFFERSIZE]; 51 u8 sense[SCSI_SENSE_BUFFERSIZE];
52 u8 type; 52 u8 type;
53 void *special;
53}; 54};
54 55
55static inline struct ide_request *ide_req(struct request *rq) 56static inline struct ide_request *ide_req(struct request *rq)