what is an "in-core" disklabel ?
Robert Bonomi
bonomi at mail.r-bonomi.com
Mon Oct 8 16:23:20 UTC 2012
> Date: Mon, 08 Oct 2012 17:14:20 +0200
> From: "Lucas B. Cohen" <lbc at bnrlabs.com>
> Subject: what is an "in-core" disklabel ?
>
> Hi,
>
> I've seen the term "in-core" a couple times while reading up about BSD
> disk labels. Does it refer to data that is cached in kernel memory ?
>
> Context examples :
>
> - fdisk(8) outputs "parameters extracted from in-core disklabel"
>
> - bsdlabel(8)'s manual explains that the -n (dry run) parameter "does
> not install the new label either in-core or on-disk".
'cached' is not _technically_ exactly accurate, but you have the concept
basically correct.
The O/S reads the label information and stores it in an internal data
structure, Then, when it needs to use that data (frequently!:) it uses
the values in that internal structure, rather than attempting to re-read
from the disk, itself.
Technically, it's _not_ "cached" -- cached data is used to short-circuit
a 'read' attempt, using an in-memory block of byte instead of an actual
disk transfer.
The -effect- is similar, but there are *important* differences. 'Cache'
data is integrated with I/O operations, and a _write_ to the place where
the data was read from -invalidates- the cached data, whereupon, the next
read attempt will *not* be short-circuited, and the actual on-disk data
will be returned.
In the case of the disk label, it is read (once) into the internal data
structure, and only the internal data is used after that. A userland
app can change the 'on disk' data -- or trash it completely -- and what
the O/S "thinks" the label info is will NOT be affected by that change
to the 'on disk' data.
The warnings you see in the documentation, are reminders that the
O/S's 'internal' data and the 'on disk' data are *NOT* necessarily
the same. That looking at _one_ source of that data does *not* guarantee
that what you see =there= is the same as what is in the other place.
More information about the freebsd-questions
mailing list