From: xie xingguo Date: Mon, 17 Jun 2019 03:05:31 +0000 (+0800) Subject: osd: do not invalidate clear_regions of missing item at boot X-Git-Tag: v15.1.0~1813^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F29755%2Fhead;p=ceph.git osd: do not invalidate clear_regions of missing item at boot Seems we'll always mark clear_regions as all dirty when reading pg logs and missing items off the disk, which as a result turns incremental recovery off by default. Also using std::move seems to be a bit more efficient and robust here. Signed-off-by: xie xingguo --- diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index 81927870976c..fc7ffd48aa72 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -1402,7 +1402,7 @@ public: if (item.is_delete()) { ceph_assert(missing.may_include_deletes); } - missing.add(oid, item.need, item.have, item.is_delete()); + missing.add(oid, std::move(item)); } else if (p->key().substr(0, 4) == string("dup_")) { pg_log_dup_t dup; decode(dup, bp); @@ -1650,7 +1650,7 @@ public: if (item.is_delete()) { ceph_assert(missing.may_include_deletes); } - missing.add(oid, item.need, item.have, item.is_delete()); + missing.add(oid, std::move(item)); } else if (p.first.substr(0, 4) == string("dup_")) { pg_log_dup_t dup; decode(dup, bp); diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 3e5e71ccdfab..8aeef17ad011 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -4522,6 +4522,12 @@ public: tracker.changed(oid); } + void add(const hobject_t& oid, pg_missing_item&& item) { + rmissing[item.need.version] = oid; + missing.insert({oid, std::move(item)}); + tracker.changed(oid); + } + void rm(const hobject_t& oid, eversion_t v) { std::map::iterator p = missing.find(oid); if (p != missing.end() && p->second.need <= v)