rbd-mirror: no need to perform extra image-meta filtering for image-state

The image-state now only stores non RBD-internal image-meta keys and only
non RBD-internal image-meta keys are returned from the image-meta helper
state machine.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
Jason Dillaman 2020-02-25 09:31:13 -05:00
parent ae2b13fe7f
commit 04ab492d43

View File

@ -9,7 +9,6 @@
#include "librbd/Operations.h"
#include "librbd/Utils.h"
#include "librbd/image/GetMetadataRequest.h"
#include "librbd/mirror/snapshot/Utils.h"
#include "tools/rbd_mirror/image_replayer/snapshot/Utils.h"
#include <boost/algorithm/string/predicate.hpp>
@ -169,12 +168,8 @@ void ApplyImageStateRequest<I>::handle_get_image_meta(int r) {
template <typename I>
void ApplyImageStateRequest<I>::update_image_meta() {
auto key_filter = librbd::mirror::snapshot::util::get_image_meta_key("");
std::set<std::string> keys_to_remove;
for (const auto& [key, value] : m_metadata) {
if (boost::starts_with(key, key_filter)) {
continue;
}
if (m_image_state.metadata.count(key) == 0) {
dout(15) << "removing image-meta key '" << key << "'" << dendl;
keys_to_remove.insert(key);
@ -183,10 +178,6 @@ void ApplyImageStateRequest<I>::update_image_meta() {
std::map<std::string, bufferlist> metadata_to_update;
for (const auto& [key, value] : m_image_state.metadata) {
if (boost::starts_with(key, key_filter)) {
continue;
}
auto it = m_metadata.find(key);
if (it == m_metadata.end() || !it->second.contents_equal(value)) {
dout(15) << "updating image-meta key '" << key << "'" << dendl;