Date: Sun, 2 Oct 2011 16:56:30 +0400 From: Lev Serebryakov <lev@FreeBSD.org> To: Lev Serebryakov <lev@FreeBSD.org> Cc: freebsd-geom@FreeBSD.org Subject: Re: What is geom_start() and struct bio contract? Message-ID: <1554151528.20111002165630@serebryakov.spb.ru> In-Reply-To: <1608987289.20111002164658@serebryakov.spb.ru> References: <1608987289.20111002164658@serebryakov.spb.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <lev@FreeBSD.org>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1554151528.20111002165630>
