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