Re: 2.9test9-mm1 and DAO ATAPI cd-burning corrupt

Linus Torvalds
2003-11-13T15:22:43Z

On Thu, 13 Nov 2003, Jens Axboe wrote:

> On Thu, Nov 13 2003, Pascal Schmidt wrote:
> >
> > My patch from yesterday should handle that situation.
> > cdrom_get_last_written is allowed to override the capacity from
> > cdrom_read_capacity.
>
> Yep, that is fine.

Well, there is a good argument for not bothering with the
"cdrom_get_last_written" at all: the SCSI layer never does anything like
that as far as I can see, so arguably everybody who ever used ide-scsi
would only ever have seen the READ_CAPACITY command be used. And nobody
ever complained about bad capacitites as far as I can remember..

But I might have missed something in the SCSI driver. But I actually see a

if (cdrom_get_last_written(..)

in sr.c, and it's been #if 0'ed out since before the Bitkeeper tree
started. And that code definitely does the READ_CAPACITY first.

The "sd.c" code (which is what a MO device would use) obviously doesn't do
cdrom_get_last_written either - it just does a READ_CAPACITY. (Well, it
does a READ_CAPACITY_16 if it hits a really big disk, but that only hits
if the disk has more than 4G sectors, so we can ignore it for CD-ROM's for
a while.

So I'd argue for just dropping the cdrom_get_last_written() call entirely.

Linus