aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-atapi.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-06-03 03:38:04 -0400
committerJens Axboe <axboe@fb.com>2017-06-09 11:27:32 -0400
commit2a842acab109f40f0d7d10b38e9ca88390628996 (patch)
treebdfc7a47fe655c2ea7a5f74127015d7a502042f0 /drivers/ide/ide-atapi.c
parent1be5690984588953e759af0a4c6ddac182a1806c (diff)
block: introduce new block status code type
Currently we use nornal Linux errno values in the block layer, and while we accept any error a few have overloaded magic meanings. This patch instead introduces a new blk_status_t value that holds block layer specific status codes and explicitly explains their meaning. Helpers to convert from and to the previous special meanings are provided for now, but I suspect we want to get rid of them in the long run - those drivers that have a errno input (e.g. networking) usually get errnos that don't know about the special block layer overloads, and similarly returning them to userspace will usually return somethings that strictly speaking isn't correct for file system operations, but that's left as an exercise for later. For now the set of errors is a very limited set that closely corresponds to the previous overloaded errno values, but there is some low hanging fruite to improve it. blk_status_t (ab)uses the sparse __bitwise annotations to allow for sparse typechecking, so that we can easily catch places passing the wrong values. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/ide/ide-atapi.c')
-rw-r--r--drivers/ide/ide-atapi.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index 5901937284e7..d7a49dcfa85e 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -273,7 +273,7 @@ void ide_retry_pc(ide_drive_t *drive)
273 ide_requeue_and_plug(drive, failed_rq); 273 ide_requeue_and_plug(drive, failed_rq);
274 if (ide_queue_sense_rq(drive, pc)) { 274 if (ide_queue_sense_rq(drive, pc)) {
275 blk_start_request(failed_rq); 275 blk_start_request(failed_rq);
276 ide_complete_rq(drive, -EIO, blk_rq_bytes(failed_rq)); 276 ide_complete_rq(drive, BLK_STS_IOERR, blk_rq_bytes(failed_rq));
277 } 277 }
278} 278}
279EXPORT_SYMBOL_GPL(ide_retry_pc); 279EXPORT_SYMBOL_GPL(ide_retry_pc);
@@ -437,7 +437,8 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
437 437
438 /* No more interrupts */ 438 /* No more interrupts */
439 if ((stat & ATA_DRQ) == 0) { 439 if ((stat & ATA_DRQ) == 0) {
440 int uptodate, error; 440 int uptodate;
441 blk_status_t error;
441 442
442 debug_log("Packet command completed, %d bytes transferred\n", 443 debug_log("Packet command completed, %d bytes transferred\n",
443 blk_rq_bytes(rq)); 444 blk_rq_bytes(rq));
@@ -490,7 +491,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
490 491
491 if (ata_misc_request(rq)) { 492 if (ata_misc_request(rq)) {
492 scsi_req(rq)->result = 0; 493 scsi_req(rq)->result = 0;
493 error = 0; 494 error = BLK_STS_OK;
494 } else { 495 } else {
495 496
496 if (blk_rq_is_passthrough(rq) && uptodate <= 0) { 497 if (blk_rq_is_passthrough(rq) && uptodate <= 0) {
@@ -498,7 +499,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
498 scsi_req(rq)->result = -EIO; 499 scsi_req(rq)->result = -EIO;
499 } 500 }
500 501
501 error = uptodate ? 0 : -EIO; 502 error = uptodate ? BLK_STS_OK : BLK_STS_IOERR;
502 } 503 }
503 504
504 ide_complete_rq(drive, error, blk_rq_bytes(rq)); 505 ide_complete_rq(drive, error, blk_rq_bytes(rq));