Skip to content

Commit

Permalink
Upgrade to latest batteries; support non-raw writes for IoRing::File. (
Browse files Browse the repository at this point in the history
…#130)

* Upgrade to latest batteries; support non-raw writes for IoRing::File.

* Fix build breakage.
  • Loading branch information
tonyastolfi authored Nov 6, 2023
1 parent 382b918 commit 8b16fea
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def requirements(self):
"gtest/1.14.0",
"boost/1.83.0",
"glog/0.6.0",
"batteries/0.48.1",
"batteries/0.48.2",
"cli11/2.3.2",
]

Expand Down
6 changes: 4 additions & 2 deletions src/llfs/ioring_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ Status IoRing::File::write_all(i64 offset, ConstBuffer buffer)
Status IoRing::File::write_all_fixed(i64 offset, ConstBuffer buffer, int buf_index)
{
while (buffer.size() != 0) {
BATT_CHECK_EQ(batt::round_down_bits(Self::kBlockAlignmentLog2, offset), offset);
BATT_CHECK_EQ(batt::round_down_bits(Self::kBlockAlignmentLog2, buffer.size()), buffer.size());
if (this->raw_io_) {
BATT_CHECK_EQ(batt::round_down_bits(Self::kBlockAlignmentLog2, offset), offset);
BATT_CHECK_EQ(batt::round_down_bits(Self::kBlockAlignmentLog2, buffer.size()), buffer.size());
}
StatusOr<i32> n_written = batt::Task::await<StatusOr<i32>>([&](auto&& handler) {
this->async_write_some_fixed(offset, buffer, buf_index, BATT_FORWARD(handler));
});
Expand Down
11 changes: 10 additions & 1 deletion src/llfs/page_allocator.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,10 @@ class PageAllocatorModel
return;
}

static std::atomic<usize> step_count{0};
++step_count;
LLFS_LOG_INFO_EVERY_N(25000) << BATT_INSPECT(step_count);

LLFS_VLOG(2) << "Entered PageAllocatorModel::step()";

this->state_.crash_count += 1;
Expand Down Expand Up @@ -564,7 +568,12 @@ class PageAllocatorModel

usize max_concurrency() const override
{
static const int n = batt::getenv_as<int>("MODEL_CHECK_THREADS").value_or(4);
static const int n = [] {
int n_model_check_threads = batt::getenv_as<int>("MODEL_CHECK_THREADS").value_or(4);
LLFS_LOG_INFO() << BATT_INSPECT(n_model_check_threads);
return n_model_check_threads;
}();

return n;
}

Expand Down

0 comments on commit 8b16fea

Please sign in to comment.