Skip to content

Commit

Permalink
Code review feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyastolfi committed May 14, 2024
1 parent 22c0213 commit 2745fb2
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 18 deletions.
8 changes: 5 additions & 3 deletions src/llfs/ioring_log_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ struct IoRingLogConfig {

/** \brief Constructs and returns a config based on a given logical size.
*
* The block size is assumed to be IoRingLogConfig::kDefaultBlockSize unless otherwise specified.
* The physical offset is assumed to be 0 unless otherwise specified. In all cases physical size
* is derived from logical size and block size.
* The block size defaults to IoRingLogConfig::kDefaultBlockSize.
* The physical offset defaults to 0.
* In all cases physical size is derived from logical size and block size.
*
* \return the new IoRingLogConfig
*/
static IoRingLogConfig from_logical_size(u64 logical_size, Optional<usize> opt_block_size = None,
Optional<i64> opt_physical_offset = None);
Expand Down
9 changes: 8 additions & 1 deletion src/llfs/ioring_log_device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,14 @@ class IoRingLogDeviceFactory : public LogDeviceFactory

BATT_ASSIGN_OK_RESULT(DefaultIoRingLogDeviceStorage storage,
DefaultIoRingLogDeviceStorage::make_new(
MaxQueueDepth{calculate.queue_depth() * 2}, this->fd_));
MaxQueueDepth{
calculate.queue_depth() * 2
//
// Double the number of flush ops, to give us some margin so the
// rings don't ever run out of space (TODO [tastolfi 2024-05-14]
// this seems excessive; investigate lowering this)
},
this->fd_));

this->fd_ = -1;

Expand Down
16 changes: 2 additions & 14 deletions src/llfs/ioring_log_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,7 @@ class BasicIoRingLogDriver
return this->flush_pos_.get_value();
}

StatusOr<slot_offset_type> await_flush_pos(slot_offset_type flush_pos)
{
StatusOr<slot_offset_type> status_or = await_slot_offset(flush_pos, this->flush_pos_);

// If the flush_pos Watch has been closed, it may indicate there was an I/O error; check the
// LogStorageDriverContext and report any error status we find.
//
if (status_or.status() == batt::StatusCode::kClosed) {
BATT_REQUIRE_OK(this->context_.get_error_status());
}

return status_or;
}
StatusOr<slot_offset_type> await_flush_pos(slot_offset_type flush_pos);

//----

Expand Down Expand Up @@ -276,7 +264,7 @@ class BasicIoRingLogDriver
*/
void storage_work_started();

/** \brief Signals that storage I/O work is now the in process of shutting down. The first time
/** \brief Signals that storage I/O work is now in the process of shutting down. The first time
* this is called (after this->storage_work_started()), calls this->storage_.on_work_finished() to
* decrement the work count, allowing the storage I/O event loop to exit once all activity has
* completed.
Expand Down
18 changes: 18 additions & 0 deletions src/llfs/ioring_log_driver.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,24 @@ inline Status BasicIoRingLogDriver<FlushOpImpl, StorageT>::set_trim_pos(slot_off
return OkStatus();
}

//==#==========+==+=+=++=+++++++++++-+-+--+----- --- -- - - - -
//
template <template <typename> class FlushOpImpl, typename StorageT>
inline StatusOr<slot_offset_type> BasicIoRingLogDriver<FlushOpImpl, StorageT>::await_flush_pos(
slot_offset_type flush_pos)
{
StatusOr<slot_offset_type> status_or = await_slot_offset(flush_pos, this->flush_pos_);

// If the flush_pos Watch has been closed, it may indicate there was an I/O error; check the
// LogStorageDriverContext and report any error status we find.
//
if (status_or.status() == batt::StatusCode::kClosed) {
BATT_REQUIRE_OK(this->context_.get_error_status());
}

return status_or;
}

//==#==========+==+=+=++=+++++++++++-+-+--+----- --- -- - - - -
//
template <template <typename> class FlushOpImpl, typename StorageT>
Expand Down

0 comments on commit 2745fb2

Please sign in to comment.