Skip to contentSkip to conversation

ide-cd: document capacity hack

PATCH In review Bartlomiej Zolnierkiewicz 2 participants 3 messages Feb 18, 2009 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ide-cd: document capacity hack

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide-cd: document capacity hack

Just copy the comment from drivers/scsi/sr.c::sr_done() (from which the capacity hack has been originated).

---
 drivers/ide/ide-cd.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/ide/ide-cd.c +8 -0
Index: b/drivers/ide/ide-cd.c
===================================================================
@@ -189,6 +189,14 @@ static void cdrom_analyze_sense_data(ide
 			bio_sectors = max(bio_sectors(failed_command->bio), 4U);
 			sector &= ~(bio_sectors - 1);
 
+			/*
+			 * The SCSI specification allows for the value
+			 * returned by READ CAPACITY to be up to 75 2K
+			 * sectors past the last readable block.
+			 * Therefore, if we hit a medium error within the
+			 * last 75 2K sectors, we decrease the saved size
+			 * value.
+			 */
 			if (sector < get_capacity(info->disk) &&
 			    drive->probed_capacity - sector < 4 * 75)
 				set_capacity(info->disk, sector);
Acked-by on v1 1/1
#1 lore raw

Hello.

Quoted 5 lines · Bartlomiej Zolnierkiewicz

Just copy the comment from drivers/scsi/sr.c::sr_done() (from which the capacity hack has been originated).

drivers/ide/ide-cd.c static void cdrom_analyze_sense_data(ide · line 195

Quoted 12 lines

Index: b/drivers/ide/ide-cd.c
===================================================================

drivers/ide/ide-cd.c +4 -0
@@ -189,6 +189,14 @@ static void cdrom_analyze_sense_data(ide
 			bio_sectors = max(bio_sectors(failed_command->bio), 4U);
 			sector &= ~(bio_sectors - 1);
 
+			/*
+			 * The SCSI specification allows for the value
+			 * returned by READ CAPACITY to be up to 75 2K
+			 * sectors past the last readable block.

Oh horror... :-)

drivers/ide/ide-cd.c static void cdrom_analyze_sense_data(ide · line 202

Quoted 7 lines
drivers/ide/ide-cd.c +4 -0
+			 * Therefore, if we hit a medium error within the
+			 * last 75 2K sectors, we decrease the saved size
+			 * value.
+			 */
 			if (sector < get_capacity(info->disk) &&
 			    drive->probed_capacity - sector < 4 * 75)
 				set_capacity(info->disk, sector);

Would be nice if the CHS capacity workround was finally documented too? ;-)

MBR, Sergei

#2 lore raw
Quoted 27 lines · Sergei Shtylyov

Hello.

Quoted 5 lines · Bartlomiej Zolnierkiewicz

Just copy the comment from drivers/scsi/sr.c::sr_done() (from which the capacity hack has been originated).

drivers/ide/ide-cd.c static void cdrom_analyze_sense_data(ide · line 195

Quoted 12 lines

Index: b/drivers/ide/ide-cd.c
===================================================================

drivers/ide/ide-cd.c +4 -0
@@ -189,6 +189,14 @@ static void cdrom_analyze_sense_data(ide
 			bio_sectors = max(bio_sectors(failed_command->bio), 4U);
 			sector &= ~(bio_sectors - 1);
 
+			/*
+			 * The SCSI specification allows for the value
+			 * returned by READ CAPACITY to be up to 75 2K
+			 * sectors past the last readable block.
    Oh horror... :-)
Quoted 9 lines

drivers/ide/ide-cd.c static void cdrom_analyze_sense_data(ide · line 202

Quoted 7 lines
drivers/ide/ide-cd.c +4 -0
+			 * Therefore, if we hit a medium error within the
+			 * last 75 2K sectors, we decrease the saved size
+			 * value.
+			 */
 			if (sector < get_capacity(info->disk) &&
 			    drive->probed_capacity - sector < 4 * 75)
 				set_capacity(info->disk, sector);

Would be nice if the CHS capacity workround was finally documented too? ;-)

Send patches. I have my hands full of work...