Keep the ds_skip_* fields in struct diskslice properly synchronized.
commitbcec449be66c716b354c1bb6ed1692ab5e9c019c
authorMatthew Dillon <dillon@dragonflybsd.org>
Sat, 19 May 2007 09:46:18 +0000 (19 09:46 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Sat, 19 May 2007 09:46:18 +0000 (19 09:46 +0000)
tree97180c8bb616bdd845062a4eab2bf0eb592e8eae
parent47adaa0390ac78f4aa84422ce8fcccc9cf9ab929
Keep the ds_skip_* fields in struct diskslice properly synchronized.
ds_skip_bsdlabel is inclusive of bsd_skip_platform but was being improperly
set to 0 even when an mbr reserved sector existed.  The fields were not
being properly reset for a slice whos disklabel is destroyed.

Defer reading the disklabel on a slice until a partition on the slice
is opened or a disklabel related DIOC ioctl is performed on the slice.
In particular, we do not attempt to read the disklabel when opening the
whole-disk-slice for the whole disk or the whole-slice-partition for a slice.

Previously the code attempted to scan all available BSD slices for
disklabels.

When writing to a raw slice, do not snoop or do reserved-sector checks
unless a disklabel has been loaded for the slice.  Typically a disklabel
will only be loaded in two situations: (1) if filesystems are mounted from
that slice or (2) the disklabel program has performed ioctls on the
whole-slice-partition to set a disklabel.  Now writing to raw slices works
almost the same as writing to the whole-disk-slice, with no interpretation.

Remove all remaining references to the LABELSECTOR constant.  Instead,
use the ds_skip_* fields to determine the sector where the disklabel
starts within a slice.  These changes significantly cleaned up the
snoop and reserved sector checking code in dscheck().
sys/kern/subr_diskmbr.c
sys/kern/subr_diskslice.c