Loading fs_mgr/libsnapshot/cow_reader.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -237,6 +237,7 @@ void CowReader::InitializeMerge() { [](CowOperation& op) { return IsMetadataOp(op); }), ops_.get()->end()); set_total_data_ops(ops_->size()); // We will re-arrange the vector in such a way that // kernel can batch merge. Ex: // Loading fs_mgr/libsnapshot/include/libsnapshot/cow_reader.h +5 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,10 @@ class CowReader : public ICowReader { void InitializeMerge(); void set_total_data_ops(uint64_t size) { total_data_ops_ = size; } uint64_t total_data_ops() { return total_data_ops_; } private: bool ParseOps(std::optional<uint64_t> label); Loading @@ -152,6 +156,7 @@ class CowReader : public ICowReader { uint64_t fd_size_; std::optional<uint64_t> last_label_; std::shared_ptr<std::vector<CowOperation>> ops_; uint64_t total_data_ops_; }; } // namespace snapshot Loading fs_mgr/libsnapshot/snapuserd.cpp +17 −1 Original line number Diff line number Diff line Loading @@ -424,6 +424,7 @@ bool Snapuserd::ProcessMergeComplete(chunk_t chunk, void* buffer) { } SNAP_LOG(DEBUG) << "Merge success: " << merged_ops_cur_iter << "chunk: " << chunk; merge_initiated_ = true; return true; } Loading @@ -445,6 +446,19 @@ chunk_t Snapuserd::GetNextAllocatableChunkId(chunk_t chunk) { return next_chunk; } void Snapuserd::CheckMergeCompletionStatus() { CowHeader header; if (merge_initiated_) { reader_->GetHeader(&header); SNAP_LOG(INFO) << "Merge-status: Total-Merged-ops: " << header.num_merge_ops << " Total-data-ops: " << reader_->total_data_ops(); } else { SNAP_LOG(INFO) << "Merge was not initiated. Total-Merged-ops: " << header.num_merge_ops << " Total-data-ops: " << reader_->total_data_ops(); } } /* * Read the metadata from COW device and * construct the metadata as required by the kernel. Loading Loading @@ -818,11 +832,13 @@ bool Snapuserd::ReadMetadata() { << " Num Sector: " << ChunkToSector(data_chunk_id) << " Replace-ops: " << replace_ops << " Zero-ops: " << zero_ops << " Copy-ops: " << copy_ops << " Areas: " << vec_.size() << " Num-ops-merged: " << header.num_merge_ops; << " Num-ops-merged: " << header.num_merge_ops << " Total-data-ops: " << reader_->total_data_ops(); // Total number of sectors required for creating dm-user device num_sectors_ = ChunkToSector(data_chunk_id); metadata_read_done_ = true; merge_initiated_ = false; return true; } Loading fs_mgr/libsnapshot/snapuserd.h +2 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ class Snapuserd final { const std::string& GetMiscName() { return misc_name_; } uint64_t GetNumSectors() { return num_sectors_; } bool IsAttached() const { return ctrl_fd_ >= 0; } void CheckMergeCompletionStatus(); void CloseFds() { ctrl_fd_ = {}; cow_fd_ = {}; Loading Loading @@ -141,6 +142,7 @@ class Snapuserd final { std::map<sector_t, const CowOperation*> chunk_map_; bool metadata_read_done_ = false; bool merge_initiated_ = false; BufferSink bufsink_; }; Loading fs_mgr/libsnapshot/snapuserd_server.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -214,6 +214,7 @@ void SnapuserdServer::RunThread(std::shared_ptr<DmUserHandler> handler) { auto misc_name = handler->misc_name(); LOG(INFO) << "Handler thread about to exit: " << misc_name; handler->snapuserd()->CheckMergeCompletionStatus(); { std::lock_guard<std::mutex> lock(lock_); Loading Loading
fs_mgr/libsnapshot/cow_reader.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -237,6 +237,7 @@ void CowReader::InitializeMerge() { [](CowOperation& op) { return IsMetadataOp(op); }), ops_.get()->end()); set_total_data_ops(ops_->size()); // We will re-arrange the vector in such a way that // kernel can batch merge. Ex: // Loading
fs_mgr/libsnapshot/include/libsnapshot/cow_reader.h +5 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,10 @@ class CowReader : public ICowReader { void InitializeMerge(); void set_total_data_ops(uint64_t size) { total_data_ops_ = size; } uint64_t total_data_ops() { return total_data_ops_; } private: bool ParseOps(std::optional<uint64_t> label); Loading @@ -152,6 +156,7 @@ class CowReader : public ICowReader { uint64_t fd_size_; std::optional<uint64_t> last_label_; std::shared_ptr<std::vector<CowOperation>> ops_; uint64_t total_data_ops_; }; } // namespace snapshot Loading
fs_mgr/libsnapshot/snapuserd.cpp +17 −1 Original line number Diff line number Diff line Loading @@ -424,6 +424,7 @@ bool Snapuserd::ProcessMergeComplete(chunk_t chunk, void* buffer) { } SNAP_LOG(DEBUG) << "Merge success: " << merged_ops_cur_iter << "chunk: " << chunk; merge_initiated_ = true; return true; } Loading @@ -445,6 +446,19 @@ chunk_t Snapuserd::GetNextAllocatableChunkId(chunk_t chunk) { return next_chunk; } void Snapuserd::CheckMergeCompletionStatus() { CowHeader header; if (merge_initiated_) { reader_->GetHeader(&header); SNAP_LOG(INFO) << "Merge-status: Total-Merged-ops: " << header.num_merge_ops << " Total-data-ops: " << reader_->total_data_ops(); } else { SNAP_LOG(INFO) << "Merge was not initiated. Total-Merged-ops: " << header.num_merge_ops << " Total-data-ops: " << reader_->total_data_ops(); } } /* * Read the metadata from COW device and * construct the metadata as required by the kernel. Loading Loading @@ -818,11 +832,13 @@ bool Snapuserd::ReadMetadata() { << " Num Sector: " << ChunkToSector(data_chunk_id) << " Replace-ops: " << replace_ops << " Zero-ops: " << zero_ops << " Copy-ops: " << copy_ops << " Areas: " << vec_.size() << " Num-ops-merged: " << header.num_merge_ops; << " Num-ops-merged: " << header.num_merge_ops << " Total-data-ops: " << reader_->total_data_ops(); // Total number of sectors required for creating dm-user device num_sectors_ = ChunkToSector(data_chunk_id); metadata_read_done_ = true; merge_initiated_ = false; return true; } Loading
fs_mgr/libsnapshot/snapuserd.h +2 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ class Snapuserd final { const std::string& GetMiscName() { return misc_name_; } uint64_t GetNumSectors() { return num_sectors_; } bool IsAttached() const { return ctrl_fd_ >= 0; } void CheckMergeCompletionStatus(); void CloseFds() { ctrl_fd_ = {}; cow_fd_ = {}; Loading Loading @@ -141,6 +142,7 @@ class Snapuserd final { std::map<sector_t, const CowOperation*> chunk_map_; bool metadata_read_done_ = false; bool merge_initiated_ = false; BufferSink bufsink_; }; Loading
fs_mgr/libsnapshot/snapuserd_server.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -214,6 +214,7 @@ void SnapuserdServer::RunThread(std::shared_ptr<DmUserHandler> handler) { auto misc_name = handler->misc_name(); LOG(INFO) << "Handler thread about to exit: " << misc_name; handler->snapuserd()->CheckMergeCompletionStatus(); { std::lock_guard<std::mutex> lock(lock_); Loading