summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage.weil@dreamhost.com>2012-04-29 07:57:10 -0700
committerSage Weil <sage.weil@dreamhost.com>2012-04-29 08:11:24 -0700
commit3e84ce862ef2cdbe7ffc36e3f79cc07fb442f34a (patch)
treed2cdeb71dcb83f4f9f214ceeb9ca7d477b5c4a94
parentfc8ce16a84aeb0026399d51a5ab8f7f184f67a8b (diff)
downloadceph-3e84ce862ef2cdbe7ffc36e3f79cc07fb442f34a.tar.gz
osd: use PG::write_if_dirty() helper
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
-rw-r--r--src/osd/OSD.cc17
-rw-r--r--src/osd/PG.cc8
-rw-r--r--src/osd/PG.h2
3 files changed, 17 insertions, 10 deletions
diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc
index f47d27719ed..0b93793ea47 100644
--- a/src/osd/OSD.cc
+++ b/src/osd/OSD.cc
@@ -3295,8 +3295,7 @@ void OSD::handle_osd_map(MOSDMap *m)
i++) {
PG *pg = i->second;
pg->lock_with_map_lock_held();
- if (pg->dirty_info)
- pg->write_info(t);
+ pg->write_if_dirty(t);
pg->unlock();
}
}
@@ -3613,8 +3612,7 @@ void OSD::activate_map(ObjectStore::Transaction& t, list<Context*>& tfin)
PG::RecoveryCtx rctx(&query_map, &info_map, &notify_list, &tfin, &t);
pg->handle_activate_map(&rctx);
- if (pg->dirty_info)
- pg->write_info(t);
+ pg->write_if_dirty(t);
pg->unlock();
}
@@ -3929,6 +3927,7 @@ void OSD::do_split(PG *parent, set<pg_t>& childpgids, ObjectStore::Transaction&
for (map<pg_t,PG*>::iterator q = children.begin(); q != children.end(); q++) {
PG *pg = q->second;
pg->handle_create(&rctx);
+ pg->write_if_dirty(t);
wake_pg_waiters(pg->info.pgid);
pg->unlock();
}
@@ -4148,6 +4147,7 @@ void OSD::handle_pg_create(OpRequestRef op)
wake_pg_waiters(pg->info.pgid);
PG::RecoveryCtx rctx(&query_map, &info_map, 0, &fin->contexts, t);
pg->handle_create(&rctx);
+ pg->write_if_dirty(*t);
pg->update_stats();
int tr = store->queue_transaction(&pg->osr, t, new ObjectStore::C_DeleteTransaction(t), fin);
@@ -4274,8 +4274,7 @@ void OSD::handle_pg_notify(OpRequestRef op)
PG::RecoveryCtx rctx(&query_map, &info_map, 0, &fin->contexts, t);
pg->handle_notify(from, it->first, &rctx);
- if (pg->dirty_info)
- pg->write_info(*t);
+ pg->write_if_dirty(*t);
int tr = store->queue_transaction(&pg->osr, t, new ObjectStore::C_DeleteTransaction(t), fin);
assert(tr == 0);
@@ -4323,8 +4322,7 @@ void OSD::handle_pg_log(OpRequestRef op)
map< int, MOSDPGInfo* > info_map;
PG::RecoveryCtx rctx(&query_map, &info_map, 0, &fin->contexts, t);
pg->handle_log(from, m, &rctx);
- if (pg->dirty_info)
- pg->write_info(*t);
+ pg->write_if_dirty(*t);
pg->unlock();
do_queries(query_map);
do_infos(info_map);
@@ -4374,8 +4372,7 @@ void OSD::handle_pg_info(OpRequestRef op)
PG::RecoveryCtx rctx(0, &info_map, 0, &fin->contexts, t);
pg->handle_info(from, p->first, &rctx);
- if (pg->dirty_info)
- pg->write_info(*t);
+ pg->write_if_dirty(*t);
int tr = store->queue_transaction(&pg->osr, t, new ObjectStore::C_DeleteTransaction(t), fin);
assert(!tr);
diff --git a/src/osd/PG.cc b/src/osd/PG.cc
index cfe0698bd0c..b447dd80675 100644
--- a/src/osd/PG.cc
+++ b/src/osd/PG.cc
@@ -1906,6 +1906,14 @@ void PG::write_log(ObjectStore::Transaction& t)
dirty_log = false;
}
+void PG::write_if_dirty(ObjectStore::Transaction& t)
+{
+ if (dirty_info)
+ write_info(t);
+ if (dirty_log)
+ write_log(t);
+}
+
void PG::trim(ObjectStore::Transaction& t, eversion_t trim_to)
{
// trim?
diff --git a/src/osd/PG.h b/src/osd/PG.h
index c9975f04f37..6b107bdb550 100644
--- a/src/osd/PG.h
+++ b/src/osd/PG.h
@@ -1299,6 +1299,8 @@ public:
void write_info(ObjectStore::Transaction& t);
void write_log(ObjectStore::Transaction& t);
+ void write_if_dirty(ObjectStore::Transaction& t);
+
void add_log_entry(pg_log_entry_t& e, bufferlist& log_bl);
void append_log(vector<pg_log_entry_t>& logv, eversion_t trim_to, ObjectStore::Transaction &t);