]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: pass map to write_info instead of txn
authorSage Weil <sage@redhat.com>
Wed, 4 Mar 2015 23:16:27 +0000 (15:16 -0800)
committerSage Weil <sage@redhat.com>
Wed, 25 Mar 2015 17:32:02 +0000 (10:32 -0700)
No real change yet.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/PG.cc
src/osd/PG.h

index 0ba5902a83d37cc8b21aefeba1eb9bfadc0553c9..3118db191792c23e30c7d0dcf5dd3db194c378c6 100644 (file)
@@ -2699,32 +2699,28 @@ void PG::_upgrade_v7(ObjectStore *store, const interval_set<snapid_t> &snapcolls
   }
 }
 
-int PG::_write_info(ObjectStore::Transaction& t, epoch_t epoch,
-                   pg_info_t &info, coll_t coll,
-                   map<epoch_t,pg_interval_t> &past_intervals,
-                   ghobject_t &pgmeta_oid,
-                   bool dirty_big_info)
+int PG::_prepare_write_info(map<string,bufferlist> *km,
+                           epoch_t epoch,
+                           pg_info_t &info, coll_t coll,
+                           map<epoch_t,pg_interval_t> &past_intervals,
+                           ghobject_t &pgmeta_oid,
+                           bool dirty_big_info)
 {
-  // pg state
-  map<string,bufferlist> v;
-
   // info.  store purged_snaps separately.
   interval_set<snapid_t> purged_snaps;
-  ::encode(epoch, v[epoch_key]);
+  ::encode(epoch, (*km)[epoch_key]);
   purged_snaps.swap(info.purged_snaps);
-  ::encode(info, v[info_key]);
+  ::encode(info, (*km)[info_key]);
   purged_snaps.swap(info.purged_snaps);
 
   if (dirty_big_info) {
     // potentially big stuff
-    bufferlist& bigbl = v[biginfo_key];
+    bufferlist& bigbl = (*km)[biginfo_key];
     ::encode(past_intervals, bigbl);
     ::encode(info.purged_snaps, bigbl);
     //dout(20) << "write_info bigbl " << bigbl.length() << dendl;
   }
 
-  t.omap_setkeys(coll, pgmeta_oid, v);
-
   return 0;
 }
 
@@ -2757,14 +2753,14 @@ void PG::_init(ObjectStore::Transaction& t, spg_t pgid, const pg_pool_t *pool)
   t.omap_setkeys(coll, pgmeta_oid, values);
 }
 
-void PG::write_info(ObjectStore::Transaction& t)
+void PG::prepare_write_info(map<string,bufferlist> *km)
 {
   info.stats.stats.add(unstable_stats);
   unstable_stats.clear();
 
-  int ret = _write_info(t, get_osdmap()->get_epoch(), info, coll,
-                       past_intervals, pgmeta_oid,
-                       dirty_big_info);
+  int ret = _prepare_write_info(km, get_osdmap()->get_epoch(), info, coll,
+                               past_intervals, pgmeta_oid,
+                               dirty_big_info);
   assert(ret == 0);
   last_persisted_osdmap_ref = osdmap_ref;
 
@@ -2867,8 +2863,11 @@ epoch_t PG::peek_map_epoch(ObjectStore *store,
 
 void PG::write_if_dirty(ObjectStore::Transaction& t)
 {
-  if (dirty_big_info || dirty_info)
-    write_info(t);
+  map<string,bufferlist> km;
+  if (dirty_big_info || dirty_info) {
+    prepare_write_info(&km);
+    t.omap_setkeys(coll, pgmeta_oid, km);
+  }
   pg_log.write_log(t, coll, pgmeta_oid);
 }
 
index 5ea1f098d61411ad070f0302e5afae95b61a8074..c213a5015a694988ce018107471d3003eb0e0d20 100644 (file)
@@ -2107,10 +2107,11 @@ public:
                    spg_t pgid, const pg_pool_t *pool);
 
 private:
-  void write_info(ObjectStore::Transaction& t);
+  void prepare_write_info(map<string,bufferlist> *km);
 
 public:
-  static int _write_info(ObjectStore::Transaction& t, epoch_t epoch,
+  static int _prepare_write_info(map<string,bufferlist> *km,
+    epoch_t epoch,
     pg_info_t &info, coll_t coll,
     map<epoch_t,pg_interval_t> &past_intervals,
     ghobject_t &pgmeta_oid,