From owner-freebsd-geom@FreeBSD.ORG Sun Oct 2 12:56:43 2011 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 B978E1065675; Sun, 2 Oct 2011 12:56:43 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from onlyone.friendlyhosting.spb.ru (onlyone.friendlyhosting.spb.ru [IPv6:2a01:4f8:131:60a2::2]) by mx1.freebsd.org (Postfix) with ESMTP id 7E4278FC0C; Sun, 2 Oct 2011 12:56:43 +0000 (UTC) Received: from lion.home.serebryakov.spb.ru (unknown [IPv6:2001:470:923f:1:906c:6af3:5301:18c6]) (Authenticated sender: lev@serebryakov.spb.ru) by onlyone.friendlyhosting.spb.ru (Postfix) with ESMTPA id 20D264AC1C; Sun, 2 Oct 2011 16:56:36 +0400 (MSD) Date: Sun, 2 Oct 2011 16:56:30 +0400 From: Lev Serebryakov Organization: FreeBSD X-Priority: 3 (Normal) Message-ID: <1554151528.20111002165630@serebryakov.spb.ru> To: Lev Serebryakov In-Reply-To: <1608987289.20111002164658@serebryakov.spb.ru> References: <1608987289.20111002164658@serebryakov.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1251 Content-Transfer-Encoding: quoted-printable Cc: freebsd-geom@FreeBSD.org Subject: Re: What is geom_start() and struct bio contract? X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: lev@FreeBSD.org List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Oct 2011 12:56:43 -0000 Hello, Lev. You wrote 2 =EE=EA=F2=FF=E1=F0=FF 2011 =E3., 16:46:58: > Is it Ok? What should store this field? If it should store provider, > which ISSUED this bio, why g_io_request() reset it? If it should > store provider, which will EXECUTE this bio, why geom_nop set it to > itself provider, and why is here this field at all, as it could be > derived from bio_from (it seems, that it is always set to > bio_from->provider!)? On the other hand, bio_done() is called only if bio_from is NULL, and any bio issued with g_io_request() could not have bio_form set to NULL: g_io_request(struct bio *bp, struct g_consumer *cp) { struct g_provider *pp; int first; KASSERT(cp !=3D NULL, ("NULL cp in g_io_request")); ... bp->bio_from =3D cp; ... } void g_io_deliver(struct bio *bp, int error) { struct g_consumer *cp; struct g_provider *pp; ... cp =3D bp->bio_from; if (cp =3D=3D NULL) { bp->bio_error =3D error; bp->bio_done(bp); return; } ... } I'm completely puzzled, how does it work at all! Many GEOMs set bio_done to their done utilities, and then submit bio with g_io_request() and it seems to work! But why?! I could not understand this from quoted code! --=20 // Black Lion AKA Lev Serebryakov