From: Yan, Zheng Date: Mon, 17 Oct 2016 07:09:45 +0000 (+0800) Subject: mds: remove useless code in inode_backtrace_t::compare X-Git-Tag: v11.1.0~516^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0c8fec323e59984b7a17e57450dc978e2dbf8bd3;p=ceph.git mds: remove useless code in inode_backtrace_t::compare if (ancestors[i-1].version < other.ancestors[i-1].version), variable comparator must be -1. if (ancestors[i-1].version < other.ancestors[i-1].version), variable comparator must be 1. Signed-off-by: Yan, Zheng --- diff --git a/src/mds/inode_backtrace.cc b/src/mds/inode_backtrace.cc index c6023dfa48e9..314f1751b5e0 100644 --- a/src/mds/inode_backtrace.cc +++ b/src/mds/inode_backtrace.cc @@ -145,18 +145,7 @@ int inode_backtrace_t::compare(const inode_backtrace_t& other, if (ancestors[i].dirino != other.ancestors[i].dirino || ancestors[i].dname != other.ancestors[i].dname) { *equivalent = false; - if (ancestors[i-1].version < other.ancestors[i-1].version) { - if (comparator > 0) - *divergent = true; - return -1; - } else if (ancestors[i-1].version > other.ancestors[i-1].version) { - if (comparator < 0) - *divergent = true; - return 1; - } else { - assert(ancestors[i-1].version == other.ancestors[i-1].version); - return 0; - } + return comparator; } else if (ancestors[i].version > other.ancestors[i].version) { if (comparator < 0) *divergent = true;