Subject: Re: sd rereads
To: Chris G. Demetriou <cgd@netbsd.org>
From: Bill Studenmund <wrstuden@nas.nasa.gov>
List: tech-kern
Date: 09/01/1999 11:19:49
On 1 Sep 1999, Chris G. Demetriou wrote:

> Manuel Bouyer <bouyer@antioche.lip6.fr> writes:
> If the kernel, for any disk driver, keeps the label across last-close
> of all partitions on the disk, it's broken.  If somebody wants to add
> an option to set a sticky in-core label, that might be a good idea,
> but aside from that the label should be cleared at every
> last-close-of-all-partitions.

How about this for a compromise: on re-open, we check to see if the
diskabel block has changed and only recompute the in-core disklabel if
it's changed.

So on "first open" (going from 0 to 1 open partitions), we read the
disklabel block and checksum it (CRC or sum or whatever we like). If we
have a valid in-core disklabel and this checksum matches the one from it,
then we continue to use the in-core label. If the checksum differs, we
remember this new checksum and then recompute the in-core disklabel.

I think this would cover both the "I faked up a disklabel and want it to
persist" and "I just dd'd a new disk image onto the drive" cases.

Thoughts?

Take care,

Bill