ide-cd: factor out failed request completion from cdrom_end_request()
There should be no functional changes caused by this patch. Cc: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
parent
6041e8fba8
commit
299c4852fc
1 changed files with 25 additions and 22 deletions
|
@ -242,20 +242,13 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense,
|
||||||
elv_add_request(drive->queue, rq, ELEVATOR_INSERT_FRONT, 0);
|
elv_add_request(drive->queue, rq, ELEVATOR_INSERT_FRONT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cdrom_end_request(ide_drive_t *drive, int uptodate)
|
static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq)
|
||||||
{
|
{
|
||||||
struct request *rq = drive->hwif->rq;
|
|
||||||
int nsectors = rq->hard_cur_sectors;
|
|
||||||
|
|
||||||
ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, uptodate: 0x%x, nsectors: %d",
|
|
||||||
rq->cmd[0], uptodate, nsectors);
|
|
||||||
|
|
||||||
if (blk_sense_request(rq) && uptodate) {
|
|
||||||
/*
|
/*
|
||||||
* For REQ_TYPE_SENSE, "rq->buffer" points to the original
|
* For REQ_TYPE_SENSE, "rq->buffer" points to the original
|
||||||
* failed request
|
* failed request
|
||||||
*/
|
*/
|
||||||
struct request *failed = (struct request *) rq->buffer;
|
struct request *failed = (struct request *)rq->buffer;
|
||||||
struct cdrom_info *info = drive->driver_data;
|
struct cdrom_info *info = drive->driver_data;
|
||||||
void *sense = &info->sense_data;
|
void *sense = &info->sense_data;
|
||||||
|
|
||||||
|
@ -266,12 +259,22 @@ static void cdrom_end_request(ide_drive_t *drive, int uptodate)
|
||||||
}
|
}
|
||||||
cdrom_analyze_sense_data(drive, failed, sense);
|
cdrom_analyze_sense_data(drive, failed, sense);
|
||||||
|
|
||||||
if (ide_end_rq(drive, failed, -EIO,
|
if (ide_end_rq(drive, failed, -EIO, blk_rq_bytes(failed)))
|
||||||
blk_rq_bytes(failed)))
|
|
||||||
BUG();
|
BUG();
|
||||||
} else
|
} else
|
||||||
cdrom_analyze_sense_data(drive, NULL, sense);
|
cdrom_analyze_sense_data(drive, NULL, sense);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void cdrom_end_request(ide_drive_t *drive, int uptodate)
|
||||||
|
{
|
||||||
|
struct request *rq = drive->hwif->rq;
|
||||||
|
int nsectors = rq->hard_cur_sectors;
|
||||||
|
|
||||||
|
ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, uptodate: 0x%x, nsectors: %d",
|
||||||
|
rq->cmd[0], uptodate, nsectors);
|
||||||
|
|
||||||
|
if (blk_sense_request(rq) && uptodate)
|
||||||
|
ide_cd_complete_failed_rq(drive, rq);
|
||||||
|
|
||||||
if (!rq->current_nr_sectors && blk_fs_request(rq))
|
if (!rq->current_nr_sectors && blk_fs_request(rq))
|
||||||
uptodate = 1;
|
uptodate = 1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue