diff options
author | Sage Weil <sage@inktank.com> | 2013-06-04 22:42:52 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-06-04 22:43:04 -0700 |
commit | 696738800923230d52303e070224e8bc95112efb (patch) | |
tree | c7915a9e83d2379a5b4bc42f282dd9f289ef3459 /src/osd/ReplicatedPG.cc | |
parent | c64b8df7c653262834ff1d292501d94cb036f40e (diff) | |
download | ceph-wip-osd-push.tar.gz |
osd: do not use temp_coll for single-step pusheswip-osd-push
If we are recovering an object in a single step, there is no need to
write it to temp and then move it. Avoiding that is a very good thing
when the FileStore has to do an fsync() for non-btrfs fs's.
Signed-off-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'src/osd/ReplicatedPG.cc')
-rw-r--r-- | src/osd/ReplicatedPG.cc | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 49421e41683..86fa4d155a1 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -5273,12 +5273,18 @@ void ReplicatedPG::submit_push_data( map<string, bufferlist> &omap_entries, ObjectStore::Transaction *t) { + coll_t target_coll; + if (first && complete) + target_coll = coll; + else + target_coll = get_temp_coll(t); + if (first) { pg_log.revise_have(recovery_info.soid, eversion_t()); remove_snap_mapped_object(*t, recovery_info.soid); - t->remove(get_temp_coll(t), recovery_info.soid); - t->touch(get_temp_coll(t), recovery_info.soid); - t->omap_setheader(get_temp_coll(t), recovery_info.soid, omap_header); + t->remove(target_coll, recovery_info.soid); + t->touch(target_coll, recovery_info.soid); + t->omap_setheader(target_coll, recovery_info.soid, omap_header); } uint64_t off = 0; for (interval_set<uint64_t>::const_iterator p = intervals_included.begin(); @@ -5286,24 +5292,27 @@ void ReplicatedPG::submit_push_data( ++p) { bufferlist bit; bit.substr_of(data_included, off, p.get_len()); - t->write(get_temp_coll(t), recovery_info.soid, + t->write(target_coll, recovery_info.soid, p.get_start(), p.get_len(), bit); off += p.get_len(); } - t->omap_setkeys(get_temp_coll(t), recovery_info.soid, + t->omap_setkeys(target_coll, recovery_info.soid, omap_entries); - t->setattrs(get_temp_coll(t), recovery_info.soid, + t->setattrs(target_coll, recovery_info.soid, attrs); - if (complete) + if (complete) { + if (!first) + t->collection_move(coll, target_coll, recovery_info.soid); + submit_push_complete(recovery_info, t); + } } void ReplicatedPG::submit_push_complete(ObjectRecoveryInfo &recovery_info, ObjectStore::Transaction *t) { - t->collection_move(coll, get_temp_coll(t), recovery_info.soid); for (map<hobject_t, interval_set<uint64_t> >::const_iterator p = recovery_info.clone_subset.begin(); p != recovery_info.clone_subset.end(); |