Read/write GMIRROR metadata

Ivan Voras ivoras at freebsd.org
Sat Apr 10 15:43:36 UTC 2010


Alfredo Elvira wrote:
> Hello,
> 
> i´m developing a patch for geom mirror module to acelerate synchronizing
> between providers, using bitmaps to write in the provider only modified
> data since the last rebuilding.
> 
> I have a trouble in the first access to the new provider attached,
> before mirror creation, when i execute gmirror label ....
> 
> When the first clean disk is attached, the system runs the
> g_mirror_taste function for two times. The first one, there are not
> valid metadata for mirror class and g_mirror_read_metadata function
> returns error 22. But the second one, valid metadata are read. I don´t

Usually, the first time your code gets to taste the device before it's 
labeled, e.g. when it first appears in the system, etc. Then, when 
something opens the device for writing and then closes is ("spoils it"), 
all GEOM classes are given the opportunity to taste the device again to 
see if they can use it.

> understand "who" and "when" have been written these metadata, because in
> debugging mode, i´ve set breakpoints in functions that write data in
> provider (g_mirror_write_metadata and g_write_data) and "aparently"
> these are not called.

Metadata in the "label" step is done in userland, by the gmirror utility 
(or more specifically, /lib/geom/geom_mirror.so).

The usual situation is like this: you need to keep the userland and the 
kernel code in sync, and this also goes for metadata structures. After 
the userland does "label", it usually (except for "clean") does not 
touch the metadata - from there on it's all kernel.





More information about the freebsd-geom mailing list