]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ECBackend: Send write message to peers first, then do local write 12522/head
authorhuangjun <hjwsm1989@gmail.com>
Fri, 16 Dec 2016 09:33:26 +0000 (17:33 +0800)
committerhuangjun <hjwsm1989@gmail.com>
Fri, 16 Dec 2016 09:33:26 +0000 (17:33 +0800)
  Like ReplicatedBackend did, this will improve write performance.

Signed-off-by: huangjun <hjwsm1989@gmail.com>
src/osd/ECBackend.cc

index c579a47f08629778bd296ee955d0970baa02ee39..3791e362b7076a1d786e9509c2e788f22114c74b 100644 (file)
@@ -1884,7 +1884,8 @@ bool ECBackend::try_reads_to_commit()
 
   dout(10) << "onreadable_sync: " << op->on_local_applied_sync << dendl;
   ObjectStore::Transaction empty;
-
+  bool should_write_local = false;
+  ECSubWrite local_write_op;
   for (set<pg_shard_t>::const_iterator i =
         get_parent()->get_actingbackfill_shards().begin();
        i != get_parent()->get_actingbackfill_shards().end();
@@ -1916,12 +1917,8 @@ bool ECBackend::try_reads_to_commit()
       op->temp_cleared,
       !should_send);
     if (*i == get_parent()->whoami_shard()) {
-      handle_sub_write(
-       get_parent()->whoami_shard(),
-       op->client_op,
-       sop,
-       op->on_local_applied_sync);
-      op->on_local_applied_sync = 0;
+      should_write_local = true;
+      local_write_op.claim(sop);
     } else {
       MOSDECSubOpWrite *r = new MOSDECSubOpWrite(sop);
       r->pgid = spg_t(get_parent()->primary_spg_t().pgid, i->shard);
@@ -1930,6 +1927,14 @@ bool ECBackend::try_reads_to_commit()
        i->osd, r, get_parent()->get_epoch());
     }
   }
+  if (should_write_local) {
+      handle_sub_write(
+       get_parent()->whoami_shard(),
+       op->client_op,
+       local_write_op,
+       op->on_local_applied_sync);
+      op->on_local_applied_sync = 0;
+  }
 
   for (auto i = op->on_write.begin();
        i != op->on_write.end();