From 143111a112ec64724226f83ed285f66ee52204b2 Mon Sep 17 00:00:00 2001 From: David Zafman Date: Tue, 12 Sep 2017 15:09:14 -0700 Subject: [PATCH] osd: CLEANUP: Change getattr_maybe_cache() to reflect how it is being used Signed-off-by: David Zafman --- src/osd/PrimaryLogPG.cc | 32 +++++++++++++------------------- src/osd/PrimaryLogPG.h | 3 +-- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index b91cd4980bee..3791fa642112 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -5339,8 +5339,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); @@ -6103,8 +6102,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; } @@ -7760,8 +7758,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; @@ -14405,26 +14402,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 bc4279b14233..18cfb49a4106 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1799,8 +1799,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) -- 2.47.3