From d942b662ece6e3a8b2711b62b059533788062464 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Tue, 26 Dec 2017 02:41:28 -0500 Subject: [PATCH] os: Use unqualified encode/decode This is a portion of Part 1 of the namespace project: using ADL properly in encode and decode so we can use namespaces easily in Ceph. Signed-off-by: Adam C. Emerson --- src/os/ObjectStore.cc | 10 +-- src/os/ObjectStore.h | 75 ++++++++++++-------- src/os/Transaction.cc | 5 +- src/os/bluestore/BitmapFreelistManager.cc | 16 ++--- src/os/bluestore/BlueFS.cc | 64 ++++++++--------- src/os/bluestore/BlueStore.cc | 76 ++++++++++----------- src/os/bluestore/BlueStore.h | 8 ++- src/os/bluestore/bluefs_types.cc | 36 +++++----- src/os/bluestore/bluefs_types.h | 69 +++++++++++-------- src/os/bluestore/bluestore_types.cc | 20 +++--- src/os/filestore/DBObjectMap.h | 36 +++++----- src/os/filestore/FileJournal.cc | 6 +- src/os/filestore/FileJournal.h | 54 ++++++++------- src/os/filestore/FileStore.cc | 34 ++++----- src/os/filestore/GenericFileStoreBackend.cc | 4 +- src/os/filestore/HashIndex.h | 42 +++++++----- src/os/filestore/IndexManager.cc | 4 +- src/os/filestore/SequencerPosition.h | 12 ++-- src/os/kstore/KStore.cc | 30 ++++---- src/os/kstore/kstore_types.cc | 36 +++++----- src/os/memstore/MemStore.cc | 30 ++++---- src/os/memstore/MemStore.h | 30 ++++---- src/os/memstore/PageSet.h | 16 +++-- 23 files changed, 379 insertions(+), 334 deletions(-) diff --git a/src/os/ObjectStore.cc b/src/os/ObjectStore.cc index 7bf29be97cb8d..44bf75ffbebc1 100644 --- a/src/os/ObjectStore.cc +++ b/src/os/ObjectStore.cc @@ -30,14 +30,14 @@ void decode_str_str_map_to_bl(bufferlist::iterator& p, { bufferlist::iterator start = p; __u32 n; - ::decode(n, p); + decode(n, p); unsigned len = 4; while (n--) { __u32 l; - ::decode(l, p); + decode(l, p); p.advance(l); len += 4 + l; - ::decode(l, p); + decode(l, p); p.advance(l); len += 4 + l; } @@ -49,11 +49,11 @@ void decode_str_set_to_bl(bufferlist::iterator& p, { bufferlist::iterator start = p; __u32 n; - ::decode(n, p); + decode(n, p); unsigned len = 4; while (n--) { __u32 l; - ::decode(l, p); + decode(l, p); p.advance(l); len += 4 + l; } diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 03c2a1b951dcb..8456360307ae5 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -53,7 +53,7 @@ class Logger; static inline void encode(const map *attrset, bufferlist &bl) { - ::encode(*attrset, bl); + encode(*attrset, bl); } // this isn't the best place for these, but... @@ -834,10 +834,11 @@ public: /// Retain old version for regression testing purposes uint64_t get_encoded_bytes_test() { + using ceph::encode; //layout: data_bl + op_bl + coll_index + object_index + data bufferlist bl; - ::encode(coll_index, bl); - ::encode(object_index, bl); + encode(coll_index, bl); + encode(object_index, bl); return data_bl.length() + op_bl.length() + @@ -949,27 +950,33 @@ public: return op; } string decode_string() { + using ceph::decode; string s; - ::decode(s, data_bl_p); + decode(s, data_bl_p); return s; } void decode_bp(bufferptr& bp) { - ::decode(bp, data_bl_p); + using ceph::decode; + decode(bp, data_bl_p); } void decode_bl(bufferlist& bl) { - ::decode(bl, data_bl_p); + using ceph::decode; + decode(bl, data_bl_p); } void decode_attrset(map& aset) { - ::decode(aset, data_bl_p); + using ceph::decode; + decode(aset, data_bl_p); } void decode_attrset(map& aset) { - ::decode(aset, data_bl_p); + using ceph::decode; + decode(aset, data_bl_p); } void decode_attrset_bl(bufferlist *pbl) { decode_str_str_map_to_bl(data_bl_p, pbl); } void decode_keyset(set &keys){ - ::decode(keys, data_bl_p); + using ceph::decode; + decode(keys, data_bl_p); } void decode_keyset_bl(bufferlist *pbl){ decode_str_set_to_bl(data_bl_p, pbl); @@ -1069,6 +1076,7 @@ public: */ void write(const coll_t& cid, const ghobject_t& oid, uint64_t off, uint64_t len, const bufferlist& write_data, uint32_t flags = 0) { + using ceph::encode; uint32_t orig_len = data_bl.length(); Op* _op = _get_next_op(); _op->op = OP_WRITE; @@ -1076,7 +1084,7 @@ public: _op->oid = _get_object_id(oid); _op->off = off; _op->len = len; - ::encode(write_data, data_bl); + encode(write_data, data_bl); assert(len == write_data.length()); data.fadvise_flags = data.fadvise_flags | flags; @@ -1130,30 +1138,33 @@ public: } /// Set an xattr of an object void setattr(const coll_t& cid, const ghobject_t& oid, const string& s, bufferlist& val) { + using ceph::encode; Op* _op = _get_next_op(); _op->op = OP_SETATTR; _op->cid = _get_coll_id(cid); _op->oid = _get_object_id(oid); - ::encode(s, data_bl); - ::encode(val, data_bl); + encode(s, data_bl); + encode(val, data_bl); data.ops++; } /// Set multiple xattrs of an object void setattrs(const coll_t& cid, const ghobject_t& oid, const map& attrset) { + using ceph::encode; Op* _op = _get_next_op(); _op->op = OP_SETATTRS; _op->cid = _get_coll_id(cid); _op->oid = _get_object_id(oid); - ::encode(attrset, data_bl); + encode(attrset, data_bl); data.ops++; } /// Set multiple xattrs of an object void setattrs(const coll_t& cid, const ghobject_t& oid, const map& attrset) { + using ceph::encode; Op* _op = _get_next_op(); _op->op = OP_SETATTRS; _op->cid = _get_coll_id(cid); _op->oid = _get_object_id(oid); - ::encode(attrset, data_bl); + encode(attrset, data_bl); data.ops++; } /// remove an xattr from an object @@ -1163,11 +1174,12 @@ public: } /// remove an xattr from an object void rmattr(const coll_t& cid, const ghobject_t& oid, const string& s) { + using ceph::encode; Op* _op = _get_next_op(); _op->op = OP_RMATTR; _op->cid = _get_coll_id(cid); _op->oid = _get_object_id(oid); - ::encode(s, data_bl); + encode(s, data_bl); data.ops++; } /// remove all xattrs from an object @@ -1242,11 +1254,12 @@ public: * data along with the hint type. */ void collection_hint(const coll_t& cid, uint32_t type, const bufferlist& hint) { + using ceph::encode; Op* _op = _get_next_op(); _op->op = OP_COLL_HINT; _op->cid = _get_coll_id(cid); _op->hint_type = type; - ::encode(hint, data_bl); + encode(hint, data_bl); data.ops++; } @@ -1311,11 +1324,12 @@ public: const ghobject_t &oid, ///< [in] Object to update const map &attrset ///< [in] Replacement keys and values ) { + using ceph::encode; Op* _op = _get_next_op(); _op->op = OP_OMAP_SETKEYS; _op->cid = _get_coll_id(cid); _op->oid = _get_object_id(oid); - ::encode(attrset, data_bl); + encode(attrset, data_bl); data.ops++; } @@ -1339,11 +1353,12 @@ public: const ghobject_t &oid, ///< [in] Object from which to remove the omap const set &keys ///< [in] Keys to clear ) { + using ceph::encode; Op* _op = _get_next_op(); _op->op = OP_OMAP_RMKEYS; _op->cid = _get_coll_id(cid); _op->oid = _get_object_id(oid); - ::encode(keys, data_bl); + encode(keys, data_bl); data.ops++; } @@ -1368,12 +1383,13 @@ public: const string& first, ///< [in] first key in range const string& last ///< [in] first key past range, range is [first,last) ) { + using ceph::encode; Op* _op = _get_next_op(); _op->op = OP_OMAP_RMKEYRANGE; _op->cid = _get_coll_id(cid); _op->oid = _get_object_id(oid); - ::encode(first, data_bl); - ::encode(last, data_bl); + encode(first, data_bl); + encode(last, data_bl); data.ops++; } @@ -1383,11 +1399,12 @@ public: const ghobject_t &oid, ///< [in] Object const bufferlist &bl ///< [in] Header value ) { + using ceph::encode; Op* _op = _get_next_op(); _op->op = OP_OMAP_SETHEADER; _op->cid = _get_coll_id(cid); _op->oid = _get_object_id(oid); - ::encode(bl, data_bl); + encode(bl, data_bl); data.ops++; } @@ -1439,10 +1456,10 @@ public: void encode(bufferlist& bl) const { //layout: data_bl + op_bl + coll_index + object_index + data ENCODE_START(9, 9, bl); - ::encode(data_bl, bl); - ::encode(op_bl, bl); - ::encode(coll_index, bl); - ::encode(object_index, bl); + encode(data_bl, bl); + encode(op_bl, bl); + encode(coll_index, bl); + encode(object_index, bl); data.encode(bl); ENCODE_FINISH(bl); } @@ -1451,10 +1468,10 @@ public: DECODE_START(9, bl); DECODE_OLDEST(9); - ::decode(data_bl, bl); - ::decode(op_bl, bl); - ::decode(coll_index, bl); - ::decode(object_index, bl); + decode(data_bl, bl); + decode(op_bl, bl); + decode(coll_index, bl); + decode(object_index, bl); data.decode(bl); coll_id = coll_index.size(); object_id = object_index.size(); diff --git a/src/os/Transaction.cc b/src/os/Transaction.cc index 8dc1449cc14b6..adff495044881 100644 --- a/src/os/Transaction.cc +++ b/src/os/Transaction.cc @@ -200,6 +200,7 @@ void ObjectStore::Transaction::dump(ceph::Formatter *f) case Transaction::OP_COLL_HINT: { + using ceph::decode; coll_t cid = i.get_cid(op->cid); uint32_t type = op->hint_type; f->dump_string("op_name", "coll_hint"); @@ -211,8 +212,8 @@ void ObjectStore::Transaction::dump(ceph::Formatter *f) if (type == Transaction::COLL_HINT_EXPECTED_NUM_OBJECTS) { uint32_t pg_num; uint64_t num_objs; - ::decode(pg_num, hiter); - ::decode(num_objs, hiter); + decode(pg_num, hiter); + decode(num_objs, hiter); f->dump_unsigned("pg_num", pg_num); f->dump_unsigned("expected_num_objects", num_objs); } diff --git a/src/os/bluestore/BitmapFreelistManager.cc b/src/os/bluestore/BitmapFreelistManager.cc index 4a0e719ebe56a..4678abf3ef78d 100644 --- a/src/os/bluestore/BitmapFreelistManager.cc +++ b/src/os/bluestore/BitmapFreelistManager.cc @@ -85,22 +85,22 @@ int BitmapFreelistManager::create(uint64_t new_size, uint64_t granularity, << std::dec << dendl; { bufferlist bl; - ::encode(bytes_per_block, bl); + encode(bytes_per_block, bl); txn->set(meta_prefix, "bytes_per_block", bl); } { bufferlist bl; - ::encode(blocks_per_key, bl); + encode(blocks_per_key, bl); txn->set(meta_prefix, "blocks_per_key", bl); } { bufferlist bl; - ::encode(blocks, bl); + encode(blocks, bl); txn->set(meta_prefix, "blocks", bl); } { bufferlist bl; - ::encode(size, bl); + encode(size, bl); txn->set(meta_prefix, "size", bl); } return 0; @@ -119,25 +119,25 @@ int BitmapFreelistManager::init() if (k == "bytes_per_block") { bufferlist bl = it->value(); bufferlist::iterator p = bl.begin(); - ::decode(bytes_per_block, p); + decode(bytes_per_block, p); dout(10) << __func__ << " bytes_per_block 0x" << std::hex << bytes_per_block << std::dec << dendl; } else if (k == "blocks") { bufferlist bl = it->value(); bufferlist::iterator p = bl.begin(); - ::decode(blocks, p); + decode(blocks, p); dout(10) << __func__ << " blocks 0x" << std::hex << blocks << std::dec << dendl; } else if (k == "size") { bufferlist bl = it->value(); bufferlist::iterator p = bl.begin(); - ::decode(size, p); + decode(size, p); dout(10) << __func__ << " size 0x" << std::hex << size << std::dec << dendl; } else if (k == "blocks_per_key") { bufferlist bl = it->value(); bufferlist::iterator p = bl.begin(); - ::decode(blocks_per_key, p); + decode(blocks_per_key, p); dout(10) << __func__ << " blocks_per_key 0x" << std::hex << blocks_per_key << std::dec << dendl; } else { diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index fb83794658c2a..5644c3eb23a17 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -479,9 +479,9 @@ int BlueFS::_write_super() { // build superblock bufferlist bl; - ::encode(super, bl); + encode(super, bl); uint32_t crc = bl.crc32c(-1); - ::encode(crc, bl); + encode(crc, bl); dout(10) << __func__ << " super block length(encoded): " << bl.length() << dendl; dout(10) << __func__ << " superblock " << super.version << dendl; dout(10) << __func__ << " log_fnode " << super.log_fnode << dendl; @@ -511,13 +511,13 @@ int BlueFS::_open_super() return r; bufferlist::iterator p = bl.begin(); - ::decode(super, p); + decode(super, p); { bufferlist t; t.substr_of(bl, 0, p.get_off()); crc = t.crc32c(-1); } - ::decode(expected_crc, p); + decode(expected_crc, p); if (crc != expected_crc) { derr << __func__ << " bad crc on superblock, expected 0x" << std::hex << expected_crc << " != actual 0x" << crc << std::dec @@ -569,11 +569,11 @@ int BlueFS::_replay(bool noop, bool to_stdout) bufferlist::iterator p = bl.begin(); __u8 a, b; uint32_t len; - ::decode(a, p); - ::decode(b, p); - ::decode(len, p); - ::decode(uuid, p); - ::decode(seq, p); + decode(a, p); + decode(b, p); + decode(len, p); + decode(uuid, p); + decode(seq, p); if (len + 6 > bl.length()) { more = ROUND_UP_TO(len + 6 - bl.length(), super.block_size); } @@ -608,7 +608,7 @@ int BlueFS::_replay(bool noop, bool to_stdout) bluefs_transaction_t t; try { bufferlist::iterator p = bl.begin(); - ::decode(t, p); + decode(t, p); } catch (buffer::error& e) { dout(10) << __func__ << " 0x" << std::hex << pos << std::dec @@ -628,7 +628,7 @@ int BlueFS::_replay(bool noop, bool to_stdout) bufferlist::iterator p = t.op_bl.begin(); while (!p.end()) { __u8 op; - ::decode(op, p); + decode(op, p); switch (op) { case bluefs_transaction_t::OP_INIT: @@ -646,8 +646,8 @@ int BlueFS::_replay(bool noop, bool to_stdout) { uint64_t next_seq; uint64_t offset; - ::decode(next_seq, p); - ::decode(offset, p); + decode(next_seq, p); + decode(offset, p); dout(20) << __func__ << " 0x" << std::hex << pos << std::dec << ": op_jump seq " << next_seq << " offset 0x" << std::hex << offset << std::dec << dendl; @@ -678,7 +678,7 @@ int BlueFS::_replay(bool noop, bool to_stdout) case bluefs_transaction_t::OP_JUMP_SEQ: { uint64_t next_seq; - ::decode(next_seq, p); + decode(next_seq, p); dout(20) << __func__ << " 0x" << std::hex << pos << std::dec << ": op_jump_seq " << next_seq << dendl; if (unlikely(to_stdout)) { @@ -695,9 +695,9 @@ int BlueFS::_replay(bool noop, bool to_stdout) { __u8 id; uint64_t offset, length; - ::decode(id, p); - ::decode(offset, p); - ::decode(length, p); + decode(id, p); + decode(offset, p); + decode(length, p); dout(20) << __func__ << " 0x" << std::hex << pos << std::dec << ": op_alloc_add " << " " << (int)id << ":0x" << std::hex << offset << "~" << length << std::dec @@ -720,9 +720,9 @@ int BlueFS::_replay(bool noop, bool to_stdout) { __u8 id; uint64_t offset, length; - ::decode(id, p); - ::decode(offset, p); - ::decode(length, p); + decode(id, p); + decode(offset, p); + decode(length, p); dout(20) << __func__ << " 0x" << std::hex << pos << std::dec << ": op_alloc_rm " << " " << (int)id << ":0x" << std::hex << offset << "~" << length << std::dec @@ -745,9 +745,9 @@ int BlueFS::_replay(bool noop, bool to_stdout) { string dirname, filename; uint64_t ino; - ::decode(dirname, p); - ::decode(filename, p); - ::decode(ino, p); + decode(dirname, p); + decode(filename, p); + decode(ino, p); dout(20) << __func__ << " 0x" << std::hex << pos << std::dec << ": op_dir_link " << " " << dirname << "/" << filename << " to " << ino @@ -775,8 +775,8 @@ int BlueFS::_replay(bool noop, bool to_stdout) case bluefs_transaction_t::OP_DIR_UNLINK: { string dirname, filename; - ::decode(dirname, p); - ::decode(filename, p); + decode(dirname, p); + decode(filename, p); dout(20) << __func__ << " 0x" << std::hex << pos << std::dec << ": op_dir_unlink " << " " << dirname << "/" << filename << dendl; @@ -801,7 +801,7 @@ int BlueFS::_replay(bool noop, bool to_stdout) case bluefs_transaction_t::OP_DIR_CREATE: { string dirname; - ::decode(dirname, p); + decode(dirname, p); dout(20) << __func__ << " 0x" << std::hex << pos << std::dec << ": op_dir_create " << dirname << dendl; if (unlikely(to_stdout)) { @@ -820,7 +820,7 @@ int BlueFS::_replay(bool noop, bool to_stdout) case bluefs_transaction_t::OP_DIR_REMOVE: { string dirname; - ::decode(dirname, p); + decode(dirname, p); dout(20) << __func__ << " 0x" << std::hex << pos << std::dec << ": op_dir_remove " << dirname << dendl; if (unlikely(to_stdout)) { @@ -840,7 +840,7 @@ int BlueFS::_replay(bool noop, bool to_stdout) case bluefs_transaction_t::OP_FILE_UPDATE: { bluefs_fnode_t fnode; - ::decode(fnode, p); + decode(fnode, p); fnode.recalc_allocated(); dout(20) << __func__ << " 0x" << std::hex << pos << std::dec << ": op_file_update " << " " << fnode << dendl; @@ -862,7 +862,7 @@ int BlueFS::_replay(bool noop, bool to_stdout) case bluefs_transaction_t::OP_FILE_REMOVE: { uint64_t ino; - ::decode(ino, p); + decode(ino, p); dout(20) << __func__ << " 0x" << std::hex << pos << std::dec << ": op_file_remove " << ino << dendl; if (unlikely(to_stdout)) { @@ -1219,7 +1219,7 @@ void BlueFS::_compact_log_sync() t.op_jump_seq(log_seq); bufferlist bl; - ::encode(t, bl); + encode(t, bl); _pad_bl(bl); uint64_t need = bl.length() + cct->_conf->bluefs_max_log_runway; @@ -1342,7 +1342,7 @@ void BlueFS::_compact_log_async(std::unique_lock& l) t.op_jump(log_seq, new_log_jump_to); bufferlist bl; - ::encode(t, bl); + encode(t, bl); _pad_bl(bl); dout(10) << __func__ << " new_log_jump_to 0x" << std::hex << new_log_jump_to @@ -1511,7 +1511,7 @@ int BlueFS::_flush_and_sync_log(std::unique_lock& l, } bufferlist bl; - ::encode(log_t, bl); + encode(log_t, bl); // pad to block boundary _pad_bl(bl); diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index ca756291e1265..ae241d710c08b 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -3266,7 +3266,7 @@ void BlueStore::Collection::load_shared_blob(SharedBlobRef sb) sb->loaded = true; sb->persistent = new bluestore_shared_blob_t(sbid); bufferlist::iterator p = v.begin(); - ::decode(*(sb->persistent), p); + decode(*(sb->persistent), p); ldout(store->cct, 10) << __func__ << " sbid 0x" << std::hex << sbid << std::dec << " loaded shared_blob " << *sb << dendl; } @@ -4141,9 +4141,9 @@ int BlueStore::_write_bdev_label(CephContext *cct, { dout(10) << __func__ << " path " << path << " label " << label << dendl; bufferlist bl; - ::encode(label, bl); + encode(label, bl); uint32_t crc = bl.crc32c(-1); - ::encode(crc, bl); + encode(crc, bl); assert(bl.length() <= BDEV_LABEL_BLOCK_SIZE); bufferptr z(BDEV_LABEL_BLOCK_SIZE - bl.length()); z.zero(); @@ -4193,11 +4193,11 @@ int BlueStore::_read_bdev_label(CephContext* cct, string path, uint32_t crc, expected_crc; bufferlist::iterator p = bl.begin(); try { - ::decode(*label, p); + decode(*label, p); bufferlist t; t.substr_of(bl, 0, p.get_off()); crc = t.crc32c(-1); - ::decode(expected_crc, p); + decode(expected_crc, p); } catch (buffer::error& e) { derr << __func__ << " unable to decode label at offset " << p.get_off() @@ -4361,7 +4361,7 @@ int BlueStore::_open_fm(bool create) dout(20) << __func__ << " reserved 0x" << std::hex << reserved << std::dec << " for bluefs" << dendl; bufferlist bl; - ::encode(bluefs_extents, bl); + encode(bluefs_extents, bl); t->set(PREFIX_SUPER, "bluefs_extents", bl); dout(20) << __func__ << " bluefs_extents 0x" << std::hex << bluefs_extents << std::dec << dendl; @@ -5157,7 +5157,7 @@ int BlueStore::_open_collections(int *errors) bufferlist bl = it->value(); bufferlist::iterator p = bl.begin(); try { - ::decode(c->cnode, p); + decode(c->cnode, p); } catch (buffer::error& e) { derr << __func__ << " failed to decode cnode, key:" << pretty_binary_string(it->key()) << dendl; @@ -5430,14 +5430,14 @@ int BlueStore::mkfs() KeyValueDB::Transaction t = db->get_transaction(); { bufferlist bl; - ::encode((uint64_t)0, bl); + encode((uint64_t)0, bl); t->set(PREFIX_SUPER, "nid_max", bl); t->set(PREFIX_SUPER, "blobid_max", bl); } { bufferlist bl; - ::encode((uint64_t)min_alloc_size, bl); + encode((uint64_t)min_alloc_size, bl); t->set(PREFIX_SUPER, "min_alloc_size", bl); } @@ -6151,7 +6151,7 @@ int BlueStore::_fsck(bool deep, bool repair) bluestore_shared_blob_t shared_blob(sbid); bufferlist bl = it->value(); bufferlist::iterator blp = bl.begin(); - ::decode(shared_blob, blp); + decode(shared_blob, blp); dout(20) << __func__ << " " << *sbi.sb << " " << shared_blob << dendl; if (shared_blob.ref_map != sbi.ref_map) { derr << "fsck error: shared blob 0x" << std::hex << sbid @@ -6218,7 +6218,7 @@ int BlueStore::_fsck(bool deep, bool repair) bufferlist::iterator p = bl.begin(); bluestore_deferred_transaction_t wt; try { - ::decode(wt, p); + decode(wt, p); } catch (buffer::error& e) { derr << "fsck error: failed to decode deferred txn " << pretty_binary_string(it->key()) << dendl; @@ -7000,7 +7000,7 @@ int BlueStore::_decompress(bufferlist& source, bufferlist* result) utime_t start = ceph_clock_now(); bufferlist::iterator i = source.begin(); bluestore_compression_header_t chdr; - ::decode(chdr, i); + decode(chdr, i); int alg = int(chdr.type); CompressorRef cp = compressor; if (!cp || (int)cp->get_type() != alg) { @@ -7117,7 +7117,7 @@ int BlueStore::fiemap( interval_set m; int r = _fiemap(c_, oid, offset, length, m); if (r >= 0) { - ::encode(m, bl); + encode(m, bl); } return r; } @@ -7771,12 +7771,12 @@ void BlueStore::_prepare_ondisk_format_super(KeyValueDB::Transaction& t) assert(ondisk_format == latest_ondisk_format); { bufferlist bl; - ::encode(ondisk_format, bl); + encode(ondisk_format, bl); t->set(PREFIX_SUPER, "ondisk_format", bl); } { bufferlist bl; - ::encode(min_compat_ondisk_format, bl); + encode(min_compat_ondisk_format, bl); t->set(PREFIX_SUPER, "min_compat_ondisk_format", bl); } } @@ -7791,7 +7791,7 @@ int BlueStore::_open_super_meta() bufferlist::iterator p = bl.begin(); try { uint64_t v; - ::decode(v, p); + decode(v, p); nid_max = v; } catch (buffer::error& e) { derr << __func__ << " unable to read nid_max" << dendl; @@ -7809,7 +7809,7 @@ int BlueStore::_open_super_meta() bufferlist::iterator p = bl.begin(); try { uint64_t v; - ::decode(v, p); + decode(v, p); blobid_max = v; } catch (buffer::error& e) { derr << __func__ << " unable to read blobid_max" << dendl; @@ -7838,7 +7838,7 @@ int BlueStore::_open_super_meta() db->get(PREFIX_SUPER, "bluefs_extents", &bl); bufferlist::iterator p = bl.begin(); try { - ::decode(bluefs_extents, p); + decode(bluefs_extents, p); } catch (buffer::error& e) { derr << __func__ << " unable to read bluefs_extents" << dendl; @@ -7862,7 +7862,7 @@ int BlueStore::_open_super_meta() } else { auto p = bl.begin(); try { - ::decode(ondisk_format, p); + decode(ondisk_format, p); } catch (buffer::error& e) { derr << __func__ << " unable to read ondisk_format" << dendl; return -EIO; @@ -7873,7 +7873,7 @@ int BlueStore::_open_super_meta() assert(!r); auto p = bl.begin(); try { - ::decode(compat_ondisk_format, p); + decode(compat_ondisk_format, p); } catch (buffer::error& e) { derr << __func__ << " unable to read compat_ondisk_format" << dendl; return -EIO; @@ -7904,7 +7904,7 @@ int BlueStore::_open_super_meta() auto p = bl.begin(); try { uint64_t val; - ::decode(val, p); + decode(val, p); min_alloc_size = val; min_alloc_size_order = ctz(val); assert(min_alloc_size == 1u << min_alloc_size_order); @@ -7947,7 +7947,7 @@ int BlueStore::_upgrade_super() auto p = bl.begin(); try { uint64_t val; - ::decode(val, p); + decode(val, p); min_alloc_size = val; } catch (buffer::error& e) { derr << __func__ << " failed to read min_min_alloc_size" << dendl; @@ -8256,7 +8256,7 @@ void BlueStore::_txc_write_nodes(TransContext *txc, KeyValueDB::Transaction t) t->rmkey(PREFIX_SHARED_BLOB, key); } else { bufferlist bl; - ::encode(*(sb->persistent), bl); + encode(*(sb->persistent), bl); dout(20) << __func__ << " shared_blob 0x" << std::hex << sbid << std::dec << " is " << bl.length() << " " << *sb << dendl; @@ -8681,7 +8681,7 @@ void BlueStore::_kv_sync_thread() kv_submitting.empty() ? synct : kv_submitting.front()->t; new_nid_max = nid_last + cct->_conf->bluestore_nid_prealloc; bufferlist bl; - ::encode(new_nid_max, bl); + encode(new_nid_max, bl); t->set(PREFIX_SUPER, "nid_max", bl); dout(10) << __func__ << " new_nid_max " << new_nid_max << dendl; } @@ -8690,7 +8690,7 @@ void BlueStore::_kv_sync_thread() kv_submitting.empty() ? synct : kv_submitting.front()->t; new_blobid_max = blobid_last + cct->_conf->bluestore_blobid_prealloc; bufferlist bl; - ::encode(new_blobid_max, bl); + encode(new_blobid_max, bl); t->set(PREFIX_SUPER, "blobid_max", bl); dout(10) << __func__ << " new_blobid_max " << new_blobid_max << dendl; } @@ -8739,7 +8739,7 @@ void BlueStore::_kv_sync_thread() bluefs_extents.insert(p.offset, p.length); } bufferlist bl; - ::encode(bluefs_extents, bl); + encode(bluefs_extents, bl); dout(10) << __func__ << " bluefs_extents now 0x" << std::hex << bluefs_extents << std::dec << dendl; synct->set(PREFIX_SUPER, "bluefs_extents", bl); @@ -9082,7 +9082,7 @@ int BlueStore::_deferred_replay() bufferlist bl = it->value(); bufferlist::iterator p = bl.begin(); try { - ::decode(*deferred_txn, p); + decode(*deferred_txn, p); } catch (buffer::error& e) { derr << __func__ << " failed to decode deferred txn " << pretty_binary_string(it->key()) << dendl; @@ -9159,7 +9159,7 @@ int BlueStore::queue_transactions( if (txc->deferred_txn) { txc->deferred_txn->seq = ++deferred_seq; bufferlist bl; - ::encode(*txc->deferred_txn, bl); + encode(*txc->deferred_txn, bl); string key; get_deferred_key(txc->deferred_txn->seq, &key); txc->t->set(PREFIX_DEFERRED, key, bl); @@ -9287,8 +9287,8 @@ void BlueStore::_txc_add_transaction(TransContext *txc, Transaction *t) if (type == Transaction::COLL_HINT_EXPECTED_NUM_OBJECTS) { uint32_t pg_num; uint64_t num_objs; - ::decode(pg_num, hiter); - ::decode(num_objs, hiter); + decode(pg_num, hiter); + decode(num_objs, hiter); dout(10) << __func__ << " collection hint objects is a no-op, " << " pg_num " << pg_num << " num_objects " << num_objs << dendl; @@ -10190,7 +10190,7 @@ int BlueStore::_do_alloc_write( bluestore_compression_header_t chdr; chdr.type = c->get_type(); chdr.length = t.length(); - ::encode(chdr, wi.compressed_bl); + encode(chdr, wi.compressed_bl); wi.compressed_bl.claim_append(t); wi.compressed_len = wi.compressed_bl.length(); @@ -11099,12 +11099,12 @@ int BlueStore::_omap_setkeys(TransContext *txc, string final_key; _key_encode_u64(o->onode.nid, &final_key); final_key.push_back('.'); - ::decode(num, p); + decode(num, p); while (num--) { string key; bufferlist value; - ::decode(key, p); - ::decode(value, p); + decode(key, p); + decode(value, p); final_key.resize(9); // keep prefix final_key += key; dout(20) << __func__ << " " << pretty_binary_string(final_key) @@ -11161,10 +11161,10 @@ int BlueStore::_omap_rmkeys(TransContext *txc, o->onode.is_pgmeta_omap() ? PREFIX_PGMETA_OMAP : PREFIX_OMAP; _key_encode_u64(o->onode.nid, &final_key); final_key.push_back('.'); - ::decode(num, p); + decode(num, p); while (num--) { string key; - ::decode(key, p); + decode(key, p); final_key.resize(9); // keep prefix final_key += key; dout(20) << __func__ << " rm " << pretty_binary_string(final_key) @@ -11470,7 +11470,7 @@ int BlueStore::_create_collection( (*c)->cnode.bits = bits; coll_map[cid] = *c; } - ::encode((*c)->cnode, bl); + encode((*c)->cnode, bl); txc->t->set(PREFIX_COLL, stringify(cid), bl); r = 0; @@ -11590,7 +11590,7 @@ int BlueStore::_split_collection(TransContext *txc, r = 0; bufferlist bl; - ::encode(c->cnode, bl); + encode(c->cnode, bl); txc->t->set(PREFIX_COLL, stringify(c->cid), bl); dout(10) << __func__ << " " << c->cid << " to " << d->cid << " " diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index a84cffa6e3302..32f4cde3d9cd3 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -567,7 +567,7 @@ public: #ifdef CACHE_BLOB_BL void _encode() const { if (blob_bl.length() == 0 ) { - ::encode(blob, blob_bl); + encode(blob, blob_bl); } else { assert(blob_bl.length()); } @@ -1466,14 +1466,16 @@ public: values[STATFS_COMPRESSED_ALLOCATED] == 0; } void decode(bufferlist::iterator& it) { + using ceph::decode; for (size_t i = 0; i < STATFS_LAST; i++) { - ::decode(values[i], it); + decode(values[i], it); } } void encode(bufferlist& bl) { + using ceph::encode; for (size_t i = 0; i < STATFS_LAST; i++) { - ::encode(values[i], bl); + encode(values[i], bl); } } }; diff --git a/src/os/bluestore/bluefs_types.cc b/src/os/bluestore/bluefs_types.cc index 1058ccebdefc9..d2e6b39c82efe 100644 --- a/src/os/bluestore/bluefs_types.cc +++ b/src/os/bluestore/bluefs_types.cc @@ -34,22 +34,22 @@ ostream& operator<<(ostream& out, const bluefs_extent_t& e) void bluefs_super_t::encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); - ::encode(uuid, bl); - ::encode(osd_uuid, bl); - ::encode(version, bl); - ::encode(block_size, bl); - ::encode(log_fnode, bl); + encode(uuid, bl); + encode(osd_uuid, bl); + encode(version, bl); + encode(block_size, bl); + encode(log_fnode, bl); ENCODE_FINISH(bl); } void bluefs_super_t::decode(bufferlist::iterator& p) { DECODE_START(1, p); - ::decode(uuid, p); - ::decode(osd_uuid, p); - ::decode(version, p); - ::decode(block_size, p); - ::decode(log_fnode, p); + decode(uuid, p); + decode(osd_uuid, p); + decode(version, p); + decode(block_size, p); + decode(log_fnode, p); DECODE_FINISH(p); } @@ -139,10 +139,10 @@ void bluefs_transaction_t::encode(bufferlist& bl) const { uint32_t crc = op_bl.crc32c(-1); ENCODE_START(1, 1, bl); - ::encode(uuid, bl); - ::encode(seq, bl); - ::encode(op_bl, bl); - ::encode(crc, bl); + encode(uuid, bl); + encode(seq, bl); + encode(op_bl, bl); + encode(crc, bl); ENCODE_FINISH(bl); } @@ -150,10 +150,10 @@ void bluefs_transaction_t::decode(bufferlist::iterator& p) { uint32_t crc; DECODE_START(1, p); - ::decode(uuid, p); - ::decode(seq, p); - ::decode(op_bl, p); - ::decode(crc, p); + decode(uuid, p); + decode(seq, p); + decode(op_bl, p); + decode(crc, p); DECODE_FINISH(p); uint32_t actual = op_bl.crc32c(-1); if (actual != crc) diff --git a/src/os/bluestore/bluefs_types.h b/src/os/bluestore/bluefs_types.h index 0cb075f52603e..c78c782575a0a 100644 --- a/src/os/bluestore/bluefs_types.h +++ b/src/os/bluestore/bluefs_types.h @@ -153,55 +153,66 @@ struct bluefs_transaction_t { } void op_init() { - ::encode((__u8)OP_INIT, op_bl); + using ceph::encode; + encode((__u8)OP_INIT, op_bl); } void op_alloc_add(uint8_t id, uint64_t offset, uint64_t length) { - ::encode((__u8)OP_ALLOC_ADD, op_bl); - ::encode(id, op_bl); - ::encode(offset, op_bl); - ::encode(length, op_bl); + using ceph::encode; + encode((__u8)OP_ALLOC_ADD, op_bl); + encode(id, op_bl); + encode(offset, op_bl); + encode(length, op_bl); } void op_alloc_rm(uint8_t id, uint64_t offset, uint64_t length) { - ::encode((__u8)OP_ALLOC_RM, op_bl); - ::encode(id, op_bl); - ::encode(offset, op_bl); - ::encode(length, op_bl); + using ceph::encode; + encode((__u8)OP_ALLOC_RM, op_bl); + encode(id, op_bl); + encode(offset, op_bl); + encode(length, op_bl); } void op_dir_create(const string& dir) { - ::encode((__u8)OP_DIR_CREATE, op_bl); - ::encode(dir, op_bl); + using ceph::encode; + encode((__u8)OP_DIR_CREATE, op_bl); + encode(dir, op_bl); } void op_dir_remove(const string& dir) { - ::encode((__u8)OP_DIR_REMOVE, op_bl); - ::encode(dir, op_bl); + using ceph::encode; + encode((__u8)OP_DIR_REMOVE, op_bl); + encode(dir, op_bl); } void op_dir_link(const string& dir, const string& file, uint64_t ino) { - ::encode((__u8)OP_DIR_LINK, op_bl); - ::encode(dir, op_bl); - ::encode(file, op_bl); - ::encode(ino, op_bl); + using ceph::encode; + encode((__u8)OP_DIR_LINK, op_bl); + encode(dir, op_bl); + encode(file, op_bl); + encode(ino, op_bl); } void op_dir_unlink(const string& dir, const string& file) { - ::encode((__u8)OP_DIR_UNLINK, op_bl); - ::encode(dir, op_bl); - ::encode(file, op_bl); + using ceph::encode; + encode((__u8)OP_DIR_UNLINK, op_bl); + encode(dir, op_bl); + encode(file, op_bl); } void op_file_update(const bluefs_fnode_t& file) { - ::encode((__u8)OP_FILE_UPDATE, op_bl); - ::encode(file, op_bl); + using ceph::encode; + encode((__u8)OP_FILE_UPDATE, op_bl); + encode(file, op_bl); } void op_file_remove(uint64_t ino) { - ::encode((__u8)OP_FILE_REMOVE, op_bl); - ::encode(ino, op_bl); + using ceph::encode; + encode((__u8)OP_FILE_REMOVE, op_bl); + encode(ino, op_bl); } void op_jump(uint64_t next_seq, uint64_t offset) { - ::encode((__u8)OP_JUMP, op_bl); - ::encode(next_seq, op_bl); - ::encode(offset, op_bl); + using ceph::encode; + encode((__u8)OP_JUMP, op_bl); + encode(next_seq, op_bl); + encode(offset, op_bl); } void op_jump_seq(uint64_t next_seq) { - ::encode((__u8)OP_JUMP_SEQ, op_bl); - ::encode(next_seq, op_bl); + using ceph::encode; + encode((__u8)OP_JUMP_SEQ, op_bl); + encode(next_seq, op_bl); } void encode(bufferlist& bl) const; diff --git a/src/os/bluestore/bluestore_types.cc b/src/os/bluestore/bluestore_types.cc index 06f64d21d4b34..c176ab743da6a 100644 --- a/src/os/bluestore/bluestore_types.cc +++ b/src/os/bluestore/bluestore_types.cc @@ -48,11 +48,11 @@ void bluestore_bdev_label_t::encode(bufferlist& bl) const bl.append(stringify(osd_uuid)); bl.append("\n"); ENCODE_START(2, 1, bl); - ::encode(osd_uuid, bl); - ::encode(size, bl); - ::encode(btime, bl); - ::encode(description, bl); - ::encode(meta, bl); + encode(osd_uuid, bl); + encode(size, bl); + encode(btime, bl); + encode(description, bl); + encode(meta, bl); ENCODE_FINISH(bl); } @@ -60,12 +60,12 @@ void bluestore_bdev_label_t::decode(bufferlist::iterator& p) { p.advance(60); // see above DECODE_START(2, p); - ::decode(osd_uuid, p); - ::decode(size, p); - ::decode(btime, p); - ::decode(description, p); + decode(osd_uuid, p); + decode(size, p); + decode(btime, p); + decode(description, p); if (struct_v >= 2) { - ::decode(meta, p); + decode(meta, p); } DECODE_FINISH(p); } diff --git a/src/os/filestore/DBObjectMap.h b/src/os/filestore/DBObjectMap.h index fb1653e489d0e..d07445188e6d2 100644 --- a/src/os/filestore/DBObjectMap.h +++ b/src/os/filestore/DBObjectMap.h @@ -275,21 +275,21 @@ public: void encode(bufferlist &bl) const { ENCODE_START(3, 1, bl); - ::encode(v, bl); - ::encode(seq, bl); - ::encode(legacy, bl); + encode(v, bl); + encode(seq, bl); + encode(legacy, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(3, bl); if (struct_v >= 2) - ::decode(v, bl); + decode(v, bl); else v = 0; - ::decode(seq, bl); + decode(seq, bl); if (struct_v >= 3) - ::decode(legacy, bl); + decode(legacy, bl); else legacy = false; DECODE_FINISH(bl); @@ -319,25 +319,25 @@ public: void encode(bufferlist &bl) const { coll_t unused; ENCODE_START(2, 1, bl); - ::encode(seq, bl); - ::encode(parent, bl); - ::encode(num_children, bl); - ::encode(unused, bl); - ::encode(oid, bl); - ::encode(spos, bl); + encode(seq, bl); + encode(parent, bl); + encode(num_children, bl); + encode(unused, bl); + encode(oid, bl); + encode(spos, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { coll_t unused; DECODE_START(2, bl); - ::decode(seq, bl); - ::decode(parent, bl); - ::decode(num_children, bl); - ::decode(unused, bl); - ::decode(oid, bl); + decode(seq, bl); + decode(parent, bl); + decode(num_children, bl); + decode(unused, bl); + decode(oid, bl); if (struct_v >= 2) - ::decode(spos, bl); + decode(spos, bl); DECODE_FINISH(bl); } diff --git a/src/os/filestore/FileJournal.cc b/src/os/filestore/FileJournal.cc index 1b8c1bd63d9ee..2699a0ad553c8 100644 --- a/src/os/filestore/FileJournal.cc +++ b/src/os/filestore/FileJournal.cc @@ -713,7 +713,7 @@ int FileJournal::read_header(header_t *hdr) const try { bufferlist::iterator p = bl.begin(); - ::decode(*hdr, p); + decode(*hdr, p); } catch (buffer::error& e) { derr << "read_header error decoding journal header" << dendl; @@ -745,7 +745,7 @@ bufferptr FileJournal::prepare_header() Mutex::Locker l(finisher_lock); header.committed_up_to = journaled_seq; } - ::encode(header, bl); + encode(header, bl); bufferptr bp = buffer::create_page_aligned(get_top()); // don't use bp.zero() here, because it also invalidates // crc cache (which is not yet populated anyway) @@ -1558,7 +1558,7 @@ int FileJournal::prepare_entry(vector& tls, bufferlist data_len = (*p).get_data_length(); data_align = ((*p).get_data_alignment() - bl.length()) & ~CEPH_PAGE_MASK; } - ::encode(*p, bl); + encode(*p, bl); } if (tbl->length()) { bl.claim_append(*tbl); diff --git a/src/os/filestore/FileJournal.h b/src/os/filestore/FileJournal.h index b1b8dc8df53a3..f52510d2868cb 100644 --- a/src/os/filestore/FileJournal.h +++ b/src/os/filestore/FileJournal.h @@ -159,57 +159,59 @@ public: } void encode(bufferlist& bl) const { + using ceph::encode; __u32 v = 4; - ::encode(v, bl); + encode(v, bl); bufferlist em; { - ::encode(flags, em); - ::encode(fsid, em); - ::encode(block_size, em); - ::encode(alignment, em); - ::encode(max_size, em); - ::encode(start, em); - ::encode(committed_up_to, em); - ::encode(start_seq, em); + encode(flags, em); + encode(fsid, em); + encode(block_size, em); + encode(alignment, em); + encode(max_size, em); + encode(start, em); + encode(committed_up_to, em); + encode(start_seq, em); } - ::encode(em, bl); + encode(em, bl); } void decode(bufferlist::iterator& bl) { + using ceph::decode; __u32 v; - ::decode(v, bl); - if (v < 2) { // normally 0, but concievably 1 + decode(v, bl); + if (v < 2) { // normally 0, but conceivably 1 // decode old header_t struct (pre v0.40). bl.advance(4); // skip __u32 flags (it was unused by any old code) flags = 0; uint64_t tfsid; - ::decode(tfsid, bl); + decode(tfsid, bl); *(uint64_t*)&fsid.bytes()[0] = tfsid; *(uint64_t*)&fsid.bytes()[8] = tfsid; - ::decode(block_size, bl); - ::decode(alignment, bl); - ::decode(max_size, bl); - ::decode(start, bl); + decode(block_size, bl); + decode(alignment, bl); + decode(max_size, bl); + decode(start, bl); committed_up_to = 0; start_seq = 0; return; } bufferlist em; - ::decode(em, bl); + decode(em, bl); bufferlist::iterator t = em.begin(); - ::decode(flags, t); - ::decode(fsid, t); - ::decode(block_size, t); - ::decode(alignment, t); - ::decode(max_size, t); - ::decode(start, t); + decode(flags, t); + decode(fsid, t); + decode(block_size, t); + decode(alignment, t); + decode(max_size, t); + decode(start, t); if (v > 2) - ::decode(committed_up_to, t); + decode(committed_up_to, t); else committed_up_to = 0; if (v > 3) - ::decode(start_seq, t); + decode(start_seq, t); else start_seq = 0; } diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index 2320eb770b513..f17b83c59a0a4 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -1316,7 +1316,7 @@ int FileStore::_sanity_check_fs() int FileStore::write_superblock() { bufferlist bl; - ::encode(superblock, bl); + encode(superblock, bl); return safe_write_file(basedir.c_str(), "superblock", bl.c_str(), bl.length()); } @@ -1337,7 +1337,7 @@ int FileStore::read_superblock() bufferlist bl; bl.push_back(std::move(bp)); bufferlist::iterator i = bl.begin(); - ::decode(superblock, i); + decode(superblock, i); return 0; } @@ -1357,7 +1357,7 @@ int FileStore::version_stamp_is_valid(uint32_t *version) bufferlist bl; bl.push_back(std::move(bp)); bufferlist::iterator i = bl.begin(); - ::decode(*version, i); + decode(*version, i); dout(10) << __FUNC__ << ": was " << *version << " vs target " << target_version << dendl; if (*version == target_version) @@ -1370,7 +1370,7 @@ int FileStore::write_version_stamp() { dout(1) << __FUNC__ << ": " << target_version << dendl; bufferlist bl; - ::encode(target_version, bl); + encode(target_version, bl); return safe_write_file(basedir.c_str(), "store_version", bl.c_str(), bl.length()); @@ -2399,7 +2399,7 @@ void FileStore::_set_global_replay_guard(const coll_t& cid, // then record that we did it bufferlist v; - ::encode(spos, v); + encode(spos, v); int r = chain_fsetxattr( fd, GLOBAL_REPLAY_GUARD_XATTR, v.c_str(), v.length()); if (r < 0) { @@ -2441,7 +2441,7 @@ int FileStore::_check_global_replay_guard(const coll_t& cid, SequencerPosition opos; bufferlist::iterator p = bl.begin(); - ::decode(opos, p); + decode(opos, p); VOID_TEMP_FAILURE_RETRY(::close(fd)); return spos >= opos ? 1 : -1; @@ -2491,8 +2491,8 @@ void FileStore::_set_replay_guard(int fd, // then record that we did it bufferlist v(40); - ::encode(spos, v); - ::encode(in_progress, v); + encode(spos, v); + encode(in_progress, v); int r = chain_fsetxattr( fd, REPLAY_GUARD_XATTR, v.c_str(), v.length()); if (r < 0) { @@ -2540,9 +2540,9 @@ void FileStore::_close_replay_guard(int fd, const SequencerPosition& spos, // then record that we are done with this operation bufferlist v(40); - ::encode(spos, v); + encode(spos, v); bool in_progress = false; - ::encode(in_progress, v); + encode(in_progress, v); int r = chain_fsetxattr( fd, REPLAY_GUARD_XATTR, v.c_str(), v.length()); if (r < 0) { @@ -2613,10 +2613,10 @@ int FileStore::_check_replay_guard(int fd, const SequencerPosition& spos) SequencerPosition opos; bufferlist::iterator p = bl.begin(); - ::decode(opos, p); + decode(opos, p); bool in_progress = false; if (!p.end()) // older journals don't have this - ::decode(in_progress, p); + decode(in_progress, p); if (opos > spos) { dout(10) << __FUNC__ << ": object has " << opos << " > current pos " << spos << ", now or in future, SKIPPING REPLAY" << dendl; @@ -2884,8 +2884,8 @@ void FileStore::_do_transaction( if (type == Transaction::COLL_HINT_EXPECTED_NUM_OBJECTS) { uint32_t pg_num; uint64_t num_objs; - ::decode(pg_num, hiter); - ::decode(num_objs, hiter); + decode(pg_num, hiter); + decode(num_objs, hiter); if (_check_replay_guard(cid, spos) > 0) { r = _collection_hint_expected_num_objs(cid, pg_num, num_objs, spos); } @@ -3437,7 +3437,7 @@ int FileStore::fiemap(const coll_t& _cid, const ghobject_t& oid, map exomap; int r = fiemap(_cid, oid, offset, len, exomap); if (r >= 0) { - ::encode(exomap, bl); + encode(exomap, bl); } return r; } @@ -5998,7 +5998,7 @@ void FSSuperblock::encode(bufferlist &bl) const { ENCODE_START(2, 1, bl); compat_features.encode(bl); - ::encode(omap_backend, bl); + encode(omap_backend, bl); ENCODE_FINISH(bl); } @@ -6007,7 +6007,7 @@ void FSSuperblock::decode(bufferlist::iterator &bl) DECODE_START(2, bl); compat_features.decode(bl); if (struct_v >= 2) - ::decode(omap_backend, bl); + decode(omap_backend, bl); else omap_backend = "leveldb"; DECODE_FINISH(bl); diff --git a/src/os/filestore/GenericFileStoreBackend.cc b/src/os/filestore/GenericFileStoreBackend.cc index a250956d2c8ff..7f3e9b23188e7 100644 --- a/src/os/filestore/GenericFileStoreBackend.cc +++ b/src/os/filestore/GenericFileStoreBackend.cc @@ -397,7 +397,7 @@ int GenericFileStoreBackend::_crc_load_or_init(int fd, SloppyCRCMap *cm) bl.append(std::move(bp)); bufferlist::iterator p = bl.begin(); try { - ::decode(*cm, p); + decode(*cm, p); } catch (buffer::error &e) { r = -EIO; @@ -410,7 +410,7 @@ int GenericFileStoreBackend::_crc_load_or_init(int fd, SloppyCRCMap *cm) int GenericFileStoreBackend::_crc_save(int fd, SloppyCRCMap *cm) { bufferlist bl; - ::encode(*cm, bl); + encode(*cm, bl); int r = chain_fsetxattr(fd, SLOPPY_CRC_XATTR, bl.c_str(), bl.length()); if (r < 0) derr << __func__ << " got " << cpp_strerror(r) << dendl; diff --git a/src/os/filestore/HashIndex.h b/src/os/filestore/HashIndex.h index 981e600d837d6..e992b1aaea5d2 100644 --- a/src/os/filestore/HashIndex.h +++ b/src/os/filestore/HashIndex.h @@ -84,21 +84,23 @@ private: void encode(bufferlist &bl) const { + using ceph::encode; __u8 v = 1; - ::encode(v, bl); - ::encode(objs, bl); - ::encode(subdirs, bl); - ::encode(hash_level, bl); + encode(v, bl); + encode(objs, bl); + encode(subdirs, bl); + encode(hash_level, bl); } void decode(bufferlist::iterator &bl) { + using ceph::decode; __u8 v; - ::decode(v, bl); + decode(v, bl); assert(v == 1); - ::decode(objs, bl); - ::decode(subdirs, bl); - ::decode(hash_level, bl); + decode(objs, bl); + decode(subdirs, bl); + decode(hash_level, bl); } }; @@ -107,15 +109,17 @@ private: settings_s() : split_rand_factor(0) {} void encode(bufferlist &bl) const { + using ceph::encode; __u8 v = 1; - ::encode(v, bl); - ::encode(split_rand_factor, bl); + encode(v, bl); + encode(split_rand_factor, bl); } void decode(bufferlist::iterator &bl) { + using ceph::decode; __u8 v; - ::decode(v, bl); - ::decode(split_rand_factor, bl); + decode(v, bl); + decode(split_rand_factor, bl); } } settings; @@ -139,18 +143,20 @@ private: bool is_merge() const { return op == MERGE; } void encode(bufferlist &bl) const { + using ceph::encode; __u8 v = 1; - ::encode(v, bl); - ::encode(op, bl); - ::encode(path, bl); + encode(v, bl); + encode(op, bl); + encode(path, bl); } void decode(bufferlist::iterator &bl) { + using ceph::decode; __u8 v; - ::decode(v, bl); + decode(v, bl); assert(v == 1); - ::decode(op, bl); - ::decode(path, bl); + decode(op, bl); + decode(path, bl); } }; diff --git a/src/os/filestore/IndexManager.cc b/src/os/filestore/IndexManager.cc index 74cc454ffd8b1..3a884f84170e1 100644 --- a/src/os/filestore/IndexManager.cc +++ b/src/os/filestore/IndexManager.cc @@ -35,7 +35,7 @@ static int set_version(const char *path, uint32_t version) { bufferlist bl; - ::encode(version, bl); + encode(version, bl); return chain_setxattr( path, "user.cephos.collection_version", bl.c_str(), bl.length()); @@ -57,7 +57,7 @@ static int get_version(const char *path, uint32_t *version) { bufferlist bl; bl.push_back(bp); bufferlist::iterator i = bl.begin(); - ::decode(*version, i); + decode(*version, i); return 0; } diff --git a/src/os/filestore/SequencerPosition.h b/src/os/filestore/SequencerPosition.h index c2ecf853bcf32..6c5b11c9f2d2f 100644 --- a/src/os/filestore/SequencerPosition.h +++ b/src/os/filestore/SequencerPosition.h @@ -23,16 +23,16 @@ struct SequencerPosition { void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); - ::encode(seq, bl); - ::encode(trans, bl); - ::encode(op, bl); + encode(seq, bl); + encode(trans, bl); + encode(op, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& p) { DECODE_START(1, p); - ::decode(seq, p); - ::decode(trans, p); - ::decode(op, p); + decode(seq, p); + decode(trans, p); + decode(op, p); DECODE_FINISH(p); } void dump(Formatter *f) const { diff --git a/src/os/kstore/KStore.cc b/src/os/kstore/KStore.cc index f7a4214a83e2a..9beedbaa70f11 100644 --- a/src/os/kstore/KStore.cc +++ b/src/os/kstore/KStore.cc @@ -611,7 +611,7 @@ KStore::OnodeRef KStore::Collection::get_onode( on = new Onode(store->cct, oid, key); on->exists = true; bufferlist::iterator p = v.begin(); - ::decode(on->onode, p); + decode(on->onode, p); } o.reset(on); onode_map.add(oid, o); @@ -884,7 +884,7 @@ int KStore::_open_collections(int *errors) bufferlist bl = it->value(); bufferlist::iterator p = bl.begin(); try { - ::decode(c->cnode, p); + decode(c->cnode, p); } catch (buffer::error& e) { derr << __func__ << " failed to decode cnode, key:" << pretty_binary_string(it->key()) << dendl; @@ -1281,7 +1281,7 @@ int KStore::fiemap( map m; int r = fiemap(cid, oid, offset, len, m); if (r >= 0) { - ::encode(m, bl); + encode(m, bl); } return r; @@ -1887,7 +1887,7 @@ int KStore::_open_super_meta() db->get(PREFIX_SUPER, "nid_max", &bl); bufferlist::iterator p = bl.begin(); try { - ::decode(nid_max, p); + decode(nid_max, p); } catch (buffer::error& e) { } dout(10) << __func__ << " old nid_max " << nid_max << dendl; @@ -1906,7 +1906,7 @@ void KStore::_assign_nid(TransContext *txc, OnodeRef o) if (nid_last > nid_max) { nid_max += cct->_conf->kstore_nid_prealloc; bufferlist bl; - ::encode(nid_max, bl); + encode(nid_max, bl); txc->t->set(PREFIX_SUPER, "nid_max", bl); dout(10) << __func__ << " nid_max now " << nid_max << dendl; } @@ -1981,7 +1981,7 @@ void KStore::_txc_finalize(OpSequencer *osr, TransContext *txc) p != txc->onodes.end(); ++p) { bufferlist bl; - ::encode((*p)->onode, bl); + encode((*p)->onode, bl); dout(20) << " onode size is " << bl.length() << dendl; txc->t->set(PREFIX_OBJ, (*p)->key, bl); @@ -2257,8 +2257,8 @@ void KStore::_txc_add_transaction(TransContext *txc, Transaction *t) if (type == Transaction::COLL_HINT_EXPECTED_NUM_OBJECTS) { uint32_t pg_num; uint64_t num_objs; - ::decode(pg_num, hiter); - ::decode(num_objs, hiter); + decode(pg_num, hiter); + decode(num_objs, hiter); dout(10) << __func__ << " collection hint objects is a no-op, " << " pg_num " << pg_num << " num_objects " << num_objs << dendl; @@ -2989,12 +2989,12 @@ int KStore::_omap_setkeys(TransContext *txc, o->onode.omap_head = o->onode.nid; txc->write_onode(o); } - ::decode(num, p); + decode(num, p); while (num--) { string key; bufferlist value; - ::decode(key, p); - ::decode(value, p); + decode(key, p); + decode(value, p); string final_key; get_omap_key(o->onode.omap_head, key, &final_key); dout(30) << __func__ << " " << pretty_binary_string(final_key) @@ -3039,10 +3039,10 @@ int KStore::_omap_rmkeys(TransContext *txc, r = 0; goto out; } - ::decode(num, p); + decode(num, p); while (num--) { string key; - ::decode(key, p); + decode(key, p); string final_key; get_omap_key(o->onode.omap_head, key, &final_key); dout(30) << __func__ << " rm " << pretty_binary_string(final_key) @@ -3279,7 +3279,7 @@ int KStore::_create_collection( (*c)->cnode.bits = bits; coll_map[cid] = *c; } - ::encode((*c)->cnode, bl); + encode((*c)->cnode, bl); txc->t->set(PREFIX_COLL, stringify(cid), bl); r = 0; @@ -3363,7 +3363,7 @@ int KStore::_split_collection(TransContext *txc, r = 0; bufferlist bl; - ::encode(c->cnode, bl); + encode(c->cnode, bl); txc->t->set(PREFIX_COLL, stringify(c->cid), bl); dout(10) << __func__ << " " << c->cid << " to " << d->cid << " " diff --git a/src/os/kstore/kstore_types.cc b/src/os/kstore/kstore_types.cc index 0489db02ca69a..ce785be99c6a6 100644 --- a/src/os/kstore/kstore_types.cc +++ b/src/os/kstore/kstore_types.cc @@ -21,14 +21,14 @@ void kstore_cnode_t::encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); - ::encode(bits, bl); + encode(bits, bl); ENCODE_FINISH(bl); } void kstore_cnode_t::decode(bufferlist::iterator& p) { DECODE_START(1, p); - ::decode(bits, p); + decode(bits, p); DECODE_FINISH(p); } @@ -50,28 +50,28 @@ void kstore_cnode_t::generate_test_instances(list& o) void kstore_onode_t::encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); - ::encode(nid, bl); - ::encode(size, bl); - ::encode(attrs, bl); - ::encode(omap_head, bl); - ::encode(stripe_size, bl); - ::encode(expected_object_size, bl); - ::encode(expected_write_size, bl); - ::encode(alloc_hint_flags, bl); + encode(nid, bl); + encode(size, bl); + encode(attrs, bl); + encode(omap_head, bl); + encode(stripe_size, bl); + encode(expected_object_size, bl); + encode(expected_write_size, bl); + encode(alloc_hint_flags, bl); ENCODE_FINISH(bl); } void kstore_onode_t::decode(bufferlist::iterator& p) { DECODE_START(1, p); - ::decode(nid, p); - ::decode(size, p); - ::decode(attrs, p); - ::decode(omap_head, p); - ::decode(stripe_size, p); - ::decode(expected_object_size, p); - ::decode(expected_write_size, p); - ::decode(alloc_hint_flags, p); + decode(nid, p); + decode(size, p); + decode(attrs, p); + decode(omap_head, p); + decode(stripe_size, p); + decode(expected_object_size, p); + decode(expected_write_size, p); + decode(alloc_hint_flags, p); DECODE_FINISH(p); } diff --git a/src/os/memstore/MemStore.cc b/src/os/memstore/MemStore.cc index f227e95403192..c4adda61ef1e8 100644 --- a/src/os/memstore/MemStore.cc +++ b/src/os/memstore/MemStore.cc @@ -79,7 +79,7 @@ int MemStore::_save() string fn = path + "/collections"; bufferlist bl; - ::encode(collections, bl); + encode(collections, bl); int r = bl.write_file(fn.c_str()); if (r < 0) return r; @@ -148,7 +148,7 @@ int MemStore::_load() set collections; bufferlist::iterator p = bl.begin(); - ::decode(collections, p); + decode(collections, p); for (set::iterator q = collections.begin(); q != collections.end(); @@ -209,7 +209,7 @@ int MemStore::mkfs() derr << path << dendl; bufferlist bl; set collections; - ::encode(collections, bl); + encode(collections, bl); r = bl.write_file(fn.c_str()); if (r < 0) return r; @@ -357,7 +357,7 @@ int MemStore::fiemap(const coll_t& cid, const ghobject_t& oid, map destmap; int r = fiemap(cid, oid, offset, len, destmap); if (r >= 0) - ::encode(destmap, bl); + encode(destmap, bl); return r; } @@ -884,8 +884,8 @@ void MemStore::_do_transaction(Transaction& t) if (type == Transaction::COLL_HINT_EXPECTED_NUM_OBJECTS) { uint32_t pg_num; uint64_t num_objs; - ::decode(pg_num, hiter); - ::decode(num_objs, hiter); + decode(pg_num, hiter); + decode(num_objs, hiter); r = _collection_hint_expected_num_objs(cid, pg_num, num_objs); } else { // Ignore the hint @@ -1294,11 +1294,11 @@ int MemStore::_omap_setkeys(const coll_t& cid, const ghobject_t &oid, std::lock_guard lock(o->omap_mutex); bufferlist::iterator p = aset_bl.begin(); __u32 num; - ::decode(num, p); + decode(num, p); while (num--) { string key; - ::decode(key, p); - ::decode(o->omap[key], p); + decode(key, p); + decode(o->omap[key], p); } return 0; } @@ -1317,10 +1317,10 @@ int MemStore::_omap_rmkeys(const coll_t& cid, const ghobject_t &oid, std::lock_guard lock(o->omap_mutex); bufferlist::iterator p = keys_bl.begin(); __u32 num; - ::decode(num, p); + decode(num, p); while (num--) { string key; - ::decode(key, p); + decode(key, p); o->omap.erase(key); } return 0; @@ -1495,13 +1495,13 @@ struct BufferlistObject : public MemStore::Object { void encode(bufferlist& bl) const override { ENCODE_START(1, 1, bl); - ::encode(data, bl); + encode(data, bl); encode_base(bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& p) override { DECODE_START(1, p); - ::decode(data, p); + decode(data, p); decode_base(p); DECODE_FINISH(p); } @@ -1603,14 +1603,14 @@ struct MemStore::PageSetObject : public Object { void encode(bufferlist& bl) const override { ENCODE_START(1, 1, bl); - ::encode(data_len, bl); + encode(data_len, bl); data.encode(bl); encode_base(bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& p) override { DECODE_START(1, p); - ::decode(data_len, p); + decode(data_len, p); data.decode(p); decode_base(p); DECODE_FINISH(p); diff --git a/src/os/memstore/MemStore.h b/src/os/memstore/MemStore.h index 72c7b5cec6946..ee5309e8e0299 100644 --- a/src/os/memstore/MemStore.h +++ b/src/os/memstore/MemStore.h @@ -53,14 +53,16 @@ public: virtual void decode(bufferlist::iterator& p) = 0; void encode_base(bufferlist& bl) const { - ::encode(xattr, bl); - ::encode(omap_header, bl); - ::encode(omap, bl); + using ceph::encode; + encode(xattr, bl); + encode(omap_header, bl); + encode(omap, bl); } void decode_base(bufferlist::iterator& p) { - ::decode(xattr, p); - ::decode(omap_header, p); - ::decode(omap, p); + using ceph::decode; + decode(xattr, p); + decode(omap_header, p); + decode(omap, p); } void dump(Formatter *f) const { @@ -137,27 +139,27 @@ public: void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); - ::encode(xattr, bl); - ::encode(use_page_set, bl); + encode(xattr, bl); + encode(use_page_set, bl); uint32_t s = object_map.size(); - ::encode(s, bl); + encode(s, bl); for (map::const_iterator p = object_map.begin(); p != object_map.end(); ++p) { - ::encode(p->first, bl); + encode(p->first, bl); p->second->encode(bl); } ENCODE_FINISH(bl); } void decode(bufferlist::iterator& p) { DECODE_START(1, p); - ::decode(xattr, p); - ::decode(use_page_set, p); + decode(xattr, p); + decode(use_page_set, p); uint32_t s; - ::decode(s, p); + decode(s, p); while (s--) { ghobject_t k; - ::decode(k, p); + decode(k, p); auto o = create_object(); o->decode(p); object_map.insert(make_pair(k, o)); diff --git a/src/os/memstore/PageSet.h b/src/os/memstore/PageSet.h index 0cdc598768929..9c35592c5484d 100644 --- a/src/os/memstore/PageSet.h +++ b/src/os/memstore/PageSet.h @@ -52,12 +52,14 @@ struct Page { } }; void encode(bufferlist &bl, size_t page_size) const { + using ceph::encode; bl.append(buffer::copy(data, page_size)); - ::encode(offset, bl); + encode(offset, bl); } void decode(bufferlist::iterator &p, size_t page_size) { + using ceph::decode; p.copy(page_size, data); - ::decode(offset, p); + decode(offset, p); } static Ref create(size_t page_size, uint64_t offset = 0) { @@ -205,17 +207,19 @@ class PageSet { } void encode(bufferlist &bl) const { - ::encode(page_size, bl); + using ceph::encode; + encode(page_size, bl); unsigned count = pages.size(); - ::encode(count, bl); + encode(count, bl); for (auto p = pages.rbegin(); p != pages.rend(); ++p) p->encode(bl, page_size); } void decode(bufferlist::iterator &p) { + using ceph::decode; assert(empty()); - ::decode(page_size, p); + decode(page_size, p); unsigned count; - ::decode(count, p); + decode(count, p); auto cur = pages.end(); for (unsigned i = 0; i < count; i++) { auto page = Page::create(page_size); -- 2.39.5