From: David Zafman Date: Tue, 12 Sep 2017 22:09:14 +0000 (-0700) Subject: osd: CLEANUP: Change getattr_maybe_cache() to reflect how it is being used X-Git-Tag: v12.2.3~146^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=39bb3cf8e688a4fd4bc66295c39c66554cb8e089;p=ceph.git osd: CLEANUP: Change getattr_maybe_cache() to reflect how it is being used Signed-off-by: David Zafman (cherry picked from commit 143111a112ec64724226f83ed285f66ee52204b2) --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 3dd4eff09893..a0f881a9db35 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -5432,8 +5432,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& ops) map out; result = getattrs_maybe_cache( ctx->obc, - &out, - true); + &out); bufferlist bl; ::encode(out, bl); @@ -6196,8 +6195,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& ops) /* rm_attrs */ map rmattrs; result = getattrs_maybe_cache(ctx->obc, - &rmattrs, - true); + &rmattrs); if (result < 0) { return result; } @@ -7854,8 +7852,7 @@ int PrimaryLogPG::do_copy_get(OpContext *ctx, bufferlist::iterator& bp, if (!cursor.attr_complete) { result = getattrs_maybe_cache( ctx->obc, - &out_attrs, - true); + &out_attrs); if (result < 0) { if (cb) { delete cb; @@ -14548,26 +14545,23 @@ int PrimaryLogPG::getattr_maybe_cache( int PrimaryLogPG::getattrs_maybe_cache( ObjectContextRef obc, - map *out, - bool user_only) + map *out) { int r = 0; + assert(out); if (pool.info.require_rollback()) { - if (out) - *out = obc->attr_cache; + *out = obc->attr_cache; } else { r = pgbackend->objects_get_attrs(obc->obs.oi.soid, out); } - if (out && user_only) { - map tmp; - for (map::iterator i = out->begin(); - i != out->end(); - ++i) { - if (i->first.size() > 1 && i->first[0] == '_') - tmp[i->first.substr(1, i->first.size())].claim(i->second); - } - tmp.swap(*out); + map tmp; + for (map::iterator i = out->begin(); + i != out->end(); + ++i) { + if (i->first.size() > 1 && i->first[0] == '_') + tmp[i->first.substr(1, i->first.size())].claim(i->second); } + tmp.swap(*out); return r; } diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index df2a45f5877b..5289e78b0bad 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1802,8 +1802,7 @@ public: bufferlist *val); int getattrs_maybe_cache( ObjectContextRef obc, - map *out, - bool user_only = false); + map *out); }; inline ostream& operator<<(ostream& out, const PrimaryLogPG::RepGather& repop)