From owner-freebsd-geom@FreeBSD.ORG Sat Apr 10 15:43:36 2010 Return-Path: Delivered-To: freebsd-geom@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 082A0106566C for ; Sat, 10 Apr 2010 15:43:36 +0000 (UTC) (envelope-from gcubfg-freebsd-geom@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id 890498FC1B for ; Sat, 10 Apr 2010 15:43:35 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1O0cqH-0000B3-TJ for freebsd-geom@freebsd.org; Sat, 10 Apr 2010 17:43:29 +0200 Received: from 78-1-170-229.adsl.net.t-com.hr ([78.1.170.229]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 10 Apr 2010 17:43:29 +0200 Received: from ivoras by 78-1-170-229.adsl.net.t-com.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 10 Apr 2010 17:43:29 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-geom@freebsd.org From: Ivan Voras Date: Sat, 10 Apr 2010 17:43:17 +0200 Lines: 42 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 78-1-170-229.adsl.net.t-com.hr User-Agent: Thunderbird 2.0.0.21 (X11/20090612) In-Reply-To: Subject: Re: Read/write GMIRROR metadata X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2010 15:43:36 -0000 Alfredo Elvira wrote: > Hello, >=20 > i=C2=B4m developing a patch for geom mirror module to acelerate synchro= nizing > between providers, using bitmaps to write in the provider only modified= > data since the last rebuilding. >=20 > I have a trouble in the first access to the new provider attached, > before mirror creation, when i execute gmirror label .... >=20 > 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=C2= =B4t Usually, the first time your code gets to taste the device before it's=20 labeled, e.g. when it first appears in the system, etc. Then, when=20 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=20 see if they can use it. > understand "who" and "when" have been written these metadata, because i= n > debugging mode, i=C2=B4ve 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=20 kernel code in sync, and this also goes for metadata structures. After=20 the userland does "label", it usually (except for "clean") does not=20 touch the metadata - from there on it's all kernel.