aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/sr.c')
-rw-r--r--drivers/scsi/sr.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index eb61f7a70e1d..d6f340f48a3b 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -684,14 +684,20 @@ static void get_sectorsize(struct scsi_cd *cd)
684 cd->capacity = 0x1fffff; 684 cd->capacity = 0x1fffff;
685 sector_size = 2048; /* A guess, just in case */ 685 sector_size = 2048; /* A guess, just in case */
686 } else { 686 } else {
687#if 0 687 long last_written;
688 if (cdrom_get_last_written(&cd->cdi, 688
689 &cd->capacity)) 689 cd->capacity = 1 + ((buffer[0] << 24) | (buffer[1] << 16) |
690#endif 690 (buffer[2] << 8) | buffer[3]);
691 cd->capacity = 1 + ((buffer[0] << 24) | 691 /*
692 (buffer[1] << 16) | 692 * READ_CAPACITY doesn't return the correct size on
693 (buffer[2] << 8) | 693 * certain UDF media. If last_written is larger, use
694 buffer[3]); 694 * it instead.
695 *
696 * http://bugzilla.kernel.org/show_bug.cgi?id=9668
697 */
698 if (!cdrom_get_last_written(&cd->cdi, &last_written))
699 cd->capacity = max_t(long, cd->capacity, last_written);
700
695 sector_size = (buffer[4] << 24) | 701 sector_size = (buffer[4] << 24) |
696 (buffer[5] << 16) | (buffer[6] << 8) | buffer[7]; 702 (buffer[5] << 16) | (buffer[6] << 8) | buffer[7];
697 switch (sector_size) { 703 switch (sector_size) {