From: huangjun Date: Fri, 16 Dec 2016 09:33:26 +0000 (+0800) Subject: osd/ECBackend: Send write message to peers first, then do local write X-Git-Tag: v12.0.0~339^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7858f7e355c5fcf926e6b7a070862fb031b63992;p=ceph.git osd/ECBackend: Send write message to peers first, then do local write Like ReplicatedBackend did, this will improve write performance. Signed-off-by: huangjun --- diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc index c579a47f086..3791e362b70 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -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::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();