From: Piotr Dałek Date: Tue, 18 Apr 2017 14:12:04 +0000 (+0200) Subject: ReplicatedPG: use new fiemap interface X-Git-Tag: v12.0.3~316^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1645baf65d14b50813dc8846cf66ecd5b62d4f50;p=ceph.git ReplicatedPG: use new fiemap interface Reduce memory allocator load during sparse reads and recovery by not encoding sparse file extents from map into bufferlist, then back again into map. Signed-off-by: Piotr Dałek --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 71846caabf80..f5e164d770b5 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -4429,18 +4429,15 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& ops) } } else { // read into a buffer - bufferlist bl; + map m; uint32_t total_read = 0; int r = osd->store->fiemap(ch, ghobject_t(soid, ghobject_t::NO_GEN, info.pgid.shard), - op.extent.offset, op.extent.length, bl); + op.extent.offset, op.extent.length, m); if (r < 0) { result = r; break; } - map m; - bufferlist::iterator iter = bl.begin(); - ::decode(m, iter); map::iterator miter; bufferlist data_bl; uint64_t last = op.extent.offset; diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index 1364cc627702..2b6ca917a47f 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -1981,21 +1981,17 @@ int ReplicatedBackend::build_push_op(const ObjectRecoveryInfo &recovery_info, if (available > 0) { if (!recovery_info.copy_subset.empty()) { interval_set copy_subset = recovery_info.copy_subset; - bufferlist bl; + map m; int r = store->fiemap(ch, ghobject_t(recovery_info.soid), 0, - copy_subset.range_end(), bl); + copy_subset.range_end(), m); if (r >= 0) { - interval_set fiemap_included; - map m; - bufferlist::iterator iter = bl.begin(); - ::decode(m, iter); - map::iterator miter; - for (miter = m.begin(); miter != m.end(); ++miter) { - fiemap_included.insert(miter->first, miter->second); - } - + interval_set fiemap_included(m); copy_subset.intersection_of(fiemap_included); + } else { + // intersection of copy_subset and empty interval_set would be empty anyway + copy_subset.clear(); } + out_op->data_included.span_of(copy_subset, progress.data_recovered_to, available); if (out_op->data_included.empty()) // zero filled section, skip to end!