Design Strategy
The SEF Library is nearly stateless. Nearly all application requests result in one or more requests to the SEF driver. Those requests are submitted using the caller's thread. The completion of asynchronous SEF driver requests is handled by an internal, statically sized thread pool based on the number of CPUs. Therefore, completion routines should not block on resources that require another completion routine to execute as that would risk deadlock. Issuing a synchronous request or waiting for a resource owned by another completion thread won't cause deadlock, but it does reduce the number of threads available to process completions.
Writes to a SEF Unit complete before the final flash memory address has been assigned, returning a preliminary flash address. A notification is sent when the final flash memory address is different than the preliminary address. However, no direct notification is sent when the preliminary flash memory address is the final flash memory address. It can be inferred by utilizing buffer release notifications. The write buffer supplied to the device must remain valid until the data is committed to flash memory. The write call includes a flag that causes notifications to be sent as portions of the buffer have been committed to flash memory. When a buffer release notification is sent, the preliminary addresses for that portion are final, or a notification was already sent for the actual final flash address. In the case of a power failure, up-to-date metadata structures can be rebuilt from the user address data and write serial numbers supplied when the data was written.