diff --git a/src/crimson/os/alienstore/alien_store.cc b/src/crimson/os/alienstore/alien_store.cc index aa9758147df..091e438466c 100644 --- a/src/crimson/os/alienstore/alien_store.cc +++ b/src/crimson/os/alienstore/alien_store.cc @@ -338,13 +338,7 @@ AlienStore::get_attrs(CollectionRef ch, return seastar::do_with(attrs_t{}, [=] (auto &aset) { return tp->submit(ch->get_cid().hash_to_shard(tp->size()), [=, &aset] { auto c = static_cast(ch.get()); - std::map blueaset; - const auto r = store->getattrs(c->collection, oid, blueaset); - for (auto& [bluekey, blueval] : blueaset) { - ceph::bufferlist bl; - bl.push_back(std::move(blueval)); - aset.emplace(std::move(bluekey), std::move(bl)); - } + const auto r = store->getattrs(c->collection, oid, aset); return r; }).then([&aset] (int r) -> get_attrs_ertr::future { if (r == -ENOENT) { diff --git a/src/crimson/osd/replicated_recovery_backend.cc b/src/crimson/osd/replicated_recovery_backend.cc index 79e39c6fed3..927551d0768 100644 --- a/src/crimson/osd/replicated_recovery_backend.cc +++ b/src/crimson/osd/replicated_recovery_backend.cc @@ -927,7 +927,7 @@ ReplicatedRecoveryBackend::prep_push_target( bool complete, bool clear_omap, ObjectStore::Transaction* t, - const map& attrs, + const map>& attrs, bufferlist&& omap_header) { if (!first) { @@ -1003,7 +1003,7 @@ ReplicatedRecoveryBackend::submit_push_data( interval_set&& intervals_included, bufferlist&& data_included, bufferlist&& omap_header, - const map &attrs, + const map> &attrs, map&& omap_entries, ObjectStore::Transaction *t) { diff --git a/src/crimson/osd/replicated_recovery_backend.h b/src/crimson/osd/replicated_recovery_backend.h index 55cd0f17861..1d9b6042b9b 100644 --- a/src/crimson/osd/replicated_recovery_backend.h +++ b/src/crimson/osd/replicated_recovery_backend.h @@ -82,7 +82,7 @@ protected: interval_set&& intervals_included, ceph::bufferlist&& data_included, ceph::bufferlist&& omap_header, - const std::map &attrs, + const std::map> &attrs, std::map&& omap_entries, ceph::os::Transaction *t); void submit_push_complete( @@ -161,7 +161,7 @@ private: bool complete, bool clear_omap, ObjectStore::Transaction* t, - const map &attrs, + const std::map> &attrs, bufferlist&& omap_header); using interruptor = crimson::interruptible::interruptor< crimson::osd::IOInterruptCondition>; diff --git a/src/os/FuseStore.cc b/src/os/FuseStore.cc index e06131ce33c..dd9833e0861 100644 --- a/src/os/FuseStore.cc +++ b/src/os/FuseStore.cc @@ -554,7 +554,7 @@ static int os_readdir(const char *path, case FN_OBJECT_ATTR: { - map aset; + map> aset; fs->store->getattrs(ch, oid, aset); unsigned skip = offset; for (auto a : aset) { diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index fb58b0ad520..3b8d3370615 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -601,7 +601,7 @@ public: * @returns 0 on success, negative error code on failure. */ virtual int getattrs(CollectionHandle &c, const ghobject_t& oid, - std::map& aset) = 0; + std::map>& aset) = 0; /** * getattrs -- get all of the xattrs of an object @@ -612,8 +612,8 @@ public: * @returns 0 on success, negative error code on failure. */ int getattrs(CollectionHandle &c, const ghobject_t& oid, - std::map& aset) { - std::map bmap; + std::map>& aset) { + std::map> bmap; int r = getattrs(c, oid, bmap); for (auto i = bmap.begin(); i != bmap.end(); ++i) { aset[i->first].append(i->second); diff --git a/src/os/Transaction.cc b/src/os/Transaction.cc index af82da3406d..ac3513ef4a4 100644 --- a/src/os/Transaction.cc +++ b/src/os/Transaction.cc @@ -554,7 +554,7 @@ void Transaction::generate_test_instances(list& o) t = new Transaction; t->setattr(c, o1, "key", bl); - map m; + map> m; m["a"] = buffer::copy("this", 4); m["b"] = buffer::copy("that", 4); t->setattrs(c, o1, m); diff --git a/src/os/Transaction.h b/src/os/Transaction.h index 93b6272254c..f016aa6c315 100644 --- a/src/os/Transaction.h +++ b/src/os/Transaction.h @@ -912,7 +912,9 @@ public: data.ops = data.ops + 1; } /// Set multiple xattrs of an object - void setattrs(const coll_t& cid, const ghobject_t& oid, const std::map& attrset) { + void setattrs(const coll_t& cid, + const ghobject_t& oid, + const std::map>& attrset) { using ceph::encode; Op* _op = _get_next_op(); _op->op = OP_SETATTRS; @@ -922,7 +924,9 @@ public: data.ops = data.ops + 1; } /// Set multiple xattrs of an object - void setattrs(const coll_t& cid, const ghobject_t& oid, const std::map& attrset) { + void setattrs(const coll_t& cid, + const ghobject_t& oid, + const std::map>& attrset) { using ceph::encode; Op* _op = _get_next_op(); _op->op = OP_SETATTRS; diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 7520b5de0ea..ce189310377 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -10431,7 +10431,7 @@ int BlueStore::getattr( int BlueStore::getattrs( CollectionHandle &c_, const ghobject_t& oid, - map& aset) + map>& aset) { Collection *c = static_cast(c_.get()); dout(15) << __func__ << " " << c->cid << " " << oid << dendl; diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index a1249607a4d..c08cc6d61aa 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -2836,7 +2836,7 @@ public: ceph::buffer::ptr& value) override; int getattrs(CollectionHandle &c, const ghobject_t& oid, - std::map& aset) override; + std::map>& aset) override; int list_collections(std::vector& ls) override; diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index 0c143d57213..323bb6521ce 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -3861,7 +3861,7 @@ int FileStore::_clone(const coll_t& cid, const ghobject_t& oldoid, const ghobjec { char buf[2]; - map aset; + map> aset; r = _fgetattrs(**o, aset); if (r < 0) goto out3; @@ -4469,7 +4469,7 @@ int FileStore::_fgetattr(int fd, const char *name, bufferptr& bp) return l; } -int FileStore::_fgetattrs(int fd, map& aset) +int FileStore::_fgetattrs(int fd, map>& aset) { // get attr list char names1[100]; @@ -4520,7 +4520,7 @@ int FileStore::_fgetattrs(int fd, map& aset) return 0; } -int FileStore::_fsetattrs(int fd, map &aset) +int FileStore::_fsetattrs(int fd, map> &aset) { for (map::iterator p = aset.begin(); p != aset.end(); @@ -4635,7 +4635,9 @@ int FileStore::getattr(CollectionHandle& ch, const ghobject_t& oid, const char * } } -int FileStore::getattrs(CollectionHandle& ch, const ghobject_t& oid, map& aset) +int FileStore::getattrs(CollectionHandle& ch, + const ghobject_t& oid, + std::map>& aset) { tracepoint(objectstore, getattrs_enter, ch->cid.c_str()); const coll_t& cid = !_need_temp_object_collection(ch->cid, oid) ? ch->cid : ch->cid.get_temp(); @@ -4718,8 +4720,8 @@ int FileStore::_setattrs(const coll_t& cid, const ghobject_t& oid, map omap_set; set omap_remove; - map inline_set; - map inline_to_set; + map> inline_set; + map> inline_to_set; FDRef fd; int spill_out = -1; bool incomplete_inline = false; @@ -4862,7 +4864,7 @@ int FileStore::_rmattrs(const coll_t& cid, const ghobject_t& oid, { dout(15) << __FUNC__ << ": " << cid << "/" << oid << dendl; - map aset; + map> aset; FDRef fd; set omap_attrs; Index index; diff --git a/src/os/filestore/FileStore.h b/src/os/filestore/FileStore.h index 324dbbe4daf..e975abc3d48 100644 --- a/src/os/filestore/FileStore.h +++ b/src/os/filestore/FileStore.h @@ -646,8 +646,8 @@ public: int _remove(const coll_t& cid, const ghobject_t& oid, const SequencerPosition &spos); int _fgetattr(int fd, const char *name, ceph::bufferptr& bp); - int _fgetattrs(int fd, std::map& aset); - int _fsetattrs(int fd, std::map &aset); + int _fgetattrs(int fd, std::map>& aset); + int _fsetattrs(int fd, std::map>& aset); void do_force_sync(); void start_sync(Context *onsafe); @@ -692,7 +692,7 @@ public: using ObjectStore::getattr; using ObjectStore::getattrs; int getattr(CollectionHandle& c, const ghobject_t& oid, const char *name, ceph::bufferptr &bp) override; - int getattrs(CollectionHandle& c, const ghobject_t& oid, std::map& aset) override; + int getattrs(CollectionHandle& c, const ghobject_t& oid, std::map>& aset) override; int _setattrs(const coll_t& cid, const ghobject_t& oid, std::map& aset, const SequencerPosition &spos); diff --git a/src/os/kstore/KStore.cc b/src/os/kstore/KStore.cc index 8f6b19bda38..fe030859e22 100644 --- a/src/os/kstore/KStore.cc +++ b/src/os/kstore/KStore.cc @@ -1362,7 +1362,7 @@ int KStore::getattr( int KStore::getattrs( CollectionHandle& ch, const ghobject_t& oid, - map& aset) + map>& aset) { dout(15) << __func__ << " " << ch->cid << " " << oid << dendl; Collection *c = static_cast(ch.get()); diff --git a/src/os/kstore/KStore.h b/src/os/kstore/KStore.h index 16c4266ee8e..d7d95acdfbd 100644 --- a/src/os/kstore/KStore.h +++ b/src/os/kstore/KStore.h @@ -486,7 +486,9 @@ public: using ObjectStore::getattr; int getattr(CollectionHandle& c, const ghobject_t& oid, const char *name, ceph::buffer::ptr& value) override; using ObjectStore::getattrs; - int getattrs(CollectionHandle& c, const ghobject_t& oid, std::map& aset) override; + int getattrs(CollectionHandle& c, + const ghobject_t& oid, + std::map>& aset) override; int list_collections(std::vector& ls) override; bool collection_exists(const coll_t& c) override; diff --git a/src/os/kstore/kstore_types.h b/src/os/kstore/kstore_types.h index 859ea8f7dc8..f264642e274 100644 --- a/src/os/kstore/kstore_types.h +++ b/src/os/kstore/kstore_types.h @@ -41,7 +41,7 @@ WRITE_CLASS_ENCODER(kstore_cnode_t) struct kstore_onode_t { uint64_t nid; ///< numeric id (locally unique) uint64_t size; ///< object size - std::map attrs; ///< attrs + std::map> attrs; ///< attrs uint64_t omap_head; ///< id for omap root node uint32_t stripe_size; ///< stripe size diff --git a/src/os/memstore/MemStore.cc b/src/os/memstore/MemStore.cc index dc29ab1b6fd..6c6140df809 100644 --- a/src/os/memstore/MemStore.cc +++ b/src/os/memstore/MemStore.cc @@ -384,7 +384,7 @@ int MemStore::getattr(CollectionHandle &c_, const ghobject_t& oid, } int MemStore::getattrs(CollectionHandle &c_, const ghobject_t& oid, - std::map& aset) + std::map>& aset) { Collection *c = static_cast(c_.get()); dout(10) << __func__ << " " << c->cid << " " << oid << dendl; diff --git a/src/os/memstore/MemStore.h b/src/os/memstore/MemStore.h index 7f0f58e423c..2a123fae151 100644 --- a/src/os/memstore/MemStore.h +++ b/src/os/memstore/MemStore.h @@ -32,7 +32,7 @@ public: struct Object : public RefCountedObject { ceph::mutex xattr_mutex{ceph::make_mutex("MemStore::Object::xattr_mutex")}; ceph::mutex omap_mutex{ceph::make_mutex("MemStore::Object::omap_mutex")}; - std::map xattr; + std::map> xattr; ceph::buffer::list omap_header; std::map omap; @@ -310,7 +310,7 @@ public: int getattr(CollectionHandle &c, const ghobject_t& oid, const char *name, ceph::buffer::ptr& value) override; int getattrs(CollectionHandle &c, const ghobject_t& oid, - std::map& aset) override; + std::map>& aset) override; int list_collections(std::vector& ls) override; diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc index 7938f5c0eb7..f9398c17220 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -433,7 +433,7 @@ void ECBackend::handle_recovery_push_reply( void ECBackend::handle_recovery_read_complete( const hobject_t &hoid, boost::tuple > &to_read, - std::optional > attrs, + std::optional> > attrs, RecoveryMessages *m) { dout(10) << __func__ << ": returned " << hoid << " " @@ -478,7 +478,7 @@ void ECBackend::handle_recovery_read_complete( } // Need to remove ECUtil::get_hinfo_key() since it should not leak out // of the backend (see bug #12983) - map sanitized_attrs(op.xattrs); + map> sanitized_attrs(op.xattrs); sanitized_attrs.erase(ECUtil::get_hinfo_key()); op.obc = get_parent()->get_obc(hoid, sanitized_attrs); ceph_assert(op.obc); @@ -1231,7 +1231,7 @@ void ECBackend::handle_sub_read_reply( dout(20) << __func__ << " to_read skipping" << dendl; continue; } - rop.complete[i->first].attrs = map(); + rop.complete[i->first].attrs.emplace(); (*(rop.complete[i->first].attrs)).swap(i->second); } for (auto i = op.errors.begin(); @@ -1817,7 +1817,7 @@ void ECBackend::do_read_op(ReadOp &op) } ECUtil::HashInfoRef ECBackend::get_hash_info( - const hobject_t &hoid, bool checks, const map *attrs) + const hobject_t &hoid, bool checks, const map> *attrs) { dout(10) << __func__ << ": Getting attr on " << hoid << dendl; ECUtil::HashInfoRef ref = unstable_hashinfo_registry.lookup(hoid); @@ -2481,7 +2481,7 @@ int ECBackend::send_all_remaining_reads( int ECBackend::objects_get_attrs( const hobject_t &hoid, - map *out) + map> *out) { int r = store->getattrs( ch, diff --git a/src/osd/ECBackend.h b/src/osd/ECBackend.h index c39de1bfeeb..e5e4acee870 100644 --- a/src/osd/ECBackend.h +++ b/src/osd/ECBackend.h @@ -275,7 +275,7 @@ private: // must be filled if state == WRITING std::map returned_data; - std::map xattrs; + std::map> xattrs; ECUtil::HashInfoRef hinfo; ObjectContextRef obc; std::set waiting_on_pushes; @@ -298,7 +298,7 @@ private: void handle_recovery_read_complete( const hobject_t &hoid, boost::tuple > &to_read, - std::optional > attrs, + std::optional> > attrs, RecoveryMessages *m); void handle_recovery_push( const PushOp &op, @@ -340,7 +340,7 @@ public: struct read_result_t { int r; std::map errors; - std::optional > attrs; + std::optional> > attrs; std::list< boost::tuple< uint64_t, uint64_t, std::map > > returned; @@ -630,7 +630,7 @@ public: /// If modified, ensure that the ref is held until the update is applied SharedPtrRegistry unstable_hashinfo_registry; ECUtil::HashInfoRef get_hash_info(const hobject_t &hoid, bool checks = true, - const std::map *attr = NULL); + const std::map> *attr = NULL); public: ECBackend( @@ -661,7 +661,7 @@ public: int objects_get_attrs( const hobject_t &hoid, - std::map *out) override; + std::map> *out) override; void rollback_append( const hobject_t &hoid, diff --git a/src/osd/ECMsgTypes.h b/src/osd/ECMsgTypes.h index 77b4222b28b..bf10704125c 100644 --- a/src/osd/ECMsgTypes.h +++ b/src/osd/ECMsgTypes.h @@ -119,7 +119,7 @@ struct ECSubReadReply { pg_shard_t from; ceph_tid_t tid; std::map >> buffers_read; - std::map> attrs_read; + std::map>> attrs_read; std::map errors; void encode(ceph::buffer::list &bl) const; void decode(ceph::buffer::list::const_iterator &bl); diff --git a/src/osd/ECTransaction.cc b/src/osd/ECTransaction.cc index 603f9af0ea3..2a6c67d13eb 100644 --- a/src/osd/ECTransaction.cc +++ b/src/osd/ECTransaction.cc @@ -330,7 +330,7 @@ void ECTransaction::generate_transactions( ceph_assert(op.omap_updates.empty()); if (!op.attr_updates.empty()) { - map to_set; + map> to_set; for (auto &&j: op.attr_updates) { if (j.second) { to_set[j.first] = *(j.second); diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index b6357b12639..3b1525bd271 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -467,7 +467,7 @@ int PGBackend::objects_get_attr( int PGBackend::objects_get_attrs( const hobject_t &hoid, - map *out) + map> *out) { return store->getattrs( ch, @@ -479,7 +479,7 @@ void PGBackend::rollback_setattrs( const hobject_t &hoid, map > &old_attrs, ObjectStore::Transaction *t) { - map to_set; + map> to_set; ceph_assert(!hoid.is_temp()); for (map >::iterator i = old_attrs.begin(); i != old_attrs.end(); diff --git a/src/osd/PGBackend.h b/src/osd/PGBackend.h index 12bdfc0d113..34d74025173 100644 --- a/src/osd/PGBackend.h +++ b/src/osd/PGBackend.h @@ -212,7 +212,7 @@ typedef std::shared_ptr OSDMapRef; virtual ObjectContextRef get_obc( const hobject_t &hoid, - const std::map &attrs) = 0; + const std::map> &attrs) = 0; virtual bool try_lock_for_read( const hobject_t &hoid, @@ -557,7 +557,7 @@ typedef std::shared_ptr OSDMapRef; virtual int objects_get_attrs( const hobject_t &hoid, - std::map *out); + std::map> *out); virtual int objects_read_sync( const hobject_t &hoid, diff --git a/src/osd/PGTransaction.h b/src/osd/PGTransaction.h index 3b5b9e72cfa..e6f57c90fa1 100644 --- a/src/osd/PGTransaction.h +++ b/src/osd/PGTransaction.h @@ -359,12 +359,12 @@ public: /// Attr ops void setattrs( const hobject_t &hoid, ///< [in] object to write - std::map &attrs ///< [in] attrs, may be cleared + std::map> &attrs ///< [in] attrs, may be cleared ) { auto &op = get_object_op_for_modify(hoid); - for (auto &&i: attrs) { - auto& d = op.attr_updates[i.first]; - d = i.second; + for (auto &[key, val]: attrs) { + auto& d = op.attr_updates[key]; + d = val; d->rebuild(); } } diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 7663170f043..25545e07961 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -4846,7 +4846,7 @@ int PrimaryLogPG::trim_object( head_obc->obs.oi.prior_version = head_obc->obs.oi.version; head_obc->obs.oi.version = ctx->at_version; - map attrs; + map > attrs; bl.clear(); encode(snapset, bl); attrs[SS_ATTR] = std::move(bl); @@ -6341,7 +6341,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& ops) ++ctx->num_read; { tracepoint(osd, do_osd_op_pre_getxattrs, soid.oid.name.c_str(), soid.snap.val); - map out; + map> out; result = getattrs_maybe_cache( ctx->obc, &out); @@ -7137,7 +7137,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& ops) oi.user_version = target_version; ctx->user_at_version = target_version; /* rm_attrs */ - map rmattrs; + map> rmattrs; result = getattrs_maybe_cache(ctx->obc, &rmattrs); if (result < 0) { dout(10) << __func__ << " error: " << cpp_strerror(result) << dendl; @@ -8937,7 +8937,7 @@ void PrimaryLogPG::finish_ctx(OpContext *ctx, int log_op_type, int result) } // object_info_t - map attrs; + map > attrs; bufferlist bv(sizeof(ctx->new_obs.oi)); encode(ctx->new_obs.oi, bv, get_osdmap()->get_features(CEPH_ENTITY_TYPE_OSD, nullptr)); @@ -9189,7 +9189,7 @@ int PrimaryLogPG::do_copy_get(OpContext *ctx, bufferlist::const_iterator& bp, reply_obj.truncate_size = oi.truncate_size; // attrs - map& out_attrs = reply_obj.attrs; + map>& out_attrs = reply_obj.attrs; if (!cursor.attr_complete) { result = getattrs_maybe_cache( ctx->obc, @@ -11776,7 +11776,7 @@ ObjectContextRef PrimaryLogPG::create_object_context(const object_info_t& oi, ObjectContextRef PrimaryLogPG::get_object_context( const hobject_t& soid, bool can_create, - const map *attrs) + const map> *attrs) { auto it_objects = recovery_state.get_pg_log().get_log().objects.find(soid); ceph_assert( @@ -12196,7 +12196,7 @@ void PrimaryLogPG::kick_object_context_blocked(ObjectContextRef obc) SnapSetContext *PrimaryLogPG::get_snapset_context( const hobject_t& oid, bool can_create, - const map *attrs, + const map> *attrs, bool oid_existed) { std::lock_guard l(snapset_contexts_lock); @@ -14579,9 +14579,10 @@ void PrimaryLogPG::hit_set_persist() 0, bl.length()); ctx->clean_regions.mark_data_region_dirty(0, bl.length()); } - map attrs; - attrs[OI_ATTR] = std::move(boi); - attrs[SS_ATTR] = std::move(bss); + map> attrs = { + {OI_ATTR, std::move(boi)}, + {SS_ATTR, std::move(bss)} + }; setattrs_maybe_cache(ctx->obc, ctx->op_t.get(), attrs); ctx->log.push_back( pg_log_entry_t( @@ -15684,7 +15685,7 @@ void PrimaryLogPG::setattr_maybe_cache( void PrimaryLogPG::setattrs_maybe_cache( ObjectContextRef obc, PGTransaction *t, - map &attrs) + map> &attrs) { t->setattrs(obc->obs.oi.soid, attrs); } @@ -15717,7 +15718,7 @@ int PrimaryLogPG::getattr_maybe_cache( int PrimaryLogPG::getattrs_maybe_cache( ObjectContextRef obc, - map *out) + map> *out) { int r = 0; ceph_assert(out); @@ -15726,12 +15727,11 @@ int PrimaryLogPG::getattrs_maybe_cache( } else { r = pgbackend->objects_get_attrs(obc->obs.oi.soid, 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())] = std::move(i->second); + map> tmp; + for (auto& [key, val]: *out) { + if (key.size() > 1 && key[0] == '_') { + tmp[key.substr(1, key.size())] = std::move(val); + } } tmp.swap(*out); return r; diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 6018f366ca2..45cee803385 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -97,7 +97,7 @@ public: uint32_t data_digest, omap_digest; mempool::osd_pglog::vector > reqids; // [(reqid, user_version)] mempool::osd_pglog::map reqid_return_codes; // std::map reqids by index to error code - std::map attrs; // xattrs + std::map> attrs; // xattrs uint64_t truncate_seq; uint64_t truncate_size; bool is_data_digest() { @@ -135,7 +135,7 @@ public: ceph_tid_t objecter_tid2; object_copy_cursor_t cursor; - std::map attrs; + std::map> attrs; ceph::buffer::list data; ceph::buffer::list omap_header; ceph::buffer::list omap_data; @@ -422,7 +422,7 @@ public: ObjectContextRef get_obc( const hobject_t &hoid, - const std::map &attrs) override { + const std::map> &attrs) override { return get_object_context(hoid, true, &attrs); } @@ -1019,7 +1019,7 @@ protected: ObjectContextRef get_object_context( const hobject_t& soid, bool can_create, - const std::map *attrs = 0 + const std::map> *attrs = 0 ); void context_registry_on_change(); @@ -1039,7 +1039,7 @@ protected: SnapSetContext *get_snapset_context( const hobject_t& oid, bool can_create, - const std::map *attrs = 0, + const std::map> *attrs = 0, bool oid_existed = true //indicate this oid whether exsited in backend ); void register_snapset_context(SnapSetContext *ssc) { @@ -1909,7 +1909,7 @@ public: void setattrs_maybe_cache( ObjectContextRef obc, PGTransaction *t, - std::map &attrs); + std::map> &attrs); void rmattr_maybe_cache( ObjectContextRef obc, PGTransaction *t, @@ -1920,7 +1920,7 @@ public: ceph::buffer::list *val); int getattrs_maybe_cache( ObjectContextRef obc, - std::map *out); + std::map> *out); public: void set_dynamic_perf_stats_queries( diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index 669cdbce020..f26650bb86d 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -382,7 +382,7 @@ void generate_transaction( } if (!op.attr_updates.empty()) { - map attrs; + map> attrs; for (auto &&p: op.attr_updates) { if (p.second) attrs[p.first] = *(p.second); @@ -1599,7 +1599,7 @@ void ReplicatedBackend::submit_push_data( const interval_set &intervals_included, bufferlist data_included, bufferlist omap_header, - const map &attrs, + const map> &attrs, const map &omap_entries, ObjectStore::Transaction *t) { diff --git a/src/osd/ReplicatedBackend.h b/src/osd/ReplicatedBackend.h index f4b5063579a..b1cfe4dd270 100644 --- a/src/osd/ReplicatedBackend.h +++ b/src/osd/ReplicatedBackend.h @@ -280,7 +280,7 @@ private: const interval_set &intervals_included, ceph::buffer::list data_included, ceph::buffer::list omap_header, - const std::map &attrs, + const std::map> &attrs, const std::map &omap_entries, ObjectStore::Transaction *t); void submit_push_complete(const ObjectRecoveryInfo &recovery_info, diff --git a/src/osd/osd_internal_types.h b/src/osd/osd_internal_types.h index 17f4f314643..80ecb67a889 100644 --- a/src/osd/osd_internal_types.h +++ b/src/osd/osd_internal_types.h @@ -41,7 +41,7 @@ public: std::map, WatchRef> watchers; // attr cache - std::map attr_cache; + std::map> attr_cache; RWState rwstate; std::list waiters; ///< ops waiting on state change diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index fe2fe7defa9..94693bdfc0f 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -5310,7 +5310,7 @@ struct object_copy_data_t { utime_t mtime; uint32_t data_digest, omap_digest; uint32_t flags; - std::map attrs; + std::map> attrs; ceph::buffer::list data; ceph::buffer::list omap_header; ceph::buffer::list omap_data; @@ -6031,7 +6031,7 @@ struct PushOp { interval_set data_included; ceph::buffer::list omap_header; std::map omap_entries; - std::map attrset; + std::map> attrset; ObjectRecoveryInfo recovery_info; ObjectRecoveryProgress before_progress; @@ -6056,7 +6056,7 @@ enum class scrub_type_t : bool { not_repair = false, do_repair = true }; */ struct ScrubMap { struct object { - std::map attrs; + std::map> attrs; uint64_t size; __u32 omap_digest; ///< omap crc32c __u32 digest; ///< data crc32c diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index de1e7adf319..e4c7ab4b4b6 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1028,7 +1028,7 @@ struct ObjectOperation { object_copy_cursor_t *cursor; uint64_t *out_size; ceph::real_time *out_mtime; - std::map *out_attrs; + std::map> *out_attrs; ceph::buffer::list *out_data, *out_omap_header, *out_omap_data; std::vector *out_snaps; snapid_t *out_snap_seq; @@ -1043,7 +1043,7 @@ struct ObjectOperation { C_ObjectOperation_copyget(object_copy_cursor_t *c, uint64_t *s, ceph::real_time *m, - std::map *a, + std::map> *a, ceph::buffer::list *d, ceph::buffer::list *oh, ceph::buffer::list *o, std::vector *osnaps, @@ -1122,7 +1122,7 @@ struct ObjectOperation { uint64_t max, uint64_t *out_size, ceph::real_time *out_mtime, - std::map *out_attrs, + std::map> *out_attrs, ceph::buffer::list *out_data, ceph::buffer::list *out_omap_header, ceph::buffer::list *out_omap_data, diff --git a/src/test/fio/fio_ceph_objectstore.cc b/src/test/fio/fio_ceph_objectstore.cc index 86d38919426..0846904b1bc 100644 --- a/src/test/fio/fio_ceph_objectstore.cc +++ b/src/test/fio/fio_ceph_objectstore.cc @@ -743,7 +743,7 @@ enum fio_q_status fio_ceph_os_queue(thread_data* td, io_u* u) bl.push_back(buffer::copy(reinterpret_cast(u->xfer_buf), u->xfer_buflen ) ); - map attrset; + map> attrset; map omaps; // enqueue a write transaction on the collection's handle ObjectStore::Transaction t; @@ -827,7 +827,7 @@ enum fio_q_status fio_ceph_os_queue(thread_data* td, io_u* u) } } - if (attrset.size()) { + if (!attrset.empty()) { t.setattrs(coll.cid, object.oid, attrset); } t.write(coll.cid, object.oid, u->offset, u->xfer_buflen, bl, flags); diff --git a/src/test/objectstore/FileStoreDiff.cc b/src/test/objectstore/FileStoreDiff.cc index e6848570110..a99e6f3d7d4 100644 --- a/src/test/objectstore/FileStoreDiff.cc +++ b/src/test/objectstore/FileStoreDiff.cc @@ -43,12 +43,12 @@ FileStoreDiff::~FileStoreDiff() } -bool FileStoreDiff::diff_attrs(std::map& b, - std::map& a) +bool FileStoreDiff::diff_attrs(std::map>& b, + std::map>& a) { bool ret = false; - std::map::iterator b_it = b.begin(); - std::map::iterator a_it = a.begin(); + auto b_it = b.begin(); + auto a_it = a.begin(); for (; b_it != b.end(); ++b_it, ++a_it) { if (b_it->first != a_it->first) { cout << "diff_attrs name mismatch (verify: " << b_it->first @@ -204,7 +204,7 @@ bool FileStoreDiff::diff_objects(FileStore *a_store, FileStore *b_store, coll_t ret = true; } - std::map a_obj_attrs_map, b_obj_attrs_map; + std::map> a_obj_attrs_map, b_obj_attrs_map; err = a_store->getattrs(a_ch, a_obj, a_obj_attrs_map); if (err < 0) { cout << "diff_objects getattrs on A object " << coll << "/" << a_obj diff --git a/src/test/objectstore/FileStoreDiff.h b/src/test/objectstore/FileStoreDiff.h index ba9cfb9837b..56b53dddb1f 100644 --- a/src/test/objectstore/FileStoreDiff.h +++ b/src/test/objectstore/FileStoreDiff.h @@ -29,8 +29,8 @@ class FileStoreDiff { bool diff_objects(FileStore *a_store, FileStore *b_store, coll_t coll); bool diff_objects_stat(struct stat& a, struct stat& b); - bool diff_attrs(std::map& b, - std::map& a); + bool diff_attrs(std::map>& b, + std::map>& a); public: FileStoreDiff(FileStore *a, FileStore *b); diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index 176d1d48b84..c77929b0c22 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -2805,7 +2805,7 @@ TEST_P(StoreTest, SimpleAttrTest) { bl.append(bp); ASSERT_TRUE(bl_eq(val, bl)); - map bm; + map> bm; r = store->getattrs(ch, hoid, bm); ASSERT_EQ(0, r); @@ -4565,7 +4565,7 @@ public: boost::uniform_int<> u3(0, 100); uint64_t size = u0(*rng); uint64_t name_len; - map attrs; + map> attrs; set keys; for (map::iterator it = contents[obj].attrs.begin(); it != contents[obj].attrs.end(); ++it) @@ -4607,7 +4607,7 @@ public: available_objects.erase(obj); ObjectStore::Transaction t; - map attrs; + map> attrs; set keys; while (entries--) { @@ -4644,7 +4644,7 @@ public: } while (contents[obj].attrs.empty()); expected = contents[obj].attrs; } - map attrs; + map> attrs; int r = store->getattrs(ch, obj, attrs); ASSERT_TRUE(r == 0); ASSERT_TRUE(attrs.size() == expected.size()); @@ -5736,7 +5736,7 @@ TEST_P(StoreTest, XattrTest) { ASSERT_EQ(r, 0); } - map aset; + map> aset; store->getattrs(ch, hoid, aset); ASSERT_EQ(aset.size(), attrs.size()); for (map::iterator i = aset.begin(); diff --git a/src/tools/RadosDump.h b/src/tools/RadosDump.h index 83f02e69d51..213351e17b0 100644 --- a/src/tools/RadosDump.h +++ b/src/tools/RadosDump.h @@ -219,9 +219,9 @@ struct data_section { }; struct attr_section { - map data; - explicit attr_section(const map &data) : data(data) { } - explicit attr_section(map &data_) + map> data; + explicit attr_section(const map> &data) : data(data) { } + explicit attr_section(map> &data_) { for (std::map::iterator i = data_.begin(); i != data_.end(); ++i) { diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index 202695d89b0..5035e367d81 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -806,7 +806,7 @@ int ObjectStoreTool::export_file(ObjectStore *store, coll_t cid, ghobject_t &obj } //Handle attrs for this object - map aset; + map> aset; ret = store->getattrs(ch, obj, aset); if (ret) return ret; attr_section as(aset); @@ -2143,7 +2143,7 @@ int do_remove_object(ObjectStore *store, coll_t coll, int do_list_attrs(ObjectStore *store, coll_t coll, ghobject_t &ghobj) { auto ch = store->open_collection(coll); - map aset; + map> aset; int r = store->getattrs(ch, ghobj, aset); if (r < 0) { cerr << "getattrs: " << cpp_strerror(r) << std::endl; @@ -3005,7 +3005,7 @@ int dup(string srcpath, ObjectStore *src, string dstpath, ObjectStore *dst) ObjectStore::Transaction t; t.touch(cid, oid); - map attrs; + map> attrs; src->getattrs(ch, oid, attrs); if (!attrs.empty()) { t.setattrs(cid, oid, attrs); diff --git a/src/tools/rados/PoolDump.cc b/src/tools/rados/PoolDump.cc index 9bfafa107dc..207017036ee 100644 --- a/src/tools/rados/PoolDump.cc +++ b/src/tools/rados/PoolDump.cc @@ -96,7 +96,7 @@ int PoolDump::dump(IoCtx *io_ctx) // Compose TYPE_ATTRS chunk // ======================== std::map raw_xattrs; - std::map xattrs; + std::map> xattrs; r = io_ctx->getxattrs(oid, raw_xattrs); if (r < 0) { cerr << "error getting xattr set " << oid << ": " << cpp_strerror(r)