Subject: Re: WD_SOFTBADSECT & WD_QUIRK_FORCE_LBA48 usage (a few more questions)
To: None <email@example.com>
From: Manuel Bouyer <firstname.lastname@example.org>
Date: 10/07/2005 13:18:47
On Thu, Oct 06, 2005 at 09:00:16PM -0400, email@example.com wrote:
> Thanks Manuel -- one more question concerning WD_SOFTBADSECT & your
> >A bad sector will be remapped on write. But if it's in the bad block
> >the driver will return an I/O error on write without sending the
> >command to the disk. So bad sectors will never be remapped once they've
> >been recorded in the kernel bad sector list.
> When does the driver add a block to its bad sector list?
> Is it anytime there's a read *or* write error after X many retries?
> Also, we're currently using a fairly 'old' wd.c driver & 1.6 NetBSD
> kernel; Nov 1, 2002 to be exact.
> How difficult would it be to pickup the WD_SOFTBADSECT specific changes,
> especially if there are several dependent files for the
It shouldn't be difficult. I think the only place affected is wd.c, and
this file should not have changed much since 1.6.
You will also have to add the related commands to dkctl but it should not be
> >>How would I remap a bad
> >>sector when using WD_SOFTBADSECT?
> >First flush the bad sector list with atactl, then do a write to this
> On a running system, the bad sector list will grow over time (assuming
> there are bad blocks).
> Is it *safe* to run atactl at any time, or does one have to
> shutdown/reboot the system first?
You can run it at any time (if you can't that's a bug). Rebooting the
system will also clear the bad block list.
And I was wrong, it's dkctl, not atactl to use for this.
> I guess this would imply that the bad sector list is persistent.
No, it's not.
> How can I (the application) do a write to the bad sector?
Using dd on the raw device, with seek and count to write only that sector.
> Can I obtain the bad sector list from the driver?
Yes, dkctl badsector list
> Is this all made transparent by the file-system?
No. The filesystem will still see I/O errors when trying to read those sectors
(it's not a sector remapping). The list is there only to avoid sending a
command to the drive to a known bad sector, because with the retries it can
stall the system for up to a few 10s of seconds (I've seen drives take
several seconds to handle a command to a bad sector and return status).
Manuel Bouyer <firstname.lastname@example.org>
NetBSD: 26 ans d'experience feront toujours la difference