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 = g_clone_bio(bp);
if (cbp == NULL) {
g_io_deliver(bp, ENOMEM);
return;
}
cbp->bio_done = g_std_done;
cbp->bio_offset = bp->bio_offset + sc->sc_offset;
cbp->bio_data = bp->bio_data;
cbp->bio_length = bp->bio_length;
pp = LIST_FIRST(&gp->provider);
KASSERT(pp != NULL, ("NULL pp"));
cbp->bio_to = 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 = LIST_FIRST(&gp->provider);
KASSERT(pp != NULL, ("NULL pp"));
cbp->bio_to = 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 = cp->provider;
...
bp->bio_to = 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!)?
--
// 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>
