getting from bio to buf in dastrategy()

Poul-Henning Kamp phk at phk.freebsd.dk
Mon Aug 11 22:28:28 PDT 2003


In message <3F384C66.6060205 at andrew.cmu.edu>, Eno Thereska writes:


> >>in /sys/cam/scsi/scsi_da.c the dastrategy()
> >>function takes as an argument "struct bio* bp"
> >>Now I need to get to the "struct *buf" that bp
> >>belongs to.
>
> >You can't do that, there may not be any struct buf.
>
>How can a bio exist on it's own, unrelated to any buf?
>Would that be a special case or does that happen all the
>time? A concrete example would help.

struct buf represents a block in the cache/VM system.

struct bio represents a disk I/O request.

For historical reasons, a buf contains a bio, but that is by
no means the only way to create a bio.

Throughout geom bio's are created a destroyed which have no
relation to any specific buf, for instance to read the key
sectors in gbde.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-hackers mailing list