Re: Quick question about libata and hdparm

From: Michael Tokarev
Date: Sun Apr 19 2009 - 09:07:14 EST


Jeff Garzik wrote:
Michael Tokarev wrote:
Mark Lord wrote:
[]
Nearly all of the hdparm flags work fine with libata and SATA/PATA drives.
Among the *very few* that do not, are the -m and -d flags. -c will be working
in the newest kernels, but not yet in most distro kernels.

The -d flag is not permitted by libata, as the kernel prefers to completely
dictate DMA / PIO, and it does do a rather good job of it.

Well, the kernel does a good job here in *almost* all cases.
The problematic case is when a device has some bad/unreadable
blocks/sectors. When such a place occurs on read, libata
(or whatever it is) performs several retries, each time
using "less aggressive" settings - like reducing UDMA and
PIO mode till the lowest possible PIO/33. And the device
stays in that mode until reboot, even if the problematic
sector has been relocated. So it'd be nice to be able to
reset the mode back in such cases.

Do you have a log?

Hmm. Just a week ago I were reading several bad disks - one
dying drive from a laptop with many bad blocks on it and several
scsi drives that were in a server room where an airconditioner
failed and ambient temp were as high as 78C. Ran that off an
rescue cd, without any permanent storage to save logs. It was
quite time-consuming process - I had to use ddrescue to recover
data, and I had to reboot several times to get the (sata) disk
to work in UDMA6 mode again (ddrescue saves state and resumes
from place it were stopped before). So no - I don't have logs
right now even if I saw it very recently.

libata worries about speed changes for CRC errors and the like, not for media errors that involve sector relocation.

Maybe I were not clear enough. The relocation event were triggered
especially *after* failure to read the bad block(s). I tried to
read the bad blocks with ddrescue, during which drive returned
"media error" (in case of scsi drives) and - probably, but i'm
not sure - crc errors in case of sata, and libata (in case of
sata) reduced the mode the drive is working at and retried.
Later on I just wrote something to the problematic place to
trigger relocation and continued, but the drive (now reading
good portions) stays in PIO/33 mode anyway, which is slow and
I had to reboot to speed it up again.

So it seems there's no disagreement - the drive actually returned
something similar to CRC errors, and it has nothing to do with
sector relocation.

What I mean by mentioning relocated sectors is that the drive
stays in "lower" mode after - even if the problematic sector
is fixed already.

But this is not something you encounter 20 times a day, hopefully :)

/mjt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/