From 6d706767ab2dde570f90faf66c737b7c2ffbd2bd Mon Sep 17 00:00:00 2001 From: Bhaskar Bora Date: Tue, 4 Feb 2025 13:18:00 -0500 Subject: [PATCH] updated variable name --- src/llfs/page_recycler.cpp | 23 ++++++++++----------- src/llfs/page_recycler.hpp | 2 +- src/llfs/page_recycler_recovery_visitor.cpp | 15 +++++++------- src/llfs/page_recycler_recovery_visitor.hpp | 4 ++-- 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/llfs/page_recycler.cpp b/src/llfs/page_recycler.cpp index 03cbbad..93c8892 100644 --- a/src/llfs/page_recycler.cpp +++ b/src/llfs/page_recycler.cpp @@ -178,7 +178,7 @@ StatusOr refresh_recycler_info_slot(TypedSlotWriter return std::unique_ptr{ new PageRecycler(scheduler, std::string{name}, page_deleter, std::move(*recovered_log), - std::move(latest_batch), std::move(state), visitor.largest_unique_offset(), + std::move(latest_batch), std::move(state), visitor.volume_trim_offset(), visitor.page_index() + 1)}; } @@ -203,7 +203,7 @@ PageRecycler::PageRecycler(batt::TaskScheduler& scheduler, const std::string& na , recycle_task_{} , metrics_{} , prepared_batch_{std::move(recovered_batch)} - , largest_offset_as_unique_identifier_{largest_offset_as_unique_identifier_init} + , volume_trim_slot_{largest_offset_as_unique_identifier_init} , largest_page_index_{page_index_init} { const PageRecyclerOptions& options = this->state_.no_lock().options; @@ -334,16 +334,16 @@ bool PageRecycler::is_page_recycling_allowed(const Slice& page_ids { // If we got higher offset allow recycle. // - if (this->largest_offset_as_unique_identifier_ < offset_as_unique_identifier) { + if (this->volume_trim_slot_ < offset_as_unique_identifier) { // Update the largest unique identifier and index. // - this->largest_offset_as_unique_identifier_ = offset_as_unique_identifier; + this->volume_trim_slot_ = offset_as_unique_identifier; this->largest_page_index_ = 0; return true; } // If we got same offset but not all pages were processed last time then allow recycle. // - else if (this->largest_offset_as_unique_identifier_ == offset_as_unique_identifier && + else if (this->volume_trim_slot_ == offset_as_unique_identifier && this->largest_page_index_ < page_ids.size()) { return true; } @@ -411,9 +411,9 @@ StatusOr PageRecycler::recycle_pages_depth_0( { auto locked_state = this->state_.lock(); // Writing to recycler log. - StatusOr append_slot = this->insert_to_log( - *local_grant, page_id, depth, this->largest_offset_as_unique_identifier_, - this->largest_page_index_, locked_state); + StatusOr append_slot = + this->insert_to_log(*local_grant, page_id, depth, this->volume_trim_slot_, + this->largest_page_index_, locked_state); BATT_REQUIRE_OK(append_slot); ++this->largest_page_index_; @@ -439,9 +439,8 @@ StatusOr PageRecycler::recycle_pages_depth_n(const Slicestate_.lock(); for (PageId page_id : page_ids) { // Writing to recycler log. - StatusOr append_slot = - this->insert_to_log(*grant, page_id, depth, this->largest_offset_as_unique_identifier_, - this->largest_page_index_, locked_state); + StatusOr append_slot = this->insert_to_log( + *grant, page_id, depth, this->volume_trim_slot_, this->largest_page_index_, locked_state); BATT_REQUIRE_OK(append_slot); this->last_page_recycle_offset_ = *append_slot; @@ -465,7 +464,7 @@ StatusOr PageRecycler::recycle_pages( << page_ids.size() << "]" << ", grant=[" << (grant ? grant->size() : usize{0}) << "], depth=" << depth << ") " << this->name_ << BATT_INSPECT(offset_as_unique_identifier) - << BATT_INSPECT(this->largest_offset_as_unique_identifier_) + << BATT_INSPECT(this->volume_trim_slot_) << BATT_INSPECT(this->last_page_recycle_offset_); if (page_ids.empty()) { diff --git a/src/llfs/page_recycler.hpp b/src/llfs/page_recycler.hpp index daabb6f..015848d 100644 --- a/src/llfs/page_recycler.hpp +++ b/src/llfs/page_recycler.hpp @@ -278,7 +278,7 @@ class PageRecycler Optional latest_batch_upper_bound_; - slot_offset_type largest_offset_as_unique_identifier_; + slot_offset_type volume_trim_slot_; u16 largest_page_index_; diff --git a/src/llfs/page_recycler_recovery_visitor.cpp b/src/llfs/page_recycler_recovery_visitor.cpp index e482b50..af23376 100644 --- a/src/llfs/page_recycler_recovery_visitor.cpp +++ b/src/llfs/page_recycler_recovery_visitor.cpp @@ -29,7 +29,7 @@ namespace llfs { , latest_batch_{} , recycler_uuid_{boost::uuids::random_generator{}()} , latest_info_refresh_slot_{} - , largest_offset_as_unique_identifier_{0} + , volume_trim_slot_{0} , largest_page_index_{0} { initialize_status_codes(); @@ -115,9 +115,9 @@ Optional PageRecyclerRecoveryVisitor::latest_info_refresh_slot() cons //==#==========+==+=+=++=+++++++++++-+-+--+----- --- -- - - - - // -slot_offset_type PageRecyclerRecoveryVisitor::largest_unique_offset() const +slot_offset_type PageRecyclerRecoveryVisitor::volume_trim_offset() const { - return this->largest_offset_as_unique_identifier_; + return this->volume_trim_slot_; } //==#==========+==+=+=++=+++++++++++-+-+--+----- --- -- - - - - @@ -133,8 +133,7 @@ Status PageRecyclerRecoveryVisitor::operator()(const SlotParse& slot, const PageToRecycle& recovered) { LLFS_VLOG(1) << "Recovered slot: " << slot.offset << " " << recovered - << BATT_INSPECT((bool)this->latest_batch_) - << BATT_INSPECT(this->largest_offset_as_unique_identifier_) + << BATT_INSPECT((bool)this->latest_batch_) << BATT_INSPECT(this->volume_trim_slot_) << BATT_INSPECT(this->largest_page_index_); // Add the new record, or verify that the existing one and the new one are equivalent. @@ -162,10 +161,10 @@ Status PageRecyclerRecoveryVisitor::operator()(const SlotParse& slot, // Save the largest unique offset identifier. Note that if offsets are same then we need to only // update the largest page_index. // - if (this->largest_offset_as_unique_identifier_ < recovered.offset_as_unique_identifier) { - this->largest_offset_as_unique_identifier_ = recovered.offset_as_unique_identifier; + if (this->volume_trim_slot_ < recovered.offset_as_unique_identifier) { + this->volume_trim_slot_ = recovered.offset_as_unique_identifier; this->largest_page_index_ = recovered.page_index; - } else if (this->largest_offset_as_unique_identifier_ == recovered.offset_as_unique_identifier && + } else if (this->volume_trim_slot_ == recovered.offset_as_unique_identifier && this->largest_page_index_ < recovered.page_index) { this->largest_page_index_ = recovered.page_index; } diff --git a/src/llfs/page_recycler_recovery_visitor.hpp b/src/llfs/page_recycler_recovery_visitor.hpp index 375684f..60c408f 100644 --- a/src/llfs/page_recycler_recovery_visitor.hpp +++ b/src/llfs/page_recycler_recovery_visitor.hpp @@ -45,7 +45,7 @@ class PageRecyclerRecoveryVisitor Optional latest_info_refresh_slot() const; - slot_offset_type largest_unique_offset() const; + slot_offset_type volume_trim_offset() const; u16 page_index() const; //+++++++++++-+-+--+----- --- -- - - - - @@ -85,7 +85,7 @@ class PageRecyclerRecoveryVisitor // This is to track largest unique_offset value during recovery. // - slot_offset_type largest_offset_as_unique_identifier_; + slot_offset_type volume_trim_slot_; // This tracks the largest page_index seen so far for a given offset. //