diff options
author | Sage Weil <sage.weil@dreamhost.com> | 2012-04-28 22:31:23 -0700 |
---|---|---|
committer | Sage Weil <sage.weil@dreamhost.com> | 2012-04-28 22:31:23 -0700 |
commit | ff9bce9724883fe784435a262790d29bcb5b4419 (patch) | |
tree | 3d6e13e1566b8064f81ee1ef2bffaa3ce32eb018 | |
parent | a13672f8042305d272d6f9666d3bd0517a0dcedc (diff) | |
download | ceph-ff9bce9724883fe784435a262790d29bcb5b4419.tar.gz |
osd: dirty_info if history.merge updated anything
In proc_replica_info and proc_primary_info, we may or may not update
the pg_info_t. If we do, set dirty_info, so that it will be recorded.
Same goes for when the primary pushes out updated stats to us.
Also, do not write a purged_snaps() update directory; rely on the caller
to write out dirty info.
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
-rw-r--r-- | src/osd/PG.cc | 12 | ||||
-rw-r--r-- | src/osd/osd_types.h | 30 |
2 files changed, 30 insertions, 12 deletions
diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 7c27ed7f992..cfe0698bd0c 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -235,7 +235,8 @@ bool PG::proc_replica_info(int from, pg_info_t &oinfo) might_have_unfound.insert(from); osd->unreg_last_pg_scrub(info.pgid, info.history.last_scrub_stamp); - info.history.merge(oinfo.history); + if (info.history.merge(oinfo.history)) + dirty_info = true; osd->reg_last_pg_scrub(info.pgid, info.history.last_scrub_stamp); // stray? @@ -3632,11 +3633,14 @@ void PG::proc_primary_info(ObjectStore::Transaction &t, const pg_info_t &oinfo) assert(!is_primary()); assert(is_stray() || is_active()); - if (info.last_backfill.is_max()) + if (info.last_backfill.is_max()) { info.stats = oinfo.stats; + dirty_info = true; + } osd->unreg_last_pg_scrub(info.pgid, info.history.last_scrub_stamp); - info.history.merge(oinfo.history); + if (info.history.merge(oinfo.history)) + dirty_info = true; osd->reg_last_pg_scrub(info.pgid, info.history.last_scrub_stamp); // Handle changes to purged_snaps ONLY IF we have caught up @@ -3651,7 +3655,7 @@ void PG::proc_primary_info(ObjectStore::Transaction &t, const pg_info_t &oinfo) << " removed " << p << dendl; adjust_local_snaps(); } - write_info(t); + dirty_info = true; } } diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 4381b1dec6b..b3493180862 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -940,20 +940,34 @@ struct pg_history_t { last_epoch_started(0), last_epoch_clean(0), last_epoch_split(0), same_up_since(0), same_interval_since(0), same_primary_since(0) {} - void merge(const pg_history_t &other) { + bool merge(const pg_history_t &other) { // Here, we only update the fields which cannot be calculated from the OSDmap. - if (epoch_created < other.epoch_created) + bool modified = false; + if (epoch_created < other.epoch_created) { epoch_created = other.epoch_created; - if (last_epoch_started < other.last_epoch_started) + modified = true; + } + if (last_epoch_started < other.last_epoch_started) { last_epoch_started = other.last_epoch_started; - if (last_epoch_clean < other.last_epoch_clean) + modified = true; + } + if (last_epoch_clean < other.last_epoch_clean) { last_epoch_clean = other.last_epoch_clean; - if (last_epoch_split < other.last_epoch_started) - last_epoch_split = other.last_epoch_started; - if (other.last_scrub > last_scrub) + modified = true; + } + if (last_epoch_split < other.last_epoch_started) { + last_epoch_split = other.last_epoch_started; + modified = true; + } + if (other.last_scrub > last_scrub) { last_scrub = other.last_scrub; - if (other.last_scrub_stamp > last_scrub_stamp) + modified = true; + } + if (other.last_scrub_stamp > last_scrub_stamp) { last_scrub_stamp = other.last_scrub_stamp; + modified = true; + } + return modified; } void encode(bufferlist& bl) const; |