]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: use spg_t method to hash pg to (wq) shard
authorSage Weil <sage@redhat.com>
Thu, 2 Jun 2016 20:03:00 +0000 (16:03 -0400)
committerSage Weil <sage@redhat.com>
Fri, 3 Jun 2016 19:00:05 +0000 (15:00 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc
src/osd/osd_types.h

index d3404e7a70b3b920821445da9d7a703b288021b5..db015b0417dd5aa39166491791e2f1f4c9a71f0e 100644 (file)
@@ -8805,8 +8805,8 @@ void OSD::ShardedOpWQ::_process(uint32_t thread_index, heartbeat_handle_d *hb )
 }
 
 void OSD::ShardedOpWQ::_enqueue(pair<PGRef, PGQueueable> item) {
-
-  uint32_t shard_index = (((item.first)->get_pgid().ps())% shard_list.size());
+  uint32_t shard_index =
+    (item.first)->get_pgid().hash_to_shard(shard_list.size());
 
   ShardData* sdata = shard_list[shard_index];
   assert (NULL != sdata);
index 619a5e659f0db75320eae15595d42095f413b69c..fa33c9f0efbe262b46e9bbb856def1f53a9872c4 100644 (file)
@@ -511,6 +511,10 @@ struct spg_t {
       ghobject_t::NO_GEN,
       shard);
   }
+
+  unsigned hash_to_shard(unsigned num_shards) const {
+    return ps() % num_shards;
+  }
 };
 WRITE_CLASS_ENCODER(spg_t)
 WRITE_EQ_OPERATORS_2(spg_t, pgid, shard)