From 1754fc39086c52281d9b1c4b6a620b3c1dda4978 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Tue, 27 Mar 2018 17:11:57 +0800 Subject: [PATCH] common/hobject: compare two objects' key directly The original implement does not appear to be a problem for two different objects which are usually of different oids/names. However, for a specific head object and its posterity snap objects, this is not very effective since we are going to compare oids/names twice (because they are definitely equivalent). Signed-off-by: xie xingguo --- src/common/hobject.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/hobject.cc b/src/common/hobject.cc index 99b8b944097b..2c80727cf8a5 100644 --- a/src/common/hobject.cc +++ b/src/common/hobject.cc @@ -336,9 +336,9 @@ int cmp(const hobject_t& l, const hobject_t& r) return -1; if (l.nspace > r.nspace) return 1; - if (l.get_effective_key() < r.get_effective_key()) + if (l.get_key() < r.get_key()) return -1; - if (l.get_effective_key() > r.get_effective_key()) + if (l.get_key() > r.get_key()) return 1; if (l.oid < r.oid) return -1; -- 2.47.3