Updating 'bio_completed' field in case of unwritten LBA

John-Mark Gurney jmg at funkthat.com
Tue Dec 29 20:31:39 UTC 2020

Arka Sharma wrote this message on Tue, Dec 29, 2020 at 11:17 +0530:
> Sorry if this is not the right place to ask this question. I am writing a

the -geom list is a better place, I have cc'd it there for more visibility...

> driver which creates a disk instance and processes bio's coming from GEOM.
> GEOM can send read requests for LBA's which are yet to be written. In this
> case should we update the 'bio_completed' field in bio instance sent by
> GEOM ?

If by not yet written, you're talking about a fresh disk device, that has
never been written to, and reads are issued to blocks?  If so, this is
expected as FreeBSD doesn't know when the dev appears if it's fresh or
not...  The reads are part of a process called tasting, and it reads
data to find out information about the dev, like if it's part of a
mirror, or the partitions that are on it and the like...

If this is the case, then, I'd suggest you driver return all zero's,
that is zero out the buffer, and update the read as if it worked...

If you return an error (like geli does when using authenticated
encryption), there are many parts of the kernel that will not handle
that gracefully...  (Just realized that'd be a useful mode for geli
to have, to return zeros for failed authentication.)

  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."

More information about the freebsd-hackers mailing list