Updating 'bio_completed' field in case of unwritten LBA

Konstantin Belousov kostikbel at gmail.com
Tue Dec 29 10:56:37 UTC 2020

On Tue, Dec 29, 2020 at 11:17:48AM +0530, Arka Sharma wrote:
> Hi All,
> Sorry if this is not the right place to ask this question. I am writing a
> 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 ?
Disk must execute the BIO command according to its state at the moment
the command is processed.  Why does it matter was the block written or
not ?

If you write a driver for the storage that implements some kind of
allocate on write, you need to also allocate on read, and define the
state of the block if it was not written yet.  Typically such (virtual)
storages read the newly allocated block as all zeros.

More information about the freebsd-hackers mailing list