Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide
translations



Rockbox mail archive

Subject: Read errors (was:Power Save feature kills playlist playback)

Read errors (was:Power Save feature kills playlist playback)

From: Björn Stenberg <bjorn_at_haxx.se>
Date: Wed, 12 Mar 2003 09:36:24 +0100

Mike Holden wrote:
> Basically in file.c:readwrite(), if we read some head
> data (cached from an earlier disk read), then we should return that data
> successfully, even if we subsequently get a disk error. At the moment, we
> return < 0, even though we have put data in the buffer.

Yes, the code treats read errors atomically, i.e. any error means the entire request failed and must be retried. This is a design decision. The result buffer is only valid if the return code >= 0.

You are right that there is a bug in that the next successful read() call will not return those head bytes that were copied by the previous, failed, call. But this will result in up to 511 bytes missing from the file, which will produce a short "blip" in the playback, not freeze it.

> There is also another problem, which I believe is probably in the
> ata_read_sectors() code. I have not yet debugged this (not easy!), but I
> suspect that the hardware is reading less sectors than we requested, but
> has still read some sectors.

Yes, that is possible. Errors can occur at any of the requested sectors.

> We are assuming we have read it all

Not if there is an error. On error, we assume nothing has been read and submit the complete read request again.

If the disk says "OK" when in fact there was an error, then the disk is faulty and there is not much we can do about that.

> Is there anybody here who understands what is going on with this
> code (Linux, Daniel etc?).

I wrote all disk code.

> It would be good to get this bug nailed before 2.0 goes out

I agree. My problem, as stated before, is that I *never* get this and thus it's very difficult for me to do any form of testing.

I would like everyone who has this problem to be careful to separate between "black freeze" and "red freeze". I.e. is the red light on or off when this happens? If the light is on, it's a problem in the ata driver code. If the light is off, it's a problem in the file or even mpeg code.

-- 
Björn
Received on 2003-03-12

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy