From: huangjun Date: Mon, 26 Dec 2016 11:36:26 +0000 (+0800) Subject: osd/PG: add new have_unfound() function in MissingLoc X-Git-Tag: v12.0.0~353^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7d9fd21e79d2739315ad15802bffd156dbf1be4a;p=ceph.git osd/PG: add new have_unfound() function in MissingLoc No need to lookup all objects in needs_recovery_map if only want to know whether if there are unfound objects. Signed-off-by: huangjun --- diff --git a/src/osd/PG.h b/src/osd/PG.h index 883af9158d1..5860e267eea 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -376,6 +376,16 @@ public: return ret; } + bool have_unfound() const { + for (map::const_iterator i = + needs_recovery_map.begin(); + i != needs_recovery_map.end(); + ++i) { + if (is_unfound(i->first)) + return true; + } + return false; + } void clear() { needs_recovery_map.clear(); missing_loc.clear(); @@ -1041,7 +1051,7 @@ public: void proc_primary_info(ObjectStore::Transaction &t, const pg_info_t &info); bool have_unfound() const { - return missing_loc.num_unfound() > 0; + return missing_loc.have_unfound(); } int get_num_unfound() const { return missing_loc.num_unfound();