diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-12-29 14:27:32 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-12-29 14:27:32 -0500 |
commit | 27c01c2db05c3cf8824975e50403cd4fd9356dca (patch) | |
tree | 5032c9b77971778c7e76722d0e86fa66a3a6dc1b /drivers/ide | |
parent | 08cd1dca00f7c84c8b30c2726e078529d4ebc93f (diff) |
ide-cd: remove obsolete seek optimization
It doesn't make much sense nowadays and is problematic on some drives.
Cc: Borislav Petkov <petkovbb@googlemail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-cd.c | 89 | ||||
-rw-r--r-- | drivers/ide/ide-cd.h | 2 |
2 files changed, 6 insertions, 85 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 692fd4570df6..ea35e94d0980 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -774,52 +774,6 @@ static ide_startstop_t cdrom_start_rw_cont(ide_drive_t *drive) | |||
774 | return cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr); | 774 | return cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr); |
775 | } | 775 | } |
776 | 776 | ||
777 | #define IDECD_SEEK_THRESHOLD (1000) /* 1000 blocks */ | ||
778 | #define IDECD_SEEK_TIMER (5 * WAIT_MIN_SLEEP) /* 100 ms */ | ||
779 | #define IDECD_SEEK_TIMEOUT (2 * WAIT_CMD) /* 20 sec */ | ||
780 | |||
781 | static ide_startstop_t cdrom_seek_intr(ide_drive_t *drive) | ||
782 | { | ||
783 | struct cdrom_info *info = drive->driver_data; | ||
784 | int stat; | ||
785 | static int retry = 10; | ||
786 | |||
787 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); | ||
788 | |||
789 | if (cdrom_decode_status(drive, 0, &stat)) | ||
790 | return ide_stopped; | ||
791 | |||
792 | drive->atapi_flags |= IDE_AFLAG_SEEKING; | ||
793 | |||
794 | if (retry && time_after(jiffies, info->start_seek + IDECD_SEEK_TIMER)) { | ||
795 | if (--retry == 0) | ||
796 | drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; | ||
797 | } | ||
798 | return ide_stopped; | ||
799 | } | ||
800 | |||
801 | static void ide_cd_prepare_seek_request(ide_drive_t *drive, struct request *rq) | ||
802 | { | ||
803 | sector_t frame = rq->sector; | ||
804 | |||
805 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); | ||
806 | |||
807 | sector_div(frame, queue_hardsect_size(drive->queue) >> SECTOR_BITS); | ||
808 | |||
809 | memset(rq->cmd, 0, BLK_MAX_CDB); | ||
810 | rq->cmd[0] = GPCMD_SEEK; | ||
811 | put_unaligned(cpu_to_be32(frame), (unsigned int *) &rq->cmd[2]); | ||
812 | |||
813 | rq->timeout = ATAPI_WAIT_PC; | ||
814 | } | ||
815 | |||
816 | static ide_startstop_t cdrom_start_seek_continuation(ide_drive_t *drive) | ||
817 | { | ||
818 | struct request *rq = drive->hwif->hwgroup->rq; | ||
819 | |||
820 | return cdrom_transfer_packet_command(drive, rq, &cdrom_seek_intr); | ||
821 | } | ||
822 | |||
823 | /* | 777 | /* |
824 | * Fix up a possibly partially-processed request so that we can start it over | 778 | * Fix up a possibly partially-processed request so that we can start it over |
825 | * entirely, or even put it back on the request queue. | 779 | * entirely, or even put it back on the request queue. |
@@ -1260,7 +1214,6 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) | |||
1260 | static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | 1214 | static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, |
1261 | sector_t block) | 1215 | sector_t block) |
1262 | { | 1216 | { |
1263 | struct cdrom_info *info = drive->driver_data; | ||
1264 | ide_handler_t *fn; | 1217 | ide_handler_t *fn; |
1265 | int xferlen; | 1218 | int xferlen; |
1266 | 1219 | ||
@@ -1270,44 +1223,14 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
1270 | (unsigned long long)block); | 1223 | (unsigned long long)block); |
1271 | 1224 | ||
1272 | if (blk_fs_request(rq)) { | 1225 | if (blk_fs_request(rq)) { |
1273 | if (drive->atapi_flags & IDE_AFLAG_SEEKING) { | 1226 | xferlen = 32768; |
1274 | ide_hwif_t *hwif = drive->hwif; | 1227 | fn = cdrom_start_rw_cont; |
1275 | unsigned long elapsed = jiffies - info->start_seek; | ||
1276 | int stat = hwif->tp_ops->read_status(hwif); | ||
1277 | |||
1278 | if ((stat & ATA_DSC) != ATA_DSC) { | ||
1279 | if (elapsed < IDECD_SEEK_TIMEOUT) { | ||
1280 | ide_stall_queue(drive, | ||
1281 | IDECD_SEEK_TIMER); | ||
1282 | return ide_stopped; | ||
1283 | } | ||
1284 | printk(KERN_ERR PFX "%s: DSC timeout\n", | ||
1285 | drive->name); | ||
1286 | } | ||
1287 | drive->atapi_flags &= ~IDE_AFLAG_SEEKING; | ||
1288 | } | ||
1289 | if (rq_data_dir(rq) == READ && | ||
1290 | IDE_LARGE_SEEK(info->last_block, block, | ||
1291 | IDECD_SEEK_THRESHOLD) && | ||
1292 | (drive->dev_flags & IDE_DFLAG_DSC_OVERLAP)) { | ||
1293 | xferlen = 0; | ||
1294 | fn = cdrom_start_seek_continuation; | ||
1295 | |||
1296 | drive->dma = 0; | ||
1297 | info->start_seek = jiffies; | ||
1298 | |||
1299 | ide_cd_prepare_seek_request(drive, rq); | ||
1300 | } else { | ||
1301 | xferlen = 32768; | ||
1302 | fn = cdrom_start_rw_cont; | ||
1303 | 1228 | ||
1304 | if (cdrom_start_rw(drive, rq) == ide_stopped) | 1229 | if (cdrom_start_rw(drive, rq) == ide_stopped) |
1305 | return ide_stopped; | 1230 | return ide_stopped; |
1306 | 1231 | ||
1307 | if (ide_cd_prepare_rw_request(drive, rq) == ide_stopped) | 1232 | if (ide_cd_prepare_rw_request(drive, rq) == ide_stopped) |
1308 | return ide_stopped; | 1233 | return ide_stopped; |
1309 | } | ||
1310 | info->last_block = block; | ||
1311 | } else if (blk_sense_request(rq) || blk_pc_request(rq) || | 1234 | } else if (blk_sense_request(rq) || blk_pc_request(rq) || |
1312 | rq->cmd_type == REQ_TYPE_ATA_PC) { | 1235 | rq->cmd_type == REQ_TYPE_ATA_PC) { |
1313 | xferlen = rq->data_len; | 1236 | xferlen = rq->data_len; |
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index 5882b9a9ea8b..d5ce3362dbd1 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h | |||
@@ -88,8 +88,6 @@ struct cdrom_info { | |||
88 | struct request_sense sense_data; | 88 | struct request_sense sense_data; |
89 | 89 | ||
90 | struct request request_sense_request; | 90 | struct request request_sense_request; |
91 | unsigned long last_block; | ||
92 | unsigned long start_seek; | ||
93 | 91 | ||
94 | u8 max_speed; /* Max speed of the drive. */ | 92 | u8 max_speed; /* Max speed of the drive. */ |
95 | u8 current_speed; /* Current speed of the drive. */ | 93 | u8 current_speed; /* Current speed of the drive. */ |