Skip to contentSkip to conversation

2.5.14 IDE CD-ROM PIO mode

PATCH In review Osamu Tomita 4 participants 6 messages May 7, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.5.14 IDE CD-ROM PIO mode

I could not use CD-ROM drive [PIO mode] on 2.5.14. Error messeges are follows.

May  7 11:05:03 sarah kernel: hdc: cdrom_read_intr: data underrun (4294967292 blocks)
May  7 11:05:03 sarah kernel: end_request: I/O error, dev 16:00, sector 92
May  7 11:05:03 sarah kernel: Buffer I/O error on device ide1(22,0), logical block 22

This patch works fine for me. Please check it.

drivers/ide/ide-cd.c renamed from drivers/ide/ide-cd.c.orig +1 -1
@@ -962,7 +962,7 @@
 
 	/* First, figure out if we need to bit-bucket
 	   any of the leading sectors. */
-	nskip = MIN(rq->current_nr_sectors - bio_sectors(rq->bio), sectors_to_transfer);
+	nskip = MIN((int)(rq->current_nr_sectors - bio_sectors(rq->bio)), sectors_to_transfer);
 
 	while (nskip > 0) {
 		/* We need to throw away a sector. */
Signature · 2 lines
Osamu Tomita
E-mail: [email protected]
#1 lore raw

Uz.ytkownik Osamu Tomita napisa?:

Quoted 8 lines

I could not use CD-ROM drive [PIO mode] on 2.5.14. Error messeges are follows.

May  7 11:05:03 sarah kernel: hdc: cdrom_read_intr: data underrun (4294967292 blocks)
May  7 11:05:03 sarah kernel: end_request: I/O error, dev 16:00, sector 92
May  7 11:05:03 sarah kernel: Buffer I/O error on device ide1(22,0), logical block 22

This patch works fine for me. Please check it.

Indeed this makes very much of sense. I will take it. How did you see it "hawkeye"?

Quoted 11 lines
drivers/ide/ide-cd.c renamed from drivers/ide/ide-cd.c.orig +1 -1
@@ -962,7 +962,7 @@
 
 	/* First, figure out if we need to bit-bucket
 	   any of the leading sectors. */
-	nskip = MIN(rq->current_nr_sectors - bio_sectors(rq->bio), sectors_to_transfer);
+	nskip = MIN((int)(rq->current_nr_sectors - bio_sectors(rq->bio)), sectors_to_transfer);
 
 	while (nskip > 0) {
 		/* We need to throw away a sector. */
#2 lore raw
In reply to Osamu Tomita
Quoted 6 lines · Martin Dalecki

drivers/ide/ide-cd.c line 965

Quoted 6 lines
drivers/ide/ide-cd.c renamed from drivers/ide/ide-cd.c.orig +1 -1
@@ -962,7 +962,7 @@
 
 	/* First, figure out if we need to bit-bucket
 	   any of the leading sectors. */
-	nskip = MIN(rq->current_nr_sectors - bio_sectors(rq->bio), sectors_to_transfer);
+	nskip = MIN((int)(rq->current_nr_sectors - bio_sectors(rq->bio)), sectors_to_transfer);

What about a s/MIN/min/g in the idea driver to easily catch such bugs?

#3 lore raw
In reply to Osamu Tomita

Uz.ytkownik Christoph Hellwig napisa?:

Quoted 11 lines · Martin Dalecki
Quoted 8 lines

drivers/ide/ide-cd.c line 965

Quoted 7 lines
drivers/ide/ide-cd.c renamed from drivers/ide/ide-cd.c.orig +1 -1
@@ -962,7 +962,7 @@
 
 	/* First, figure out if we need to bit-bucket
 	   any of the leading sectors. */
-	nskip = MIN(rq->current_nr_sectors - bio_sectors(rq->bio), sectors_to_transfer);
+	nskip = MIN((int)(rq->current_nr_sectors - bio_sectors(rq->bio)), sectors_to_transfer);

What about a s/MIN/min/g in the idea driver to easily catch such bugs?

Good idea partially already implemented :-).
At least the generic code and the host chip driver code are alread switched to using those "chatch them" macros.

#4 lore raw

while we are here, I think that drivers shouldn't take requests < hardsect_size, it should be handled by block layer

Quoted 16 lines · Martin Dalecki

Uz.ytkownik Christoph Hellwig napisa?:

Quoted 11 lines · Martin Dalecki
Quoted 8 lines

drivers/ide/ide-cd.c line 965

Quoted 7 lines
drivers/ide/ide-cd.c renamed from drivers/ide/ide-cd.c.orig +1 -1
@@ -962,7 +962,7 @@
 
 	/* First, figure out if we need to bit-bucket
 	   any of the leading sectors. */
-	nskip = MIN(rq->current_nr_sectors - bio_sectors(rq->bio), sectors_to_transfer);
+	nskip = MIN((int)(rq->current_nr_sectors - bio_sectors(rq->bio)), sectors_to_transfer);

What about a s/MIN/min/g in the idea driver to easily catch such bugs?

Good idea partially already implemented :-).
At least the generic code and the host chip driver code are alread switched to using those "chatch them" macros.

#5 lore raw

Uz.ytkownik Bartlomiej Zolnierkiewicz napisa?:

Quoted 2 lines

while we are here, I think that drivers shouldn't take requests < hardsect_size, it should be handled by block layer

There could be clever beasts which do (over)buffering... like ide-cdrom indeed does.