From owner-freebsd-geom@FreeBSD.ORG Sun Oct 2 12:47:06 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 C165C1065670 for ; Sun, 2 Oct 2011 12:47:06 +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 87E648FC13 for ; Sun, 2 Oct 2011 12:47:06 +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 560854AC1C for ; Sun, 2 Oct 2011 16:47:05 +0400 (MSD) Date: Sun, 2 Oct 2011 16:46:58 +0400 From: Lev Serebryakov Organization: FreeBSD X-Priority: 3 (Normal) Message-ID: <1608987289.20111002164658@serebryakov.spb.ru> To: freebsd-geom@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1251 Content-Transfer-Encoding: quoted-printable Cc: Subject: 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:47:06 -0000 Hello, Freebsd-geom. What is contract of struct bio passed to geom_start()? Why, for example, geom_nop (and all others) does clone like this: cbp =3D g_clone_bio(bp); if (cbp =3D=3D NULL) { g_io_deliver(bp, ENOMEM); return; } cbp->bio_done =3D g_std_done; cbp->bio_offset =3D bp->bio_offset + sc->sc_offset; cbp->bio_data =3D bp->bio_data; cbp->bio_length =3D bp->bio_length; pp =3D LIST_FIRST(&gp->provider); KASSERT(pp !=3D NULL, ("NULL pp")); cbp->bio_to =3D pp; G_NOP_LOGREQ(cbp, "Sending request."); g_io_request(cbp, LIST_FIRST(&gp->consumer)); And doesn't modify offset and other fields of original bio? And second question about this code. Here are lines: pp =3D LIST_FIRST(&gp->provider); KASSERT(pp !=3D NULL, ("NULL pp")); cbp->bio_to =3D pp; Which put pointer to NOP's provider to bio_to field. But later, g_io_request() reset this field to provider, which is aatached to target consumer: pp =3D cp->provider; ... bp->bio_to =3D pp; 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!)? --=20 // Black Lion AKA Lev Serebryakov