Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Apr 2010 17:43:17 +0200
From:      Ivan Voras <ivoras@freebsd.org>
To:        freebsd-geom@freebsd.org
Subject:   Re: Read/write GMIRROR metadata
Message-ID:  <hpq6am$ogf$1@dough.gmane.org>
In-Reply-To: <BLU0-SMTP401B53789F38FEAF59BA60AD150@phx.gbl>
References:  <BLU0-SMTP401B53789F38FEAF59BA60AD150@phx.gbl>

next in thread | previous in thread | raw e-mail | index | archive | help

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.






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?hpq6am$ogf$1>