From 2a7f497531a6fb32781e7e0df4c63a90fda760f0 Mon Sep 17 00:00:00 2001 From: Changcheng Liu Date: Thu, 7 Jan 2021 17:00:47 +0800 Subject: [PATCH] librbd/cache/pwl: fix parameter type to update argument Signed-off-by: Changcheng Liu --- src/librbd/cache/pwl/AbstractWriteLog.cc | 10 +++++----- src/librbd/cache/pwl/AbstractWriteLog.h | 2 +- src/librbd/cache/pwl/rwl/WriteLog.cc | 2 +- src/librbd/cache/pwl/ssd/WriteLog.cc | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/librbd/cache/pwl/AbstractWriteLog.cc b/src/librbd/cache/pwl/AbstractWriteLog.cc index 9a15b05788a1d..e038a3fd65d1b 100644 --- a/src/librbd/cache/pwl/AbstractWriteLog.cc +++ b/src/librbd/cache/pwl/AbstractWriteLog.cc @@ -338,7 +338,7 @@ void AbstractWriteLog::arm_periodic_stats() { } template -void AbstractWriteLog::update_entries(std::shared_ptr log_entry, +void AbstractWriteLog::update_entries(std::shared_ptr *log_entry, WriteLogCacheEntry *cache_entry, std::map &missing_sync_points, std::map> &sync_point_entries, int entry_index) { @@ -347,7 +347,7 @@ void AbstractWriteLog::update_entries(std::shared_ptr log_en ldout(m_image_ctx.cct, 20) << "Entry " << entry_index << " is a sync point. cache_entry=[" << *cache_entry << "]" << dendl; auto sync_point_entry = std::make_shared(cache_entry->sync_gen_number); - log_entry = sync_point_entry; + *log_entry = sync_point_entry; sync_point_entries[cache_entry->sync_gen_number] = sync_point_entry; missing_sync_points.erase(cache_entry->sync_gen_number); m_current_sync_gen = cache_entry->sync_gen_number; @@ -357,7 +357,7 @@ void AbstractWriteLog::update_entries(std::shared_ptr log_en auto write_entry = m_builder->create_write_log_entry(nullptr, cache_entry->image_offset_bytes, cache_entry->write_bytes); write_data_to_buffer(write_entry, cache_entry); - log_entry = write_entry; + *log_entry = write_entry; } else if (cache_entry->is_writesame()) { ldout(m_image_ctx.cct, 20) << "Entry " << entry_index << " is a write same. cache_entry=[" << *cache_entry << "]" << dendl; @@ -365,14 +365,14 @@ void AbstractWriteLog::update_entries(std::shared_ptr log_en m_builder->create_writesame_log_entry(nullptr, cache_entry->image_offset_bytes, cache_entry->write_bytes, cache_entry->ws_datalen); write_data_to_buffer(ws_entry, cache_entry); - log_entry = ws_entry; + *log_entry = ws_entry; } else if (cache_entry->is_discard()) { ldout(m_image_ctx.cct, 20) << "Entry " << entry_index << " is a discard. cache_entry=[" << *cache_entry << "]" << dendl; auto discard_entry = std::make_shared(nullptr, cache_entry->image_offset_bytes, cache_entry->write_bytes, m_discard_granularity_bytes); - log_entry = discard_entry; + *log_entry = discard_entry; } else { lderr(m_image_ctx.cct) << "Unexpected entry type in entry " << entry_index << ", cache_entry=[" << *cache_entry << "]" << dendl; diff --git a/src/librbd/cache/pwl/AbstractWriteLog.h b/src/librbd/cache/pwl/AbstractWriteLog.h index 52b24dee3c298..60accc47ce1da 100644 --- a/src/librbd/cache/pwl/AbstractWriteLog.h +++ b/src/librbd/cache/pwl/AbstractWriteLog.h @@ -331,7 +331,7 @@ class AbstractWriteLog { void wake_up(); void update_entries( - std::shared_ptr log_entry, + std::shared_ptr *log_entry, pwl::WriteLogCacheEntry *cache_entry, std::map &missing_sync_points, std::map::load_existing_entries(DeferredContexts &later) { std::shared_ptr log_entry = nullptr; ceph_assert(pmem_entry->entry_index == entry_index); - this->update_entries(log_entry, pmem_entry, missing_sync_points, + this->update_entries(&log_entry, pmem_entry, missing_sync_points, sync_point_entries, entry_index); log_entry->ram_entry = *pmem_entry; diff --git a/src/librbd/cache/pwl/ssd/WriteLog.cc b/src/librbd/cache/pwl/ssd/WriteLog.cc index c7d56f3dd3d53..8458831248913 100644 --- a/src/librbd/cache/pwl/ssd/WriteLog.cc +++ b/src/librbd/cache/pwl/ssd/WriteLog.cc @@ -270,7 +270,7 @@ void WriteLog::load_existing_entries(pwl::DeferredContexts &later) { std::shared_ptr log_entry = nullptr; for (auto it = ssd_log_entries.begin(); it != ssd_log_entries.end(); ++it) { - this->update_entries(log_entry, &*it, missing_sync_points, + this->update_entries(&log_entry, &*it, missing_sync_points, sync_point_entries, curr_log_pos); log_entry->ram_entry = *it; log_entry->log_entry_index = curr_log_pos;