DiskWriteDriver: Remove use of atomic buffer

This commit is contained in:
Emily Brooks
2022-12-02 00:09:49 +00:00
committed by Kyle Schwarz
parent c97db0f35f
commit ed1632c652
8 changed files with 16 additions and 125 deletions
+1 -25
View File
@@ -23,38 +23,14 @@ public:
uint64_t pos, const uint8_t* from, uint64_t amount, std::chrono::milliseconds timeout = DefaultTimeout);
protected:
/**
* Flag returned from writeLogicalDiskAligned when the
* operation failed to be performed atomically and can
* be retried after rereading.
*/
static const uint64_t RetryAtomic;
/**
* The severity to report with when an atomic operation
* is requested that the driver is unable to attempt.
*/
static const APIEvent::Severity NonatomicSeverity;
/**
* Perform a write which the driver can do in one shot.
*
* The `pos` requested must be sector-aligned, and the `amount` must be
* within the block size bounds provided by the driver.
*
* If `atomicBuf` is provided, it will be used to ensure that the disk
* data changes from `atomicBuf` to `from` without trampling any reads
* that may have happened while modifying the data.
*
* The flag `RetryAtomic` is returned if the operation was attempted
* atomically but failed.
*
* If the driver does not support atomic operations, but `atomicBuf`
* is non-null, an APIEvent::AtomicOperationCompletedNonatomically
* should be reported with `NonatomicSeverity`.
*/
virtual std::optional<uint64_t> writeLogicalDiskAligned(Communication& com, device_eventhandler_t report,
uint64_t pos, const uint8_t* atomicBuf, const uint8_t* from, uint64_t amount, std::chrono::milliseconds timeout) = 0;
uint64_t pos, const uint8_t* from, uint64_t amount, std::chrono::milliseconds timeout) = 0;
};
} // namespace Disk