Re: is there any Hard-disk shock-protection for 2.6.18 and above?

Jens Axboe
2006-11-30T18:42:55Z

On Mon, Nov 27 2006, Elias Oltmanns wrote:
> Jens Axboe <jens.axboe@oracle.com> wrote:
> > On Tue, Nov 21 2006, Pavel Machek wrote:
> >> Hi!
> >>
> [...]
> >> > After some googeling and digging in gamne i read that someone said that
> >> > there are plans for some generic support for HD-parking in the kernel
> >> > and thus making such patches obsolete.
> [...]
> >> I'm afraid we need your help with development here. Porting old patch
> >> to 2.6.19-rc6 should be easy, and then you can start 'how do I
> >> makethis generic' debate.
> >
> > 2.6.19 will finally have the generic block layer commands, so this can
> > be implemented properly.
>
> Eventually, I've ported the patch to 2.6.19-rc6 (attached). However,
> I'll need some gentle guidance by you developers for the next steps,
> I'm afraid. What exactly do you mean by "making this generic".
> Perhaps, you could give me a hint as to which generic block layer
> commands you have in mind that should be used in such a patch.

If you look in <linux/blkdev.h>, you can see the definition of
REQ_TYPE_LINUX_BLOCK and the current sub commands (none are implemented
right now). So you want to add REQ_LB_OPT_PARK (or whatever the name
should be) to implement the freezing operation, and then add support for
the drivers to understand this command and do what they need to do. You
can add block layer helpers to perform the freezing of the actual queue,
to be called when the PARK command completes. You can handle the queue
draining for tagged devices like the barriers do for FUA barriers.

--
Jens Axboe