]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: remove redundant onode parameter in ExtentMap methods 12394/head
authorIgor Fedotov <ifedotov@mirantis.com>
Thu, 8 Dec 2016 17:20:16 +0000 (17:20 +0000)
committerIgor Fedotov <ifedotov@mirantis.com>
Wed, 14 Dec 2016 16:21:42 +0000 (16:21 +0000)
Signed-off-by: Igor Fedotov <ifedotov@mirantis.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index eb1ef0c1bfe1b93bec89524fa1f4a44e04675a84..5c5039e61d57f796901a0eacaa5f5e4a63b4b57a 100644 (file)
@@ -1576,12 +1576,11 @@ BlueStore::ExtentMap::ExtentMap(Onode *o)
     inline_bl(g_conf->bluestore_extent_map_inline_shard_prealloc_size) {
 }
 
-bool BlueStore::ExtentMap::update(Onode *o,
-                                  KeyValueDB::Transaction t,
+bool BlueStore::ExtentMap::update(KeyValueDB::Transaction t,
                                   bool force)
 {
   assert(!needs_reshard);
-  if (o->onode.extent_map_shards.empty()) {
+  if (onode->onode.extent_map_shards.empty()) {
     if (inline_bl.length() == 0) {
       unsigned n;
       // we need to encode inline_bl to measure encoded length
@@ -1669,7 +1668,7 @@ bool BlueStore::ExtentMap::update(Onode *o,
   return false;
 }
 
-void BlueStore::ExtentMap::reshard(Onode *o, uint64_t min_alloc_size)
+void BlueStore::ExtentMap::reshard(uint64_t min_alloc_size)
 {
   needs_reshard = false;
 
@@ -1684,15 +1683,15 @@ void BlueStore::ExtentMap::reshard(Onode *o, uint64_t min_alloc_size)
   if (extent_map.size() <= 1) {
     dout(20) << __func__ << " <= 1 extent, going inline" << dendl;
     shards.clear();
-    o->onode.extent_map_shards.clear();
+    onode->onode.extent_map_shards.clear();
     return;
   }
 
   unsigned bytes = 0;
-  if (o->onode.extent_map_shards.empty()) {
+  if (onode->onode.extent_map_shards.empty()) {
     bytes = inline_bl.length();
   } else {
-    for (auto &s : o->onode.extent_map_shards) {
+    for (auto &s : onode->onode.extent_map_shards) {
       bytes += s.bytes;
     }
   }
@@ -1734,17 +1733,17 @@ void BlueStore::ExtentMap::reshard(Onode *o, uint64_t min_alloc_size)
       max_blob_end = be;
     }
   }
-  o->onode.extent_map_shards.swap(new_shard_info);
+  onode->onode.extent_map_shards.swap(new_shard_info);
 
   // set up new shards vector; ensure shards/inline both dirty/invalidated.
-  init_shards(o, true, true);
+  init_shards(true, true);
   inline_bl.clear();
 
   // identify spanning blobs
-  if (!o->onode.extent_map_shards.empty()) {
+  if (!onode->onode.extent_map_shards.empty()) {
     dout(20) << __func__ << " checking for spanning blobs" << dendl;
-    auto sp = o->onode.extent_map_shards.begin();
-    auto esp = o->onode.extent_map_shards.end();
+    auto sp = onode->onode.extent_map_shards.begin();
+    auto esp = onode->onode.extent_map_shards.end();
     unsigned shard_start = 0;
     unsigned shard_end;
     ++sp;
@@ -1997,12 +1996,12 @@ void BlueStore::ExtentMap::decode_spanning_blobs(
   }
 }
 
-void BlueStore::ExtentMap::init_shards(Onode *on, bool loaded, bool dirty)
+void BlueStore::ExtentMap::init_shards(bool loaded, bool dirty)
 {
-  shards.resize(on->onode.extent_map_shards.size());
+  shards.resize(onode->onode.extent_map_shards.size());
   unsigned i = 0;
-  for (auto &s : on->onode.extent_map_shards) {
-    get_extent_shard_key(on->key, s.offset, &shards[i].key);
+  for (auto &s : onode->onode.extent_map_shards) {
+    get_extent_shard_key(onode->key, s.offset, &shards[i].key);
     shards[i].offset = s.offset;
     shards[i].shard_info = &s;
     shards[i].loaded = loaded;
@@ -2437,7 +2436,7 @@ BlueStore::OnodeRef BlueStore::Collection::get_onode(
       denc(on->extent_map.inline_bl, p);
       on->extent_map.decode_some(on->extent_map.inline_bl);
     } else {
-      on->extent_map.init_shards(on, false, false);
+      on->extent_map.init_shards(false, false);
     }
   }
   o.reset(on);
@@ -6372,7 +6371,7 @@ void BlueStore::_txc_write_nodes(TransContext *txc, KeyValueDB::Transaction t)
     // finalize extent_map shards
     bool reshard = o->extent_map.needs_reshard;
     if (!reshard) {
-      reshard = o->extent_map.update(o.get(), t, false);
+      reshard = o->extent_map.update(t, false);
     }
     if (reshard) {
       dout(20) << __func__ << "  resharding extents for " << o->oid << dendl;
@@ -6380,8 +6379,8 @@ void BlueStore::_txc_write_nodes(TransContext *txc, KeyValueDB::Transaction t)
        t->rmkey(PREFIX_OBJ, s.key);
       }
       o->extent_map.fault_range(db, 0, o->onode.size);
-      o->extent_map.reshard(o.get(), min_alloc_size);
-      reshard = o->extent_map.update(o.get(), t, true);
+      o->extent_map.reshard(min_alloc_size);
+      reshard = o->extent_map.update(t, true);
       if (reshard) {
        dout(20) << __func__ << " warning: still wants reshard, check options?"
                 << dendl;
index 07fe50bc0b89f1ee1c0e05646d1d3aff77f0c727..ca444550aec1045c85c327a80178e14a25d2e27b 100644 (file)
@@ -675,11 +675,11 @@ public:
       return p->second;
     }
 
-    bool update(Onode *on, KeyValueDB::Transaction t, bool force);
-    void reshard(Onode *on, uint64_t min_alloc_size);
+    bool update(KeyValueDB::Transaction t, bool force);
+    void reshard(uint64_t min_alloc_size);
 
     /// initialize Shards from the onode
-    void init_shards(Onode *on, bool loaded, bool dirty);
+    void init_shards(bool loaded, bool dirty);
 
     /// return index of shard containing offset
     /// or -1 if not found