From 7d9fd21e79d2739315ad15802bffd156dbf1be4a Mon Sep 17 00:00:00 2001 From: huangjun Date: Mon, 26 Dec 2016 19:36:26 +0800 Subject: [PATCH] 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 --- src/osd/PG.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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(); -- 2.39.5