Move rq->errors quirk out from ide_end_request() to its call sites.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
if (blk_special_request(rq)) {
rq->errors = 0;
ide_complete_rq(drive, 0);
- } else
+ } else {
+ if (blk_fs_request(rq) == 0 && uptodate <= 0) {
+ if (rq->errors == 0)
+ rq->errors = -EIO;
+ }
ide_end_request(drive, uptodate, 0);
+ }
return ide_stopped;
}
ide_debug_log(IDE_DBG_FUNC, "uptodate: 0x%x, nsectors: %d",
uptodate, nsectors);
+ if (blk_fs_request(rq) == 0 && uptodate <= 0 && rq->errors == 0)
+ rq->errors = -EIO;
+
ide_end_request(drive, uptodate, nsectors);
}
if (!blk_fs_request(rq)) {
blk_dump_rq_flags(rq, "ide_do_rw_disk - bad command");
+ if (rq->errors == 0)
+ rq->errors = -EIO;
ide_end_request(drive, 0, 0);
return ide_stopped;
}
{
struct request *rq = drive->hwif->rq;
- if (rq && blk_special_request(rq) && rq->cmd[0] == REQ_DRIVE_RESET)
+ if (rq && blk_special_request(rq) && rq->cmd[0] == REQ_DRIVE_RESET) {
+ if (err <= 0 && rq->errors == 0)
+ rq->errors = -EIO;
ide_end_request(drive, err ? err : 1, 0);
+ }
}
/* needed below */
return idefloppy_issue_pc(drive, pc);
out_end:
drive->failed_pc = NULL;
+ if (blk_fs_request(rq) == 0 && rq->errors == 0)
+ rq->errors = -EIO;
ide_end_request(drive, 0, 0);
return ide_stopped;
}
if (blk_noretry_request(rq) && uptodate <= 0)
nr_bytes = rq->hard_nr_sectors << 9;
- if (blk_fs_request(rq) == 0 && uptodate <= 0 && rq->errors == 0)
- rq->errors = -EIO;
-
if (uptodate <= 0)
error = uptodate ? uptodate : -EIO;
} else {
if (media == ide_tape)
rq->errors = IDE_DRV_ERROR_GENERAL;
+ else if (blk_fs_request(rq) == 0 && rq->errors == 0)
+ rq->errors = -EIO;
ide_end_request(drive, 0, 0);
}
}
/* We do not support buffer cache originated requests. */
printk(KERN_NOTICE "ide-tape: %s: Unsupported request in "
"request queue (%d)\n", drive->name, rq->cmd_type);
+ if (blk_fs_request(rq) == 0 && rq->errors == 0)
+ rq->errors = -EIO;
ide_end_request(drive, 0, 0);
return ide_stopped;
}