summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mds/CDentry.h20
-rw-r--r--src/mds/CDir.h40
-rw-r--r--src/mds/CInode.h132
-rw-r--r--src/mds/Capability.cc24
-rw-r--r--src/mds/Capability.h26
-rw-r--r--src/mds/FSMap.cc8
-rw-r--r--src/mds/FSMap.h24
-rw-r--r--src/mds/FSMapUser.cc16
-rw-r--r--src/mds/FSMapUser.h14
-rw-r--r--src/mds/LocalLock.h4
-rw-r--r--src/mds/MDSAuthCaps.h4
-rw-r--r--src/mds/MDSCacheObject.cc4
-rw-r--r--src/mds/MDSCacheObject.h16
-rw-r--r--src/mds/MDSContext.h8
-rw-r--r--src/mds/MDSMap.cc18
-rw-r--r--src/mds/MDSMap.h30
-rw-r--r--src/mds/Mutation.h74
-rw-r--r--src/mds/ScatterLock.h6
-rw-r--r--src/mds/ScrubHeader.h15
-rw-r--r--src/mds/SessionMap.h40
-rw-r--r--src/mds/SimpleLock.cc2
-rw-r--r--src/mds/SimpleLock.h30
-rw-r--r--src/mds/SnapRealm.h32
-rw-r--r--src/mds/flock.cc8
-rw-r--r--src/mds/flock.h52
-rw-r--r--src/mds/inode_backtrace.cc18
-rw-r--r--src/mds/inode_backtrace.h24
-rw-r--r--src/mds/mdstypes.cc14
-rw-r--r--src/mds/mdstypes.h268
-rw-r--r--src/mds/snap.h32
30 files changed, 525 insertions, 478 deletions
diff --git a/src/mds/CDentry.h b/src/mds/CDentry.h
index 353b5e24aef..8bfdf0009b3 100644
--- a/src/mds/CDentry.h
+++ b/src/mds/CDentry.h
@@ -9,11 +9,9 @@
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
- *
+ *
*/
-
-
#ifndef CEPH_CDENTRY_H
#define CEPH_CDENTRY_H
@@ -249,7 +247,7 @@ public:
// -- exporting
// note: this assumes the dentry already exists.
// i.e., the name is already extracted... so we just need the other state.
- void encode_export(bufferlist& bl) {
+ void encode_export(ceph::buffer::list& bl) {
ENCODE_START(1, 1, bl);
encode(first, bl);
encode(state, bl);
@@ -272,7 +270,7 @@ public:
void abort_export() {
put(PIN_TEMPEXPORTING);
}
- void decode_import(bufferlist::const_iterator& blp, LogSegment *ls) {
+ void decode_import(ceph::buffer::list::const_iterator& blp, LogSegment *ls) {
DECODE_START(1, blp);
decode(first, blp);
__u32 nstate;
@@ -299,8 +297,8 @@ public:
return &lock;
}
void set_object_info(MDSCacheObjectInfo &info) override;
- void encode_lock_state(int type, bufferlist& bl) override;
- void decode_lock_state(int type, const bufferlist& bl) override;
+ void encode_lock_state(int type, ceph::buffer::list& bl) override;
+ void decode_lock_state(int type, const ceph::buffer::list& bl) override;
// ---------------------------------------------
// replicas (on clients)
@@ -330,9 +328,9 @@ public:
void remove_client_lease(ClientLease *r, Locker *locker); // returns remaining mask (if any), and kicks locker eval_gathers
void remove_client_leases(Locker *locker);
- ostream& print_db_line_prefix(ostream& out) override;
- void print(ostream& out) override;
- void dump(Formatter *f) const;
+ std::ostream& print_db_line_prefix(std::ostream& out) override;
+ void print(std::ostream& out) override;
+ void dump(ceph::Formatter *f) const;
__u32 hash;
@@ -371,7 +369,7 @@ private:
mempool::mds_co::string name;
};
-ostream& operator<<(ostream& out, const CDentry& dn);
+std::ostream& operator<<(std::ostream& out, const CDentry& dn);
#endif
diff --git a/src/mds/CDir.h b/src/mds/CDir.h
index aa447a88d00..8af22193511 100644
--- a/src/mds/CDir.h
+++ b/src/mds/CDir.h
@@ -41,7 +41,7 @@ class MDCache;
struct ObjectOperation;
-ostream& operator<<(ostream& out, const class CDir& dir);
+std::ostream& operator<<(std::ostream& out, const class CDir& dir);
class CDir : public MDSCacheObject, public Counter<CDir> {
public:
@@ -428,9 +428,9 @@ public:
}
}
- static void encode_dirstat(bufferlist& bl, const session_info_t& info, const DirStat& ds);
+ static void encode_dirstat(ceph::buffer::list& bl, const session_info_t& info, const DirStat& ds);
- void _encode_base(bufferlist& bl) {
+ void _encode_base(ceph::buffer::list& bl) {
ENCODE_START(1, 1, bl);
encode(first, bl);
encode(fnode, bl);
@@ -438,7 +438,7 @@ public:
encode(dir_rep_by, bl);
ENCODE_FINISH(bl);
}
- void _decode_base(bufferlist::const_iterator& p) {
+ void _decode_base(ceph::buffer::list::const_iterator& p) {
DECODE_START(1, p);
decode(first, p);
decode(fnode, p);
@@ -497,12 +497,12 @@ public:
void finish_waiting(uint64_t mask, int result = 0); // ditto
// -- import/export --
- void encode_export(bufferlist& bl);
+ void encode_export(ceph::buffer::list& bl);
void finish_export();
void abort_export() {
put(PIN_TEMPEXPORTING);
}
- void decode_import(bufferlist::const_iterator& blp, LogSegment *ls);
+ void decode_import(ceph::buffer::list::const_iterator& blp, LogSegment *ls);
void abort_import();
// -- auth pins --
@@ -528,13 +528,13 @@ public:
void maybe_finish_freeze();
- pair<bool,bool> is_freezing_or_frozen_tree() const {
+ std::pair<bool,bool> is_freezing_or_frozen_tree() const {
if (freeze_tree_state) {
if (freeze_tree_state->frozen)
- return make_pair(false, true);
- return make_pair(true, false);
+ return std::make_pair(false, true);
+ return std::make_pair(true, false);
}
- return make_pair(false, false);
+ return std::make_pair(false, false);
}
bool is_freezing() const override { return is_freezing_dir() || is_freezing_tree(); }
@@ -591,10 +591,10 @@ public:
}
void enable_frozen_inode();
- ostream& print_db_line_prefix(ostream& out) override;
- void print(ostream& out) override;
- void dump(Formatter *f, int flags = DUMP_DEFAULT) const;
- void dump_load(Formatter *f);
+ std::ostream& print_db_line_prefix(std::ostream& out) override;
+ void print(std::ostream& out) override;
+ void dump(ceph::Formatter *f, int flags = DUMP_DEFAULT) const;
+ void dump_load(ceph::Formatter *f);
// context
MDCache *cache;
@@ -635,13 +635,13 @@ protected:
void _omap_fetch(MDSContext *fin, const std::set<dentry_key_t>& keys);
void _omap_fetch_more(
- bufferlist& hdrbl, std::map<std::string, bufferlist>& omap,
+ ceph::buffer::list& hdrbl, std::map<std::string, ceph::buffer::list>& omap,
MDSContext *fin);
CDentry *_load_dentry(
std::string_view key,
std::string_view dname,
snapid_t last,
- bufferlist &bl,
+ ceph::buffer::list &bl,
int pos,
const std::set<snapid_t> *snaps,
bool *force_dirty);
@@ -661,13 +661,13 @@ protected:
*/
void go_bad(bool complete);
- void _omap_fetched(bufferlist& hdrbl, std::map<std::string, bufferlist>& omap,
+ void _omap_fetched(ceph::buffer::list& hdrbl, std::map<std::string, ceph::buffer::list>& omap,
bool complete, int r);
// -- commit --
void _commit(version_t want, int op_prio);
void _omap_commit(int op_prio);
- void _encode_dentry(CDentry *dn, bufferlist& bl, const std::set<snapid_t> *snaps);
+ void _encode_dentry(CDentry *dn, ceph::buffer::list& bl, const std::set<snapid_t> *snaps);
void _committed(int r, version_t v);
version_t projected_version = 0;
@@ -730,7 +730,7 @@ protected:
mempool::mds_co::compact_map< string_snap_t, MDSContext::vec_alloc<mempool::mds_co::pool_allocator> > waiting_on_dentry; // FIXME string_snap_t not in mempool
private:
- friend ostream& operator<<(ostream& out, const class CDir& dir);
+ friend std::ostream& operator<<(std::ostream& out, const class CDir& dir);
void log_mark_dirty();
@@ -755,7 +755,7 @@ private:
void purge_stale_snap_data(const std::set<snapid_t>& snaps);
void prepare_new_fragment(bool replay);
- void prepare_old_fragment(map<string_snap_t, MDSContext::vec >& dentry_waiters, bool replay);
+ void prepare_old_fragment(std::map<string_snap_t, MDSContext::vec >& dentry_waiters, bool replay);
void steal_dentry(CDentry *dn); // from another dir. used by merge/split.
void finish_old_fragment(MDSContext::vec& waiters, bool replay);
void init_fragment_pins();
diff --git a/src/mds/CInode.h b/src/mds/CInode.h
index 5f0da6415c7..64295f651fb 100644
--- a/src/mds/CInode.h
+++ b/src/mds/CInode.h
@@ -81,15 +81,15 @@ public:
static object_t get_object_name(inodeno_t ino, frag_t fg, std::string_view suffix);
/* Full serialization for use in ".inode" root inode objects */
- void encode(bufferlist &bl, uint64_t features, const bufferlist *snap_blob=NULL) const;
- void decode(bufferlist::const_iterator &bl, bufferlist& snap_blob);
+ void encode(ceph::buffer::list &bl, uint64_t features, const ceph::buffer::list *snap_blob=NULL) const;
+ void decode(ceph::buffer::list::const_iterator &bl, ceph::buffer::list& snap_blob);
/* Serialization without ENCODE_START/FINISH blocks for use embedded in dentry */
- void encode_bare(bufferlist &bl, uint64_t features, const bufferlist *snap_blob=NULL) const;
- void decode_bare(bufferlist::const_iterator &bl, bufferlist &snap_blob, __u8 struct_v=5);
+ void encode_bare(ceph::buffer::list &bl, uint64_t features, const ceph::buffer::list *snap_blob=NULL) const;
+ void decode_bare(ceph::buffer::list::const_iterator &bl, ceph::buffer::list &snap_blob, __u8 struct_v=5);
/* For test/debug output */
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
/* For use by offline tools */
__u32 hash_dentry_name(std::string_view dn);
@@ -106,23 +106,23 @@ public:
class InodeStore : public InodeStoreBase {
public:
- void encode(bufferlist &bl, uint64_t features) const {
+ void encode(ceph::buffer::list &bl, uint64_t features) const {
InodeStoreBase::encode(bl, features, &snap_blob);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
InodeStoreBase::decode(bl, snap_blob);
}
- void encode_bare(bufferlist &bl, uint64_t features) const {
+ void encode_bare(ceph::buffer::list &bl, uint64_t features) const {
InodeStoreBase::encode_bare(bl, features, &snap_blob);
}
- void decode_bare(bufferlist::const_iterator &bl) {
+ void decode_bare(ceph::buffer::list::const_iterator &bl) {
InodeStoreBase::decode_bare(bl, snap_blob);
}
static void generate_test_instances(std::list<InodeStore*>& ls);
- // FIXME bufferlist not part of mempool
- bufferlist snap_blob; // Encoded copy of SnapRealm, because we can't
+ // FIXME ceph::buffer::list not part of mempool
+ ceph::buffer::list snap_blob; // Encoded copy of SnapRealm, because we can't
// rehydrate it without full MDCache
};
WRITE_CLASS_ENCODER_FEATURES(InodeStore)
@@ -130,10 +130,10 @@ WRITE_CLASS_ENCODER_FEATURES(InodeStore)
// just for ceph-dencoder
class InodeStoreBare : public InodeStore {
public:
- void encode(bufferlist &bl, uint64_t features) const {
+ void encode(ceph::buffer::list &bl, uint64_t features) const {
InodeStore::encode_bare(bl, features);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
InodeStore::decode_bare(bl);
}
static void generate_test_instances(std::list<InodeStoreBare*>& ls);
@@ -178,7 +178,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
validated_data() {}
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
bool all_damage_repaired() const;
@@ -197,7 +197,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
friend class MDCache;
friend class StrayManager;
friend class CDir;
- friend ostream& operator<<(ostream&, const CInode&);
+ friend std::ostream& operator<<(std::ostream&, const CInode&);
class scrub_stamp_info_t {
public:
@@ -354,7 +354,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
std::string_view pin_name(int p) const override;
- ostream& print_db_line_prefix(ostream& out) override;
+ std::ostream& print_db_line_prefix(std::ostream& out) override;
const scrub_info_t *scrub_info() const{
if (!scrub_infop)
@@ -565,11 +565,11 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
void verify_dirfrags();
void get_stickydirs();
- void put_stickydirs();
+ void put_stickydirs();
void add_need_snapflush(CInode *snapin, snapid_t snapid, client_t client);
void remove_need_snapflush(CInode *snapin, snapid_t snapid, client_t client);
- pair<bool,bool> split_need_snapflush(CInode *cowin, CInode *in);
+ std::pair<bool,bool> split_need_snapflush(CInode *cowin, CInode *in);
// -- accessors --
bool is_root() const { return inode.ino == MDS_INO_ROOT; }
@@ -648,23 +648,23 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
*/
void flush(MDSContext *fin);
void fetch(MDSContext *fin);
- void _fetched(bufferlist& bl, bufferlist& bl2, Context *fin);
+ void _fetched(ceph::buffer::list& bl, ceph::buffer::list& bl2, Context *fin);
void build_backtrace(int64_t pool, inode_backtrace_t& bt);
void store_backtrace(MDSContext *fin, int op_prio=-1);
void _stored_backtrace(int r, version_t v, Context *fin);
- void fetch_backtrace(Context *fin, bufferlist *backtrace);
+ void fetch_backtrace(Context *fin, ceph::buffer::list *backtrace);
void mark_dirty_parent(LogSegment *ls, bool dirty_pool=false);
void clear_dirty_parent();
- void verify_diri_backtrace(bufferlist &bl, int err);
+ void verify_diri_backtrace(ceph::buffer::list &bl, int err);
bool is_dirty_parent() { return state_test(STATE_DIRTYPARENT); }
bool is_dirty_pool() { return state_test(STATE_DIRTYPOOL); }
- void encode_snap_blob(bufferlist &bl);
- void decode_snap_blob(const bufferlist &bl);
- void encode_store(bufferlist& bl, uint64_t features);
- void decode_store(bufferlist::const_iterator& bl);
+ void encode_snap_blob(ceph::buffer::list &bl);
+ void decode_snap_blob(const ceph::buffer::list &bl);
+ void encode_store(ceph::buffer::list& bl, uint64_t features);
+ void decode_store(ceph::buffer::list::const_iterator& bl);
void add_dir_waiter(frag_t fg, MDSContext *c);
void take_dir_waiting(frag_t fg, MDSContext::vec& ls);
@@ -675,18 +675,18 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
void take_waiting(uint64_t tag, MDSContext::vec& ls) override;
// -- encode/decode helpers --
- void _encode_base(bufferlist& bl, uint64_t features);
- void _decode_base(bufferlist::const_iterator& p);
- void _encode_locks_full(bufferlist& bl);
- void _decode_locks_full(bufferlist::const_iterator& p);
- void _encode_locks_state_for_replica(bufferlist& bl, bool need_recover);
- void _encode_locks_state_for_rejoin(bufferlist& bl, int rep);
- void _decode_locks_state_for_replica(bufferlist::const_iterator& p, bool is_new);
- void _decode_locks_rejoin(bufferlist::const_iterator& p, MDSContext::vec& waiters,
+ void _encode_base(ceph::buffer::list& bl, uint64_t features);
+ void _decode_base(ceph::buffer::list::const_iterator& p);
+ void _encode_locks_full(ceph::buffer::list& bl);
+ void _decode_locks_full(ceph::buffer::list::const_iterator& p);
+ void _encode_locks_state_for_replica(ceph::buffer::list& bl, bool need_recover);
+ void _encode_locks_state_for_rejoin(ceph::buffer::list& bl, int rep);
+ void _decode_locks_state_for_replica(ceph::buffer::list::const_iterator& p, bool is_new);
+ void _decode_locks_rejoin(ceph::buffer::list::const_iterator& p, MDSContext::vec& waiters,
std::list<SimpleLock*>& eval_locks, bool survivor);
// -- import/export --
- void encode_export(bufferlist& bl);
+ void encode_export(ceph::buffer::list& bl);
void finish_export();
void abort_export() {
put(PIN_TEMPEXPORTING);
@@ -694,38 +694,38 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
state_clear(STATE_EXPORTINGCAPS);
put(PIN_EXPORTINGCAPS);
}
- void decode_import(bufferlist::const_iterator& p, LogSegment *ls);
+ void decode_import(ceph::buffer::list::const_iterator& p, LogSegment *ls);
// for giving to clients
- int encode_inodestat(bufferlist& bl, Session *session, SnapRealm *realm,
+ int encode_inodestat(ceph::buffer::list& bl, Session *session, SnapRealm *realm,
snapid_t snapid=CEPH_NOSNAP, unsigned max_bytes=0,
int getattr_wants=0);
- void encode_cap_message(const ref_t<MClientCaps> &m, Capability *cap);
+ void encode_cap_message(const ceph::ref_t<MClientCaps> &m, Capability *cap);
SimpleLock* get_lock(int type) override;
void set_object_info(MDSCacheObjectInfo &info) override;
- void encode_lock_state(int type, bufferlist& bl) override;
- void decode_lock_state(int type, const bufferlist& bl) override;
- void encode_lock_iauth(bufferlist& bl);
- void decode_lock_iauth(bufferlist::const_iterator& p);
- void encode_lock_ilink(bufferlist& bl);
- void decode_lock_ilink(bufferlist::const_iterator& p);
- void encode_lock_idft(bufferlist& bl);
- void decode_lock_idft(bufferlist::const_iterator& p);
- void encode_lock_ifile(bufferlist& bl);
- void decode_lock_ifile(bufferlist::const_iterator& p);
- void encode_lock_inest(bufferlist& bl);
- void decode_lock_inest(bufferlist::const_iterator& p);
- void encode_lock_ixattr(bufferlist& bl);
- void decode_lock_ixattr(bufferlist::const_iterator& p);
- void encode_lock_isnap(bufferlist& bl);
- void decode_lock_isnap(bufferlist::const_iterator& p);
- void encode_lock_iflock(bufferlist& bl);
- void decode_lock_iflock(bufferlist::const_iterator& p);
- void encode_lock_ipolicy(bufferlist& bl);
- void decode_lock_ipolicy(bufferlist::const_iterator& p);
+ void encode_lock_state(int type, ceph::buffer::list& bl) override;
+ void decode_lock_state(int type, const ceph::buffer::list& bl) override;
+ void encode_lock_iauth(ceph::buffer::list& bl);
+ void decode_lock_iauth(ceph::buffer::list::const_iterator& p);
+ void encode_lock_ilink(ceph::buffer::list& bl);
+ void decode_lock_ilink(ceph::buffer::list::const_iterator& p);
+ void encode_lock_idft(ceph::buffer::list& bl);
+ void decode_lock_idft(ceph::buffer::list::const_iterator& p);
+ void encode_lock_ifile(ceph::buffer::list& bl);
+ void decode_lock_ifile(ceph::buffer::list::const_iterator& p);
+ void encode_lock_inest(ceph::buffer::list& bl);
+ void decode_lock_inest(ceph::buffer::list::const_iterator& p);
+ void encode_lock_ixattr(ceph::buffer::list& bl);
+ void decode_lock_ixattr(ceph::buffer::list::const_iterator& p);
+ void encode_lock_isnap(ceph::buffer::list& bl);
+ void decode_lock_isnap(ceph::buffer::list::const_iterator& p);
+ void encode_lock_iflock(ceph::buffer::list& bl);
+ void decode_lock_iflock(ceph::buffer::list::const_iterator& p);
+ void encode_lock_ipolicy(ceph::buffer::list& bl);
+ void decode_lock_ipolicy(ceph::buffer::list::const_iterator& p);
void _finish_frag_update(CDir *dir, MutationRef& mut);
@@ -743,8 +743,8 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
void open_snaprealm(bool no_split=false);
void close_snaprealm(bool no_join=false);
SnapRealm *find_snaprealm() const;
- void encode_snap(bufferlist& bl);
- void decode_snap(bufferlist::const_iterator& p);
+ void encode_snap(ceph::buffer::list& bl);
+ void decode_snap(ceph::buffer::list::const_iterator& p);
client_t get_loner() const { return loner_cap; }
client_t get_wanted_loner() const { return want_loner_cap; }
@@ -904,8 +904,8 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
mds_rank_t get_export_pin(bool inherit=true) const;
bool is_exportable(mds_rank_t dest) const;
- void print(ostream& out) override;
- void dump(Formatter *f, int flags = DUMP_DEFAULT) const;
+ void print(std::ostream& out) override;
+ void dump(ceph::Formatter *f, int flags = DUMP_DEFAULT) const;
/**
* Validate that the on-disk state of an inode matches what
@@ -923,7 +923,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
void validate_disk_state(validated_data *results,
MDSContext *fin);
static void dump_validation_results(const validated_data& results,
- Formatter *f);
+ ceph::Formatter *f);
//bool hack_accessed = false;
//utime_t hack_load_stamp;
@@ -1013,7 +1013,7 @@ protected:
clear_fcntl_lock_state();
clear_flock_lock_state();
}
- void _encode_file_locks(bufferlist& bl) const {
+ void _encode_file_locks(ceph::buffer::list& bl) const {
using ceph::encode;
bool has_fcntl_locks = fcntl_locks && !fcntl_locks->empty();
encode(has_fcntl_locks, bl);
@@ -1024,7 +1024,7 @@ protected:
if (has_flock_locks)
encode(*flock_locks, bl);
}
- void _decode_file_locks(bufferlist::const_iterator& p) {
+ void _decode_file_locks(ceph::buffer::list::const_iterator& p) {
using ceph::decode;
bool has_fcntl_locks;
decode(has_fcntl_locks, p);
@@ -1108,8 +1108,8 @@ private:
/** @} Scrubbing and fsck */
};
-ostream& operator<<(ostream& out, const CInode& in);
-ostream& operator<<(ostream& out, const CInode::scrub_stamp_info_t& si);
+std::ostream& operator<<(std::ostream& out, const CInode& in);
+std::ostream& operator<<(std::ostream& out, const CInode::scrub_stamp_info_t& si);
extern cinode_lock_info_t cinode_lock_info[];
extern int num_cinode_locks;
diff --git a/src/mds/Capability.cc b/src/mds/Capability.cc
index 32f780ee202..76ae3291d7c 100644
--- a/src/mds/Capability.cc
+++ b/src/mds/Capability.cc
@@ -23,7 +23,7 @@
* Capability::Export
*/
-void Capability::Export::encode(bufferlist &bl) const
+void Capability::Export::encode(ceph::buffer::list &bl) const
{
ENCODE_START(3, 2, bl);
encode(cap_id, bl);
@@ -38,7 +38,7 @@ void Capability::Export::encode(bufferlist &bl) const
ENCODE_FINISH(bl);
}
-void Capability::Export::decode(bufferlist::const_iterator &p)
+void Capability::Export::decode(ceph::buffer::list::const_iterator &p)
{
DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, p);
decode(cap_id, p);
@@ -54,7 +54,7 @@ void Capability::Export::decode(bufferlist::const_iterator &p)
DECODE_FINISH(p);
}
-void Capability::Export::dump(Formatter *f) const
+void Capability::Export::dump(ceph::Formatter *f) const
{
f->dump_unsigned("cap_id", cap_id);
f->dump_unsigned("wanted", wanted);
@@ -78,7 +78,7 @@ void Capability::Export::generate_test_instances(std::list<Capability::Export*>&
ls.back()->last_issue_stamp = utime_t(6, 7);
}
-void Capability::Import::encode(bufferlist &bl) const
+void Capability::Import::encode(ceph::buffer::list &bl) const
{
ENCODE_START(1, 1, bl);
encode(cap_id, bl);
@@ -87,7 +87,7 @@ void Capability::Import::encode(bufferlist &bl) const
ENCODE_FINISH(bl);
}
-void Capability::Import::decode(bufferlist::const_iterator &bl)
+void Capability::Import::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START(1, bl);
decode(cap_id, bl);
@@ -96,7 +96,7 @@ void Capability::Import::decode(bufferlist::const_iterator &bl)
DECODE_FINISH(bl);
}
-void Capability::Import::dump(Formatter *f) const
+void Capability::Import::dump(ceph::Formatter *f) const
{
f->dump_unsigned("cap_id", cap_id);
f->dump_unsigned("issue_seq", issue_seq);
@@ -107,7 +107,7 @@ void Capability::Import::dump(Formatter *f) const
* Capability::revoke_info
*/
-void Capability::revoke_info::encode(bufferlist& bl) const
+void Capability::revoke_info::encode(ceph::buffer::list& bl) const
{
ENCODE_START(2, 2, bl)
encode(before, bl);
@@ -116,7 +116,7 @@ void Capability::revoke_info::encode(bufferlist& bl) const
ENCODE_FINISH(bl);
}
-void Capability::revoke_info::decode(bufferlist::const_iterator& bl)
+void Capability::revoke_info::decode(ceph::buffer::list::const_iterator& bl)
{
DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
decode(before, bl);
@@ -125,7 +125,7 @@ void Capability::revoke_info::decode(bufferlist::const_iterator& bl)
DECODE_FINISH(bl);
}
-void Capability::revoke_info::dump(Formatter *f) const
+void Capability::revoke_info::dump(ceph::Formatter *f) const
{
f->dump_unsigned("before", before);
f->dump_unsigned("seq", seq);
@@ -227,7 +227,7 @@ void Capability::set_wanted(int w) {
_wanted = w;
}
-void Capability::encode(bufferlist& bl) const
+void Capability::encode(ceph::buffer::list& bl) const
{
ENCODE_START(2, 2, bl)
encode(last_sent, bl);
@@ -239,7 +239,7 @@ void Capability::encode(bufferlist& bl) const
ENCODE_FINISH(bl);
}
-void Capability::decode(bufferlist::const_iterator &bl)
+void Capability::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl)
decode(last_sent, bl);
@@ -255,7 +255,7 @@ void Capability::decode(bufferlist::const_iterator &bl)
calc_issued();
}
-void Capability::dump(Formatter *f) const
+void Capability::dump(ceph::Formatter *f) const
{
f->dump_unsigned("last_sent", last_sent);
f->dump_unsigned("last_issue_stamp", last_issue_stamp);
diff --git a/src/mds/Capability.h b/src/mds/Capability.h
index 218eeb40fce..83a1ba5176a 100644
--- a/src/mds/Capability.h
+++ b/src/mds/Capability.h
@@ -79,9 +79,9 @@ public:
ceph_seq_t s, ceph_seq_t m, utime_t lis, unsigned st) :
cap_id(id), wanted(w), issued(i), pending(p), client_follows(cf),
seq(s), mseq(m), last_issue_stamp(lis), state(st) {}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &p);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &p);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<Export*>& ls);
int64_t cap_id = 0;
@@ -97,9 +97,9 @@ public:
struct Import {
Import() {}
Import(int64_t i, ceph_seq_t s, ceph_seq_t m) : cap_id(i), issue_seq(s), mseq(m) {}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &p);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &p);
+ void dump(ceph::Formatter *f) const;
int64_t cap_id = 0;
ceph_seq_t issue_seq = 0;
@@ -108,9 +108,9 @@ public:
struct revoke_info {
revoke_info() {}
revoke_info(__u32 b, ceph_seq_t s, ceph_seq_t li) : before(b), seq(s), last_issue(li) {}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<revoke_info*>& ls);
__u32 before = 0;
@@ -348,11 +348,11 @@ public:
}
// serializers
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<Capability*>& ls);
-
+
snapid_t client_follows = 0;
version_t client_xattr_version = 0;
version_t client_inline_version = 0;
diff --git a/src/mds/FSMap.cc b/src/mds/FSMap.cc
index b95e5c840c0..9fd18f4e187 100644
--- a/src/mds/FSMap.cc
+++ b/src/mds/FSMap.cc
@@ -26,8 +26,16 @@
#include "global/global_context.h"
#include "mon/health_check.h"
+using std::list;
+using std::pair;
+using std::ostream;
+using std::ostringstream;
+using std::string;
using std::stringstream;
+using ceph::bufferlist;
+using ceph::Formatter;
+
void Filesystem::dump(Formatter *f) const
{
f->open_object_section("mdsmap");
diff --git a/src/mds/FSMap.h b/src/mds/FSMap.h
index feed962c818..2a80a9891ac 100644
--- a/src/mds/FSMap.h
+++ b/src/mds/FSMap.h
@@ -52,10 +52,10 @@ public:
return std::make_shared<Filesystem>(std::forward<Args>(args)...);
}
- void encode(bufferlist& bl, uint64_t features) const;
- void decode(bufferlist::const_iterator& p);
+ void encode(ceph::buffer::list& bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator& p);
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
void print(std::ostream& out) const;
/**
@@ -365,8 +365,8 @@ public:
const mds_info_t* find_replacement_for(mds_role_t role) const;
- void get_health(list<pair<health_status_t,std::string> >& summary,
- list<pair<health_status_t,std::string> > *detail) const;
+ void get_health(std::list<std::pair<health_status_t,std::string> >& summary,
+ std::list<std::pair<health_status_t,std::string> > *detail) const;
void get_health_checks(health_check_map_t *checks) const;
@@ -378,18 +378,18 @@ public:
*/
void sanity() const;
- void encode(bufferlist& bl, uint64_t features) const;
- void decode(bufferlist::const_iterator& p);
- void decode(bufferlist& bl) {
+ void encode(ceph::buffer::list& bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator& p);
+ void decode(ceph::buffer::list& bl) {
auto p = bl.cbegin();
decode(p);
}
void sanitize(const std::function<bool(int64_t pool)>& pool_exists);
- void print(ostream& out) const;
- void print_summary(Formatter *f, ostream *out) const;
+ void print(std::ostream& out) const;
+ void print_summary(ceph::Formatter *f, std::ostream *out) const;
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<FSMap*>& ls);
protected:
@@ -412,7 +412,7 @@ protected:
};
WRITE_CLASS_ENCODER_FEATURES(FSMap)
-inline ostream& operator<<(ostream& out, const FSMap& m) {
+inline std::ostream& operator<<(std::ostream& out, const FSMap& m) {
m.print_summary(NULL, &out);
return out;
}
diff --git a/src/mds/FSMapUser.cc b/src/mds/FSMapUser.cc
index 2463019d8d2..63a58acc835 100644
--- a/src/mds/FSMapUser.cc
+++ b/src/mds/FSMapUser.cc
@@ -1,6 +1,6 @@
#include "FSMapUser.h"
-void FSMapUser::encode(bufferlist& bl, uint64_t features) const
+void FSMapUser::encode(ceph::buffer::list& bl, uint64_t features) const
{
ENCODE_START(1, 1, bl);
encode(epoch, bl);
@@ -12,7 +12,7 @@ void FSMapUser::encode(bufferlist& bl, uint64_t features) const
ENCODE_FINISH(bl);
}
-void FSMapUser::decode(bufferlist::const_iterator& p)
+void FSMapUser::decode(ceph::buffer::list::const_iterator& p)
{
DECODE_START(1, p);
decode(epoch, p);
@@ -25,7 +25,7 @@ void FSMapUser::decode(bufferlist::const_iterator& p)
DECODE_FINISH(p);
}
-void FSMapUser::fs_info_t::encode(bufferlist& bl, uint64_t features) const
+void FSMapUser::fs_info_t::encode(ceph::buffer::list& bl, uint64_t features) const
{
ENCODE_START(1, 1, bl);
encode(cid, bl);
@@ -33,7 +33,7 @@ void FSMapUser::fs_info_t::encode(bufferlist& bl, uint64_t features) const
ENCODE_FINISH(bl);
}
-void FSMapUser::fs_info_t::decode(bufferlist::const_iterator& p)
+void FSMapUser::fs_info_t::decode(ceph::buffer::list::const_iterator& p)
{
DECODE_START(1, p);
decode(cid, p);
@@ -54,7 +54,7 @@ void FSMapUser::generate_test_instances(std::list<FSMapUser*>& ls)
}
-void FSMapUser::print(ostream& out) const
+void FSMapUser::print(std::ostream& out) const
{
out << "e" << epoch << std::endl;
out << "legacy_client_fscid: " << legacy_client_fscid << std::endl;
@@ -62,10 +62,10 @@ void FSMapUser::print(ostream& out) const
out << " id " << p.second.cid << " name " << p.second.name << std::endl;
}
-void FSMapUser::print_summary(Formatter *f, ostream *out)
+void FSMapUser::print_summary(ceph::Formatter *f, std::ostream *out)
{
- map<mds_role_t,string> by_rank;
- map<string,int> by_state;
+ std::map<mds_role_t,std::string> by_rank;
+ std::map<std::string,int> by_state;
if (f) {
f->dump_unsigned("epoch", get_epoch());
diff --git a/src/mds/FSMapUser.h b/src/mds/FSMapUser.h
index 30e5461594d..a0be8e714af 100644
--- a/src/mds/FSMapUser.h
+++ b/src/mds/FSMapUser.h
@@ -24,8 +24,8 @@ class FSMapUser {
public:
struct fs_info_t {
fs_info_t() {}
- void encode(bufferlist& bl, uint64_t features) const;
- void decode(bufferlist::const_iterator &bl);
+ void encode(ceph::buffer::list& bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
std::string name;
fs_cluster_id_t cid = FS_CLUSTER_ID_NONE;
};
@@ -42,11 +42,11 @@ public:
return FS_CLUSTER_ID_NONE;
}
- void encode(bufferlist& bl, uint64_t features) const;
- void decode(bufferlist::const_iterator& bl);
+ void encode(ceph::buffer::list& bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
- void print(ostream& out) const;
- void print_summary(Formatter *f, ostream *out);
+ void print(std::ostream& out) const;
+ void print_summary(ceph::Formatter *f, std::ostream *out);
static void generate_test_instances(std::list<FSMapUser*>& ls);
@@ -57,7 +57,7 @@ public:
WRITE_CLASS_ENCODER_FEATURES(FSMapUser::fs_info_t)
WRITE_CLASS_ENCODER_FEATURES(FSMapUser)
-inline ostream& operator<<(ostream& out, FSMapUser& m) {
+inline std::ostream& operator<<(std::ostream& out, FSMapUser& m) {
m.print_summary(NULL, &out);
return out;
}
diff --git a/src/mds/LocalLock.h b/src/mds/LocalLock.h
index 2381715a755..ed401eaf601 100644
--- a/src/mds/LocalLock.h
+++ b/src/mds/LocalLock.h
@@ -49,8 +49,8 @@ public:
client_t get_last_wrlock_client() const {
return last_wrlock_client;
}
-
- void print(ostream& out) const override {
+
+ void print(std::ostream& out) const override {
out << "(";
_print(out);
if (last_wrlock_client >= 0)
diff --git a/src/mds/MDSAuthCaps.h b/src/mds/MDSAuthCaps.h
index 8c5f2bff77f..940d474a846 100644
--- a/src/mds/MDSAuthCaps.h
+++ b/src/mds/MDSAuthCaps.h
@@ -111,7 +111,7 @@ struct MDSCapMatch {
bool match(std::string_view target_path,
const int caller_uid,
const int caller_gid,
- const vector<uint64_t> *caller_gid_list) const;
+ const std::vector<uint64_t> *caller_gid_list) const;
/**
* Check whether this path *might* be accessible (actual permission
@@ -168,7 +168,7 @@ public:
bool allow_all() const;
bool is_capable(std::string_view inode_path,
uid_t inode_uid, gid_t inode_gid, unsigned inode_mode,
- uid_t uid, gid_t gid, const vector<uint64_t> *caller_gid_list,
+ uid_t uid, gid_t gid, const std::vector<uint64_t> *caller_gid_list,
unsigned mask, uid_t new_uid, gid_t new_gid,
const entity_addr_t& addr) const;
bool path_capable(std::string_view inode_path) const;
diff --git a/src/mds/MDSCacheObject.cc b/src/mds/MDSCacheObject.cc
index 74a196d7da3..8398e80c56c 100644
--- a/src/mds/MDSCacheObject.cc
+++ b/src/mds/MDSCacheObject.cc
@@ -28,7 +28,7 @@ void MDSCacheObject::finish_waiting(uint64_t mask, int result) {
finish_contexts(g_ceph_context, finished, result);
}
-void MDSCacheObject::dump(Formatter *f) const
+void MDSCacheObject::dump(ceph::Formatter *f) const
{
f->dump_bool("is_auth", is_auth());
@@ -74,7 +74,7 @@ void MDSCacheObject::dump(Formatter *f) const
* Use this in subclasses when printing their specialized
* states too.
*/
-void MDSCacheObject::dump_states(Formatter *f) const
+void MDSCacheObject::dump_states(ceph::Formatter *f) const
{
if (state_test(STATE_AUTH)) f->dump_string("state", "auth");
if (state_test(STATE_DIRTY)) f->dump_string("state", "dirty");
diff --git a/src/mds/MDSCacheObject.h b/src/mds/MDSCacheObject.h
index b71fb94c77a..47f1475de96 100644
--- a/src/mds/MDSCacheObject.h
+++ b/src/mds/MDSCacheObject.h
@@ -27,6 +27,10 @@ class SimpleLock;
class MDSCacheObject;
class MDSContext;
+namespace ceph {
+class Formatter;
+}
+
struct ClientLease {
ClientLease(client_t c, MDSCacheObject *p) :
client(c), parent(p),
@@ -191,8 +195,8 @@ class MDSCacheObject {
}
#endif
- void dump_states(Formatter *f) const;
- void dump(Formatter *f) const;
+ void dump_states(ceph::Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
// auth pins
enum {
@@ -263,9 +267,9 @@ class MDSCacheObject {
seq = ++last_wait_seq;
mask &= ~WAIT_ORDERED;
}
- waiting.insert(pair<uint64_t, pair<uint64_t, MDSContext*> >(
+ waiting.insert(std::pair<uint64_t, std::pair<uint64_t, MDSContext*> >(
mask,
- pair<uint64_t, MDSContext*>(seq, c)));
+ std::pair<uint64_t, MDSContext*>(seq, c)));
// pdout(10,g_conf()->debug_mds) << (mdsco_db_line_prefix(this))
// << "add_waiter " << hex << mask << dec << " " << c
// << " on " << *this
@@ -280,8 +284,8 @@ class MDSCacheObject {
// noop unless overloaded.
virtual SimpleLock* get_lock(int type) { ceph_abort(); return 0; }
virtual void set_object_info(MDSCacheObjectInfo &info) { ceph_abort(); }
- virtual void encode_lock_state(int type, bufferlist& bl) { ceph_abort(); }
- virtual void decode_lock_state(int type, const bufferlist& bl) { ceph_abort(); }
+ virtual void encode_lock_state(int type, ceph::buffer::list& bl) { ceph_abort(); }
+ virtual void decode_lock_state(int type, const ceph::buffer::list& bl) { ceph_abort(); }
virtual void finish_lock_waiters(int type, uint64_t mask, int r=0) { ceph_abort(); }
virtual void add_lock_waiter(int type, uint64_t mask, MDSContext *c) { ceph_abort(); }
virtual bool is_lock_waiting(int type, uint64_t mask) { ceph_abort(); return false; }
diff --git a/src/mds/MDSContext.h b/src/mds/MDSContext.h
index 78d251ee4b0..6fe507d03f3 100644
--- a/src/mds/MDSContext.h
+++ b/src/mds/MDSContext.h
@@ -103,7 +103,7 @@ public:
void complete(int r) override;
- virtual void print(ostream& out) const = 0;
+ virtual void print(std::ostream& out) const = 0;
static bool check_ios_in_flight(ceph::coarse_mono_time cutoff,
std::string& slow_count,
@@ -130,7 +130,7 @@ public:
void complete(int r) final;
void set_write_pos(uint64_t wp) { write_pos = wp; }
virtual void pre_finish(int r) {}
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
out << "log_event(" << write_pos << ")";
}
};
@@ -156,7 +156,7 @@ protected:
public:
MDSIOContextWrapper(MDSRank *m, Context *c) : MDSHolder(m), fin(c) {}
void finish(int r) override;
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
out << "io_context_wrapper(" << fin << ")";
}
};
@@ -200,7 +200,7 @@ public:
}
}
void complete(int r) final;
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
out << "io_wrapper(" << wrapped << ")";
}
};
diff --git a/src/mds/MDSMap.cc b/src/mds/MDSMap.cc
index 1115d2b64e5..6c1a0c2fdb0 100644
--- a/src/mds/MDSMap.cc
+++ b/src/mds/MDSMap.cc
@@ -12,14 +12,28 @@
*
*/
+#include <sstream>
+
#include "common/debug.h"
#include "mon/health_check.h"
#include "MDSMap.h"
-#include <sstream>
+using std::dec;
+using std::hex;
+using std::list;
+using std::make_pair;
+using std::map;
+using std::multimap;
+using std::ostream;
+using std::pair;
+using std::string;
+using std::set;
using std::stringstream;
+using ceph::bufferlist;
+using ceph::Formatter;
+
#define dout_context g_ceph_context
#define dout_subsys ceph_subsys_
@@ -440,7 +454,7 @@ void MDSMap::get_health_checks(health_check_map_t *checks) const
health_check_t& fscheck = checks->get_or_add(
"FS_DEGRADED", HEALTH_WARN,
"%num% filesystem%plurals% %isorare% degraded", 1);
- ostringstream ss;
+ std::ostringstream ss;
ss << "fs " << fs_name << " is degraded";
fscheck.detail.push_back(ss.str());
diff --git a/src/mds/MDSMap.h b/src/mds/MDSMap.h
index 033f25bf348..2c3b3221146 100644
--- a/src/mds/MDSMap.h
+++ b/src/mds/MDSMap.h
@@ -125,12 +125,12 @@ public:
return addrs;
}
- void encode(bufferlist& bl, uint64_t features) const {
+ void encode(ceph::buffer::list& bl, uint64_t features) const {
if ((features & CEPH_FEATURE_MDSENC) == 0 ) encode_unversioned(bl);
else encode_versioned(bl, features);
}
- void decode(bufferlist::const_iterator& p);
- void dump(Formatter *f) const;
+ void decode(ceph::buffer::list::const_iterator& p);
+ void dump(ceph::Formatter *f) const;
void dump(std::ostream&) const;
// The long form name for use in cluster log messages`
@@ -154,8 +154,8 @@ public:
FROZEN = 1 << 0,
};
private:
- void encode_versioned(bufferlist& bl, uint64_t features) const;
- void encode_unversioned(bufferlist& bl) const;
+ void encode_versioned(ceph::buffer::list& bl, uint64_t features) const;
+ void encode_unversioned(ceph::buffer::list& bl) const;
};
friend class MDSMonitor;
@@ -348,8 +348,8 @@ public:
void get_mds_set_lower_bound(std::set<mds_rank_t>& s, DaemonState first) const;
void get_mds_set(std::set<mds_rank_t>& s, DaemonState state) const;
- void get_health(list<pair<health_status_t,std::string> >& summary,
- list<pair<health_status_t,std::string> > *detail) const;
+ void get_health(std::list<std::pair<health_status_t,std::string> >& summary,
+ std::list<std::pair<health_status_t,std::string> > *detail) const;
void get_health_checks(health_check_map_t *checks) const;
@@ -525,18 +525,18 @@ public:
return mds_info_entry->second.inc;
return -1;
}
- void encode(bufferlist& bl, uint64_t features) const;
- void decode(bufferlist::const_iterator& p);
- void decode(const bufferlist& bl) {
+ void encode(ceph::buffer::list& bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator& p);
+ void decode(const ceph::buffer::list& bl) {
auto p = bl.cbegin();
decode(p);
}
void sanitize(const std::function<bool(int64_t pool)>& pool_exists);
- void print(ostream& out) const;
- void print_summary(Formatter *f, ostream *out) const;
+ void print(std::ostream& out) const;
+ void print_summary(ceph::Formatter *f, std::ostream *out) const;
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<MDSMap*>& ls);
static bool state_transition_valid(DaemonState prev, DaemonState next);
@@ -580,7 +580,7 @@ protected:
mds_rank_t max_mds = 1; /* The maximum number of active MDSes. Also, the maximum rank. */
mds_rank_t old_max_mds = 0; /* Value to restore when MDS cluster is marked up */
mds_rank_t standby_count_wanted = -1;
- string balancer; /* The name/version of the mantle balancer (i.e. the rados obj name) */
+ std::string balancer; /* The name/version of the mantle balancer (i.e. the rados obj name) */
std::set<mds_rank_t> in; // currently defined cluster
@@ -600,7 +600,7 @@ protected:
WRITE_CLASS_ENCODER_FEATURES(MDSMap::mds_info_t)
WRITE_CLASS_ENCODER_FEATURES(MDSMap)
-inline ostream& operator<<(ostream &out, const MDSMap &m) {
+inline std::ostream& operator<<(std::ostream &out, const MDSMap &m) {
m.print_summary(NULL, &out);
return out;
}
diff --git a/src/mds/Mutation.h b/src/mds/Mutation.h
index d79b430de66..389c7a09c99 100644
--- a/src/mds/Mutation.h
+++ b/src/mds/Mutation.h
@@ -80,7 +80,7 @@ public:
mutable mds_rank_t wrlock_target;
};
- struct LockOpVec : public vector<LockOp> {
+ struct LockOpVec : public std::vector<LockOp> {
LockOpVec() {
reserve(32);
}
@@ -111,7 +111,7 @@ public:
void sort_and_merge();
};
- using lock_set = set<LockOp>;
+ using lock_set = std::set<LockOp>;
using lock_iterator = lock_set::iterator;
// keep our default values synced with MDRequestParam's
@@ -210,12 +210,12 @@ public:
void apply();
void cleanup();
- virtual void print(ostream &out) const {
+ virtual void print(std::ostream &out) const {
out << "mutation(" << this << ")";
}
- virtual void dump(Formatter *f) const {}
- void _dump_op_descriptor_unlocked(ostream& stream) const override;
+ virtual void dump(ceph::Formatter *f) const {}
+ void _dump_op_descriptor_unlocked(std::ostream& stream) const override;
metareqid_t reqid;
__u32 attempt = 0; // which attempt for this request
@@ -255,12 +255,12 @@ public:
bool killed = false;
// for applying projected inode changes
- list<CInode*> projected_inodes;
+ std::list<CInode*> projected_inodes;
std::vector<CDir*> projected_fnodes;
- list<ScatterLock*> updated_locks;
+ std::list<ScatterLock*> updated_locks;
- list<CInode*> dirty_cow_inodes;
- list<pair<CDentry*,version_t> > dirty_cow_dentries;
+ std::list<CInode*> dirty_cow_inodes;
+ std::list<std::pair<CDentry*,version_t> > dirty_cow_dentries;
private:
utime_t mds_stamp; ///< mds-local timestamp (real time)
@@ -282,21 +282,21 @@ struct MDRequestImpl : public MutationImpl {
More() {}
int slave_error = 0;
- set<mds_rank_t> slaves; // mds nodes that have slave requests to me (implies client_request)
- set<mds_rank_t> waiting_on_slave; // peers i'm waiting for slavereq replies from.
+ std::set<mds_rank_t> slaves; // mds nodes that have slave requests to me (implies client_request)
+ std::set<mds_rank_t> waiting_on_slave; // peers i'm waiting for slavereq replies from.
// for rename/link/unlink
- set<mds_rank_t> witnessed; // nodes who have journaled a RenamePrepare
- map<MDSCacheObject*,version_t> pvmap;
+ std::set<mds_rank_t> witnessed; // nodes who have journaled a RenamePrepare
+ std::map<MDSCacheObject*,version_t> pvmap;
bool has_journaled_slaves = false;
bool slave_update_journaled = false;
bool slave_rolling_back = false;
// for rename
- set<mds_rank_t> extra_witnesses; // replica list from srcdn auth (rename)
+ std::set<mds_rank_t> extra_witnesses; // replica list from srcdn auth (rename)
mds_rank_t srcdn_auth_mds = MDS_RANK_NONE;
- bufferlist inode_import;
+ ceph::buffer::list inode_import;
version_t inode_import_v = 0;
CInode* rename_inode = nullptr;
bool is_freeze_authpin = false;
@@ -304,22 +304,22 @@ struct MDRequestImpl : public MutationImpl {
bool is_remote_frozen_authpin = false;
bool is_inode_exporter = false;
- map<client_t, pair<Session*, uint64_t> > imported_session_map;
- map<CInode*, map<client_t,Capability::Export> > cap_imports;
+ std::map<client_t, std::pair<Session*, uint64_t> > imported_session_map;
+ std::map<CInode*, std::map<client_t,Capability::Export> > cap_imports;
// for lock/flock
bool flock_was_waiting = false;
// for snaps
version_t stid = 0;
- bufferlist snapidbl;
+ ceph::buffer::list snapidbl;
sr_t *srci_srnode = nullptr;
sr_t *desti_srnode = nullptr;
// called when slave commits or aborts
Context *slave_commit = nullptr;
- bufferlist rollback_bl;
+ ceph::buffer::list rollback_bl;
MDSContext::vec waiting_for_finish;
@@ -350,8 +350,8 @@ struct MDRequestImpl : public MutationImpl {
}
metareqid_t reqid;
__u32 attempt = 0;
- cref_t<MClientRequest> client_req;
- cref_t<Message> triggering_slave_req;
+ ceph::cref_t<MClientRequest> client_req;
+ ceph::cref_t<Message> triggering_slave_req;
mds_rank_t slave_to = MDS_RANK_NONE;
utime_t initiated;
utime_t throttled, all_read, dispatched;
@@ -384,24 +384,24 @@ struct MDRequestImpl : public MutationImpl {
bool is_batch_op();
int compare_paths();
- void print(ostream &out) const override;
- void dump(Formatter *f) const override;
+ void print(std::ostream &out) const override;
+ void dump(ceph::Formatter *f) const override;
- cref_t<MClientRequest> release_client_request();
- void reset_slave_request(const cref_t<MMDSSlaveRequest>& req=nullptr);
+ ceph::cref_t<MClientRequest> release_client_request();
+ void reset_slave_request(const ceph::cref_t<MMDSSlaveRequest>& req=nullptr);
Session *session = nullptr;
elist<MDRequestImpl*>::item item_session_request; // if not on list, op is aborted.
// -- i am a client (master) request
- cref_t<MClientRequest> client_request; // client request (if any)
+ ceph::cref_t<MClientRequest> client_request; // client request (if any)
// tree and depth info of path1 and path2
inodeno_t dir_root[2] = {0, 0};
int dir_depth[2] = {-1, -1};
file_layout_t dir_layout;
// store up to two sets of dn vectors, inode pointers, for request path1 and path2.
- vector<CDentry*> dn[2];
+ std::vector<CDentry*> dn[2];
CInode *in[2] = {};
CDentry *straydn = nullptr;
snapid_t snapid = CEPH_NOSNAP;
@@ -419,13 +419,13 @@ struct MDRequestImpl : public MutationImpl {
bool o_trunc = false; ///< request is an O_TRUNC mutation
bool has_completed = false; ///< request has already completed
- bufferlist reply_extra_bl;
+ ceph::buffer::list reply_extra_bl;
// inos we did a embedded cap release on, and may need to eval if we haven't since reissued
- map<vinodeno_t, ceph_seq_t> cap_releases;
+ std::map<vinodeno_t, ceph_seq_t> cap_releases;
// -- i am a slave request
- cref_t<MMDSSlaveRequest> slave_request; // slave request (if one is pending; implies slave == true)
+ ceph::cref_t<MMDSSlaveRequest> slave_request; // slave request (if one is pending; implies slave == true)
// -- i am an internal op
int internal_op;
@@ -442,14 +442,14 @@ struct MDRequestImpl : public MutationImpl {
std::vector<Ref> batch_reqs;
protected:
- void _dump(Formatter *f) const override;
- void _dump_op_descriptor_unlocked(ostream& stream) const override;
+ void _dump(ceph::Formatter *f) const override;
+ void _dump_op_descriptor_unlocked(std::ostream& stream) const override;
private:
mutable ceph::spinlock msg_lock;
};
struct MDSlaveUpdate {
- MDSlaveUpdate(int oo, bufferlist &rbl, elist<MDSlaveUpdate*> &list) :
+ MDSlaveUpdate(int oo, ceph::buffer::list &rbl, elist<MDSlaveUpdate*> &list) :
origop(oo),
item(this) {
rollback.claim(rbl);
@@ -461,11 +461,11 @@ struct MDSlaveUpdate {
waiter->complete(0);
}
int origop;
- bufferlist rollback;
+ ceph::buffer::list rollback;
elist<MDSlaveUpdate*>::item item;
Context *waiter = nullptr;
- set<CInode*> olddirs;
- set<CInode*> unlinked;
+ std::set<CInode*> olddirs;
+ std::set<CInode*> unlinked;
};
struct MDLockCacheItem {
@@ -519,7 +519,7 @@ struct MDLockCache : public MutationImpl {
typedef boost::intrusive_ptr<MutationImpl> MutationRef;
typedef boost::intrusive_ptr<MDRequestImpl> MDRequestRef;
-inline ostream& operator<<(ostream &out, const MutationImpl &mut)
+inline std::ostream& operator<<(std::ostream &out, const MutationImpl &mut)
{
mut.print(out);
return out;
diff --git a/src/mds/ScatterLock.h b/src/mds/ScatterLock.h
index 27f9ba47bab..f654fd2ff31 100644
--- a/src/mds/ScatterLock.h
+++ b/src/mds/ScatterLock.h
@@ -142,7 +142,7 @@ public:
state = LOCK_LOCK;
}
- void encode_state_for_rejoin(bufferlist& bl, int rep) {
+ void encode_state_for_rejoin(ceph::buffer::list& bl, int rep) {
__s16 s = get_replica_state();
if (is_gathering(rep)) {
// the recovering mds may hold rejoined wrlocks
@@ -171,7 +171,7 @@ public:
encode(s, bl);
}
- void decode_state_rejoin(bufferlist::const_iterator& p, MDSContext::vec& waiters, bool survivor) {
+ void decode_state_rejoin(ceph::buffer::list::const_iterator& p, MDSContext::vec& waiters, bool survivor) {
SimpleLock::decode_state_rejoin(p, waiters, survivor);
if (is_flushing()) {
set_dirty();
@@ -190,7 +190,7 @@ public:
return SimpleLock::remove_replica(from);
}
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
out << "(";
_print(out);
if (is_dirty())
diff --git a/src/mds/ScrubHeader.h b/src/mds/ScrubHeader.h
index e69a3727c69..a41471fec21 100644
--- a/src/mds/ScrubHeader.h
+++ b/src/mds/ScrubHeader.h
@@ -16,8 +16,16 @@
#ifndef SCRUB_HEADER_H_
#define SCRUB_HEADER_H_
+#include <memory>
+#include <string>
#include <string_view>
+#include "include/ceph_assert.h"
+
+namespace ceph {
+class Formatter;
+};
+
class CInode;
/**
@@ -27,7 +35,7 @@ class CInode;
class ScrubHeader {
public:
ScrubHeader(std::string_view tag_, bool is_tag_internal_, bool force_,
- bool recursive_, bool repair_, Formatter *f_)
+ bool recursive_, bool repair_, ceph::Formatter *f_)
: tag(tag_), is_tag_internal(is_tag_internal_), force(force_),
recursive(recursive_), repair(repair_), formatter(f_)
{
@@ -44,7 +52,7 @@ public:
bool is_internal_tag() const { return is_tag_internal; }
CInode *get_origin() const { return origin; }
std::string_view get_tag() const { return tag; }
- Formatter &get_formatter() const { return *formatter; }
+ ceph::Formatter& get_formatter() const { return *formatter; }
bool get_repaired() const { return repaired; }
void set_repaired() { repaired = true; }
@@ -55,7 +63,7 @@ protected:
const bool force;
const bool recursive;
const bool repair;
- Formatter * const formatter;
+ ceph::Formatter* const formatter;
CInode *origin = nullptr;
bool repaired = false; // May be set during scrub if repairs happened
@@ -65,4 +73,3 @@ typedef std::shared_ptr<ScrubHeader> ScrubHeaderRef;
typedef std::shared_ptr<const ScrubHeader> ScrubHeaderRefConst;
#endif // SCRUB_HEADER_H_
-
diff --git a/src/mds/SessionMap.h b/src/mds/SessionMap.h
index 9fec9ded997..9187bdf5d64 100644
--- a/src/mds/SessionMap.h
+++ b/src/mds/SessionMap.h
@@ -117,7 +117,7 @@ public:
}
}
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
void push_pv(version_t pv)
{
ceph_assert(projected.empty() || projected.back() != pv);
@@ -142,7 +142,7 @@ public:
void set_reconnecting(bool s) { reconnecting = s; }
- void decode(bufferlist::const_iterator &p);
+ void decode(ceph::buffer::list::const_iterator &p);
template<typename T>
void set_client_metadata(T&& meta)
{
@@ -264,7 +264,7 @@ public:
}
double get_session_uptime() const {
- chrono::duration<double> uptime = clock::now() - birth_time;
+ std::chrono::duration<double> uptime = clock::now() - birth_time;
return uptime.count();
}
@@ -331,7 +331,7 @@ public:
return erased_any;
}
bool have_completed_request(ceph_tid_t tid, inodeno_t *pcreated) const {
- map<ceph_tid_t,inodeno_t>::const_iterator p = info.completed_requests.find(tid);
+ auto p = info.completed_requests.find(tid);
if (p == info.completed_requests.end())
return false;
if (pcreated)
@@ -383,7 +383,7 @@ public:
}
int check_access(CInode *in, unsigned mask, int caller_uid, int caller_gid,
- const vector<uint64_t> *gid_list, int new_uid, int new_gid);
+ const std::vector<uint64_t> *gid_list, int new_uid, int new_gid);
void set_connection(ConnectionRef con) {
connection = std::move(con);
@@ -413,7 +413,7 @@ public:
xlist<Session*>::item item_session_list;
- list<ref_t<Message>> preopen_out_queue; ///< messages for client, queued before they connect
+ std::list<ceph::ref_t<Message>> preopen_out_queue; ///< messages for client, queued before they connect
/* This is mutable to allow get_request_count to be const. elist does not
* support const iterators yet.
@@ -477,7 +477,7 @@ private:
// -- caps --
uint32_t cap_gen = 0;
version_t cap_push_seq = 0; // cap push seq #
- map<version_t, MDSContext::vec > waitfor_flush; // flush session messages
+ std::map<version_t, MDSContext::vec > waitfor_flush; // flush session messages
// Has completed_requests been modified since the last time we
// wrote this session out?
@@ -531,11 +531,11 @@ public:
version_t get_version() const {return version;}
- virtual void encode_header(bufferlist *header_bl);
- virtual void decode_header(bufferlist &header_bl);
- virtual void decode_values(std::map<std::string, bufferlist> &session_vals);
- virtual void decode_legacy(bufferlist::const_iterator& blp);
- void dump(Formatter *f) const;
+ virtual void encode_header(ceph::buffer::list *header_bl);
+ virtual void decode_header(ceph::buffer::list &header_bl);
+ virtual void decode_values(std::map<std::string, ceph::buffer::list> &session_vals);
+ virtual void decode_legacy(ceph::buffer::list::const_iterator& blp);
+ void dump(ceph::Formatter *f) const;
void set_rank(mds_rank_t r)
{
@@ -627,7 +627,7 @@ public:
}
// sessions
- void decode_legacy(bufferlist::const_iterator& blp) override;
+ void decode_legacy(ceph::buffer::list::const_iterator& blp) override;
bool empty() const { return session_map.empty(); }
const auto& get_sessions() const {
return session_map;
@@ -723,12 +723,12 @@ public:
int header_r,
int values_r,
bool first,
- bufferlist &header_bl,
- std::map<std::string, bufferlist> &session_vals,
+ ceph::buffer::list &header_bl,
+ std::map<std::string, ceph::buffer::list> &session_vals,
bool more_session_vals);
void load_legacy();
- void _load_legacy_finish(int r, bufferlist &bl);
+ void _load_legacy_finish(int r, ceph::buffer::list &bl);
void save(MDSContext *onsave, version_t needv=0);
void _save_finish(version_t v);
@@ -774,8 +774,8 @@ public:
* mark these sessions as dirty.
*/
void replay_open_sessions(version_t event_cmapv,
- map<client_t,entity_inst_t>& client_map,
- map<client_t,client_metadata_t>& client_metadata_map);
+ std::map<client_t,entity_inst_t>& client_map,
+ std::map<client_t,client_metadata_t>& client_metadata_map);
/**
* For these session IDs, if a session exists with this ID, and it has
@@ -790,8 +790,8 @@ public:
void handle_conf_change(const std::set <std::string> &changed);
MDSRank *mds;
- map<int,xlist<Session*>* > by_state;
- map<version_t, MDSContext::vec > commit_waiters;
+ std::map<int,xlist<Session*>*> by_state;
+ std::map<version_t, MDSContext::vec> commit_waiters;
// -- loading, saving --
inodeno_t ino;
diff --git a/src/mds/SimpleLock.cc b/src/mds/SimpleLock.cc
index 1f3b732169b..4e1ad647c06 100644
--- a/src/mds/SimpleLock.cc
+++ b/src/mds/SimpleLock.cc
@@ -16,7 +16,7 @@
#include "SimpleLock.h"
#include "Mutation.h"
-void SimpleLock::dump(Formatter *f) const {
+void SimpleLock::dump(ceph::Formatter *f) const {
ceph_assert(f != NULL);
if (is_sync_and_unlocked()) {
return;
diff --git a/src/mds/SimpleLock.h b/src/mds/SimpleLock.h
index 1ad4cd91300..74c8e84c267 100644
--- a/src/mds/SimpleLock.h
+++ b/src/mds/SimpleLock.h
@@ -204,10 +204,10 @@ public:
int get_cap_shift() const;
int get_cap_mask() const;
- void decode_locked_state(const bufferlist& bl) {
+ void decode_locked_state(const ceph::buffer::list& bl) {
parent->decode_lock_state(type->type, bl);
}
- void encode_locked_state(bufferlist& bl) {
+ void encode_locked_state(ceph::buffer::list& bl) {
parent->encode_lock_state(type->type, bl);
}
void finish_waiters(uint64_t mask, int r=0) {
@@ -283,10 +283,10 @@ public:
}
// gather set
- static set<int32_t> empty_gather_set;
+ static std::set<int32_t> empty_gather_set;
// int32_t: <0 is client, >=0 is MDS rank
- const set<int32_t>& get_gather_set() const {
+ const std::set<int32_t>& get_gather_set() const {
return have_more() ? more()->gather_set : empty_gather_set;
}
@@ -465,7 +465,7 @@ public:
}
// encode/decode
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(2, 2, bl);
encode(state, bl);
if (have_more())
@@ -474,28 +474,28 @@ public:
encode(empty_gather_set, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& p) {
+ void decode(ceph::buffer::list::const_iterator& p) {
DECODE_START(2, p);
decode(state, p);
- set<__s32> g;
+ std::set<__s32> g;
decode(g, p);
if (!g.empty())
more()->gather_set.swap(g);
DECODE_FINISH(p);
}
- void encode_state_for_replica(bufferlist& bl) const {
+ void encode_state_for_replica(ceph::buffer::list& bl) const {
__s16 s = get_replica_state();
using ceph::encode;
encode(s, bl);
}
- void decode_state(bufferlist::const_iterator& p, bool is_new=true) {
+ void decode_state(ceph::buffer::list::const_iterator& p, bool is_new=true) {
using ceph::decode;
__s16 s;
decode(s, p);
if (is_new)
state = s;
}
- void decode_state_rejoin(bufferlist::const_iterator& p, MDSContext::vec& waiters, bool survivor) {
+ void decode_state_rejoin(ceph::buffer::list::const_iterator& p, MDSContext::vec& waiters, bool survivor) {
__s16 s;
using ceph::decode;
decode(s, p);
@@ -562,7 +562,7 @@ public:
return false;
}
- void _print(ostream& out) const {
+ void _print(std::ostream& out) const {
out << get_lock_type_name(get_type()) << " ";
out << get_state_name(get_state());
if (!get_gather_set().empty())
@@ -589,9 +589,9 @@ public:
* Write bare values (caller must be in an object section)
* to formatter, or nothing if is_sync_and_unlocked.
*/
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
- virtual void print(ostream& out) const {
+ virtual void print(std::ostream& out) const {
out << "(";
_print(out);
out << ")";
@@ -629,7 +629,7 @@ private:
lock_caches.empty();
}
- set<__s32> gather_set; // auth+rep. >= 0 is mds, < 0 is client
+ std::set<__s32> gather_set; // auth+rep. >= 0 is mds, < 0 is client
// local state
int num_wrlock = 0, num_xlock = 0;
@@ -658,7 +658,7 @@ private:
};
WRITE_CLASS_ENCODER(SimpleLock)
-inline ostream& operator<<(ostream& out, const SimpleLock& l)
+inline std::ostream& operator<<(std::ostream& out, const SimpleLock& l)
{
l.print(out);
return out;
diff --git a/src/mds/SnapRealm.h b/src/mds/SnapRealm.h
index 6e62e3898bc..805b16bf3f7 100644
--- a/src/mds/SnapRealm.h
+++ b/src/mds/SnapRealm.h
@@ -29,9 +29,7 @@ public:
SnapRealm(MDCache *c, CInode *in);
bool exists(std::string_view name) const {
- for (map<snapid_t,SnapInfo>::const_iterator p = srnode.snaps.begin();
- p != srnode.snaps.end();
- ++p) {
+ for (auto p = srnode.snaps.begin(); p != srnode.snaps.end(); ++p) {
if (p->second.name == name)
return true;
}
@@ -53,15 +51,15 @@ public:
}
void build_snap_set() const;
- void get_snap_info(map<snapid_t, const SnapInfo*>& infomap, snapid_t first=0, snapid_t last=CEPH_NOSNAP);
+ void get_snap_info(std::map<snapid_t, const SnapInfo*>& infomap, snapid_t first=0, snapid_t last=CEPH_NOSNAP);
- const bufferlist& get_snap_trace() const;
+ const ceph::buffer::list& get_snap_trace() const;
void build_snap_trace() const;
std::string_view get_snapname(snapid_t snapid, inodeno_t atino);
snapid_t resolve_snapname(std::string_view name, inodeno_t atino, snapid_t first=0, snapid_t last=CEPH_NOSNAP);
- const set<snapid_t>& get_snaps() const;
+ const std::set<snapid_t>& get_snaps() const;
const SnapContext& get_snap_context() const;
void invalidate_cached_snaps() {
cached_seq = 0;
@@ -88,8 +86,8 @@ public:
snapid_t get_snap_following(snapid_t follows) {
check_cache();
- const set<snapid_t>& s = get_snaps();
- set<snapid_t>::const_iterator p = s.upper_bound(follows);
+ const std::set<snapid_t>& s = get_snaps();
+ auto p = s.upper_bound(follows);
if (p != s.end())
return *p;
return CEPH_NOSNAP;
@@ -97,8 +95,8 @@ public:
bool has_snaps_in_range(snapid_t first, snapid_t last) {
check_cache();
- const set<snapid_t>& s = get_snaps();
- set<snapid_t>::const_iterator p = s.lower_bound(first);
+ const auto& s = get_snaps();
+ auto p = s.lower_bound(first);
return (p != s.end() && *p <= last);
}
@@ -133,11 +131,11 @@ public:
bool past_parents_dirty = false;
SnapRealm *parent = nullptr;
- set<SnapRealm*> open_children; // active children that are currently open
- set<SnapRealm*> open_past_children; // past children who has pinned me
+ std::set<SnapRealm*> open_children; // active children that are currently open
+ std::set<SnapRealm*> open_past_children; // past children who has pinned me
elist<CInode*> inodes_with_caps = 0; // for efficient realm splits
- map<client_t, xlist<Capability*>* > client_caps; // to identify clients who need snap notifications
+ std::map<client_t, xlist<Capability*>* > client_caps; // to identify clients who need snap notifications
protected:
void check_cache() const;
@@ -146,17 +144,17 @@ private:
mutable bool open = false; // set to true once all past_parents are opened
bool global;
- map<inodeno_t, pair<SnapRealm*, set<snapid_t> > > open_past_parents; // these are explicitly pinned.
+ std::map<inodeno_t, std::pair<SnapRealm*, std::set<snapid_t>>> open_past_parents; // these are explicitly pinned.
unsigned num_open_past_parents = 0;
// cache
mutable snapid_t cached_seq; // max seq over self and all past+present parents.
mutable snapid_t cached_last_created; // max last_created over all past+present parents
mutable snapid_t cached_last_destroyed;
- mutable set<snapid_t> cached_snaps;
+ mutable std::set<snapid_t> cached_snaps;
mutable SnapContext cached_snap_context;
- mutable bufferlist cached_snap_trace;
+ mutable ceph::buffer::list cached_snap_trace;
};
-ostream& operator<<(ostream& out, const SnapRealm &realm);
+std::ostream& operator<<(std::ostream& out, const SnapRealm &realm);
#endif
diff --git a/src/mds/flock.cc b/src/mds/flock.cc
index 2382322bce4..69d579d3034 100644
--- a/src/mds/flock.cc
+++ b/src/mds/flock.cc
@@ -8,6 +8,10 @@
#define dout_subsys ceph_subsys_mds
+using std::list;
+using std::pair;
+using std::multimap;
+
static multimap<ceph_filelock, ceph_lock_state_t*> global_waiting_locks;
static void remove_global_waiting(ceph_filelock &fl, ceph_lock_state_t *lock_state)
@@ -35,7 +39,7 @@ ceph_lock_state_t::~ceph_lock_state_t()
bool ceph_lock_state_t::is_waiting(const ceph_filelock &fl) const
{
- multimap<uint64_t, ceph_filelock>::const_iterator p = waiting_locks.find(fl.start);
+ auto p = waiting_locks.find(fl.start);
while (p != waiting_locks.end()) {
if (p->second.start > fl.start)
return false;
@@ -81,7 +85,7 @@ bool ceph_lock_state_t::is_deadlock(const ceph_filelock& fl,
return false;
// find conflict locks' owners
- set<ceph_filelock> lock_owners;
+ std::set<ceph_filelock> lock_owners;
for (auto p = overlapping_locks.begin();
p != overlapping_locks.end();
++p) {
diff --git a/src/mds/flock.h b/src/mds/flock.h
index 7166f8783da..915d912e1ee 100644
--- a/src/mds/flock.h
+++ b/src/mds/flock.h
@@ -8,7 +8,7 @@
#include "common/debug.h"
#include "mdstypes.h"
-inline ostream& operator<<(ostream& out, const ceph_filelock& l) {
+inline std::ostream& operator<<(std::ostream& out, const ceph_filelock& l) {
out << "start: " << l.start << ", length: " << l.length
<< ", client: " << l.client << ", owner: " << l.owner
<< ", pid: " << l.pid << ", type: " << (int)l.type
@@ -118,16 +118,16 @@ public:
* @param activated_locks A return parameter, holding activated wait locks.
*/
void remove_lock(const ceph_filelock removal_lock,
- list<ceph_filelock>& activated_locks);
+ std::list<ceph_filelock>& activated_locks);
bool remove_all_from(client_t client);
- void encode(bufferlist& bl) const {
+ void encode(ceph::bufferlist& bl) const {
using ceph::encode;
encode(held_locks, bl);
encode(client_held_lock_counts, bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::bufferlist::const_iterator& bl) {
using ceph::decode;
decode(held_locks, bl);
decode(client_held_lock_counts, bl);
@@ -138,11 +138,11 @@ public:
client_waiting_lock_counts.empty();
}
- multimap<uint64_t, ceph_filelock> held_locks; // current locks
- multimap<uint64_t, ceph_filelock> waiting_locks; // locks waiting for other locks
+ std::multimap<uint64_t, ceph_filelock> held_locks; // current locks
+ std::multimap<uint64_t, ceph_filelock> waiting_locks; // locks waiting for other locks
// both of the above are keyed by starting offset
- map<client_t, int> client_held_lock_counts;
- map<client_t, int> client_waiting_lock_counts;
+ std::map<client_t, int> client_held_lock_counts;
+ std::map<client_t, int> client_waiting_lock_counts;
private:
static const unsigned MAX_DEADLK_DEPTH = 5;
@@ -156,8 +156,8 @@ private:
* @depth recursion call depth
*/
bool is_deadlock(const ceph_filelock& fl,
- list<multimap<uint64_t, ceph_filelock>::iterator>&
- overlapping_locks,
+ std::list<std::multimap<uint64_t, ceph_filelock>::iterator>&
+ overlapping_locks,
const ceph_filelock *first_fl=NULL, unsigned depth=0) const;
/**
@@ -186,19 +186,19 @@ private:
* @param neighbor_locks locks owned by same process that neighbor new_lock on
* left or right side.
*/
- void adjust_locks(list<multimap<uint64_t, ceph_filelock>::iterator> old_locks,
+ void adjust_locks(std::list<std::multimap<uint64_t, ceph_filelock>::iterator> old_locks,
ceph_filelock& new_lock,
- list<multimap<uint64_t, ceph_filelock>::iterator>
+ std::list<std::multimap<uint64_t, ceph_filelock>::iterator>
neighbor_locks);
//get last lock prior to start position
- multimap<uint64_t, ceph_filelock>::iterator
+ std::multimap<uint64_t, ceph_filelock>::iterator
get_lower_bound(uint64_t start,
- multimap<uint64_t, ceph_filelock>& lock_map);
+ std::multimap<uint64_t, ceph_filelock>& lock_map);
//get latest-starting lock that goes over the byte "end"
- multimap<uint64_t, ceph_filelock>::iterator
+ std::multimap<uint64_t, ceph_filelock>::iterator
get_last_before(uint64_t end,
- multimap<uint64_t, ceph_filelock>& lock_map);
+ std::multimap<uint64_t, ceph_filelock>& lock_map);
/*
* See if an iterator's lock covers any of the same bounds as a given range
@@ -206,10 +206,10 @@ private:
* byte is at start + length - 1.
* If the length is 0, the lock covers from "start" to the end of the file.
*/
- bool share_space(multimap<uint64_t, ceph_filelock>::iterator& iter,
+ bool share_space(std::multimap<uint64_t, ceph_filelock>::iterator& iter,
uint64_t start, uint64_t end);
- bool share_space(multimap<uint64_t, ceph_filelock>::iterator& iter,
+ bool share_space(std::multimap<uint64_t, ceph_filelock>::iterator& iter,
const ceph_filelock &lock) {
uint64_t end = lock.start;
if (lock.length) {
@@ -226,14 +226,14 @@ private:
* Returns: true if at least one lock overlaps.
*/
bool get_overlapping_locks(const ceph_filelock& lock,
- list<multimap<uint64_t,
+ std::list<std::multimap<uint64_t,
ceph_filelock>::iterator> & overlaps,
- list<multimap<uint64_t,
+ std::list<std::multimap<uint64_t,
ceph_filelock>::iterator> *self_neighbors);
bool get_overlapping_locks(const ceph_filelock& lock,
- list<multimap<uint64_t, ceph_filelock>::iterator>& overlaps) {
+ std::list<std::multimap<uint64_t, ceph_filelock>::iterator>& overlaps) {
return get_overlapping_locks(lock, overlaps, NULL);
}
@@ -244,7 +244,7 @@ private:
* Returns: true if at least one waiting_lock overlaps
*/
bool get_waiting_overlaps(const ceph_filelock& lock,
- list<multimap<uint64_t,
+ std::list<std::multimap<uint64_t,
ceph_filelock>::iterator>& overlaps);
/*
* split a list of locks up by whether they're owned by same
@@ -255,12 +255,12 @@ private:
* owned_locks: an empty list, to be filled with the locks owned by owner
*/
void split_by_owner(const ceph_filelock& owner,
- list<multimap<uint64_t,
+ std::list<std::multimap<uint64_t,
ceph_filelock>::iterator> & locks,
- list<multimap<uint64_t,
+ std::list<std::multimap<uint64_t,
ceph_filelock>::iterator> & owned_locks);
- ceph_filelock *contains_exclusive_lock(list<multimap<uint64_t,
+ ceph_filelock *contains_exclusive_lock(std::list<std::multimap<uint64_t,
ceph_filelock>::iterator>& locks);
CephContext *cct;
@@ -268,7 +268,7 @@ private:
};
WRITE_CLASS_ENCODER(ceph_lock_state_t)
-inline ostream& operator<<(ostream &out, const ceph_lock_state_t &l) {
+inline std::ostream& operator<<(std::ostream &out, const ceph_lock_state_t &l) {
out << "ceph_lock_state_t. held_locks.size()=" << l.held_locks.size()
<< ", waiting_locks.size()=" << l.waiting_locks.size()
<< ", client_held_lock_counts -- " << l.client_held_lock_counts
diff --git a/src/mds/inode_backtrace.cc b/src/mds/inode_backtrace.cc
index 8932f62a72b..061aaab8382 100644
--- a/src/mds/inode_backtrace.cc
+++ b/src/mds/inode_backtrace.cc
@@ -7,7 +7,7 @@
/* inode_backpointer_t */
-void inode_backpointer_t::encode(bufferlist& bl) const
+void inode_backpointer_t::encode(ceph::buffer::list& bl) const
{
ENCODE_START(2, 2, bl);
encode(dirino, bl);
@@ -16,7 +16,7 @@ void inode_backpointer_t::encode(bufferlist& bl) const
ENCODE_FINISH(bl);
}
-void inode_backpointer_t::decode(bufferlist::const_iterator& bl)
+void inode_backpointer_t::decode(ceph::buffer::list::const_iterator& bl)
{
DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
decode(dirino, bl);
@@ -25,7 +25,7 @@ void inode_backpointer_t::decode(bufferlist::const_iterator& bl)
DECODE_FINISH(bl);
}
-void inode_backpointer_t::decode_old(bufferlist::const_iterator& bl)
+void inode_backpointer_t::decode_old(ceph::buffer::list::const_iterator& bl)
{
using ceph::decode;
decode(dirino, bl);
@@ -33,7 +33,7 @@ void inode_backpointer_t::decode_old(bufferlist::const_iterator& bl)
decode(version, bl);
}
-void inode_backpointer_t::dump(Formatter *f) const
+void inode_backpointer_t::dump(ceph::Formatter *f) const
{
f->dump_unsigned("dirino", dirino);
f->dump_string("dname", dname);
@@ -54,7 +54,7 @@ void inode_backpointer_t::generate_test_instances(std::list<inode_backpointer_t*
* inode_backtrace_t
*/
-void inode_backtrace_t::encode(bufferlist& bl) const
+void inode_backtrace_t::encode(ceph::buffer::list& bl) const
{
ENCODE_START(5, 4, bl);
encode(ino, bl);
@@ -64,7 +64,7 @@ void inode_backtrace_t::encode(bufferlist& bl) const
ENCODE_FINISH(bl);
}
-void inode_backtrace_t::decode(bufferlist::const_iterator& bl)
+void inode_backtrace_t::decode(ceph::buffer::list::const_iterator& bl)
{
DECODE_START_LEGACY_COMPAT_LEN(5, 4, 4, bl);
if (struct_v < 3)
@@ -87,11 +87,11 @@ void inode_backtrace_t::decode(bufferlist::const_iterator& bl)
DECODE_FINISH(bl);
}
-void inode_backtrace_t::dump(Formatter *f) const
+void inode_backtrace_t::dump(ceph::Formatter *f) const
{
f->dump_unsigned("ino", ino);
f->open_array_section("ancestors");
- for (vector<inode_backpointer_t>::const_iterator p = ancestors.begin(); p != ancestors.end(); ++p) {
+ for (auto p = ancestors.begin(); p != ancestors.end(); ++p) {
f->open_object_section("backpointer");
p->dump(f);
f->close_section();
@@ -99,7 +99,7 @@ void inode_backtrace_t::dump(Formatter *f) const
f->close_section();
f->dump_int("pool", pool);
f->open_array_section("old_pools");
- for (set<int64_t>::iterator p = old_pools.begin(); p != old_pools.end(); ++p) {
+ for (auto p = old_pools.begin(); p != old_pools.end(); ++p) {
f->dump_int("old_pool", *p);
}
f->close_section();
diff --git a/src/mds/inode_backtrace.h b/src/mds/inode_backtrace.h
index 919f10b76c0..3674a716bcf 100644
--- a/src/mds/inode_backtrace.h
+++ b/src/mds/inode_backtrace.h
@@ -25,14 +25,14 @@ struct inode_backpointer_t {
inode_backpointer_t() {}
inode_backpointer_t(inodeno_t i, std::string_view d, version_t v) : dirino(i), dname(d), version(v) {}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator &bl);
- void decode_old(bufferlist::const_iterator &bl);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void decode_old(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<inode_backpointer_t*>& ls);
inodeno_t dirino; // containing directory ino
- string dname; // linking dentry name
+ std::string dname; // linking dentry name
version_t version = 0; // child's version at time of backpointer creation
};
WRITE_CLASS_ENCODER(inode_backpointer_t)
@@ -41,7 +41,7 @@ inline bool operator==(const inode_backpointer_t& l, const inode_backpointer_t&
return l.dirino == r.dirino && l.version == r.version && l.dname == r.dname;
}
-inline ostream& operator<<(ostream& out, const inode_backpointer_t& ib) {
+inline std::ostream& operator<<(std::ostream& out, const inode_backpointer_t& ib) {
return out << "<" << ib.dirino << "/" << ib.dname << " v" << ib.version << ">";
}
@@ -53,9 +53,9 @@ inline ostream& operator<<(ostream& out, const inode_backpointer_t& ib) {
struct inode_backtrace_t {
inode_backtrace_t() {}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator &bl);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<inode_backtrace_t*>& ls);
/**
@@ -74,14 +74,14 @@ struct inode_backtrace_t {
bool *equivalent, bool *divergent) const;
inodeno_t ino; // my ino
- vector<inode_backpointer_t> ancestors;
+ std::vector<inode_backpointer_t> ancestors;
int64_t pool = -1;
// we use a set for old_pools to avoid duplicate entries, e.g. setlayout 0, 1, 0
- set<int64_t> old_pools;
+ std::set<int64_t> old_pools;
};
WRITE_CLASS_ENCODER(inode_backtrace_t)
-inline ostream& operator<<(ostream& out, const inode_backtrace_t& it) {
+inline std::ostream& operator<<(std::ostream& out, const inode_backtrace_t& it) {
return out << "(" << it.pool << ")" << it.ino << ":" << it.ancestors << "//" << it.old_pools;
}
diff --git a/src/mds/mdstypes.cc b/src/mds/mdstypes.cc
index b7f5d87cfa5..abe459dfb14 100644
--- a/src/mds/mdstypes.cc
+++ b/src/mds/mdstypes.cc
@@ -8,6 +8,14 @@
const mds_gid_t MDS_GID_NONE = mds_gid_t(0);
+using std::list;
+using std::make_pair;
+using std::ostream;
+using std::set;
+using std::vector;
+
+using ceph::bufferlist;
+using ceph::Formatter;
/*
* frag_info_t
@@ -237,7 +245,7 @@ void inline_data_t::decode(bufferlist::const_iterator &p)
uint32_t inline_len;
decode(inline_len, p);
if (inline_len > 0)
- decode_nohead(inline_len, get_data(), p);
+ ceph::decode_nohead(inline_len, get_data(), p);
else
free_data();
}
@@ -849,7 +857,7 @@ void cap_reconnect_t::encode_old(bufferlist& bl) const {
encode(path, bl);
capinfo.flock_len = flockbl.length();
encode(capinfo, bl);
- encode_nohead(flockbl, bl);
+ ceph::encode_nohead(flockbl, bl);
}
void cap_reconnect_t::decode(bufferlist::const_iterator& bl) {
@@ -864,7 +872,7 @@ void cap_reconnect_t::decode_old(bufferlist::const_iterator& bl) {
using ceph::decode;
decode(path, bl);
decode(capinfo, bl);
- decode_nohead(capinfo.flock_len, flockbl, bl);
+ ceph::decode_nohead(capinfo.flock_len, flockbl, bl);
}
void cap_reconnect_t::dump(Formatter *f) const
diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h
index ddaed5666d6..e2c61bfb233 100644
--- a/src/mds/mdstypes.h
+++ b/src/mds/mdstypes.h
@@ -109,9 +109,9 @@ inline std::ostream& operator<<(std::ostream& out, const mds_role_t& role) {
}
// CAPS
-inline string gcap_string(int cap)
+inline std::string gcap_string(int cap)
{
- string s;
+ std::string s;
if (cap & CEPH_CAP_GSHARED) s += "s";
if (cap & CEPH_CAP_GEXCL) s += "x";
if (cap & CEPH_CAP_GCACHE) s += "c";
@@ -122,9 +122,9 @@ inline string gcap_string(int cap)
if (cap & CEPH_CAP_GLAZYIO) s += "l";
return s;
}
-inline string ccap_string(int cap)
+inline std::string ccap_string(int cap)
{
- string s;
+ std::string s;
if (cap & CEPH_CAP_PIN) s += "p";
int a = (cap >> CEPH_CAP_SAUTH) & 3;
@@ -186,9 +186,9 @@ struct frag_info_t : public scatter_info_t {
nsubdirs == o.nsubdirs;
}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<frag_info_t*>& ls);
// this frag
@@ -246,9 +246,9 @@ struct nest_info_t : public scatter_info_t {
rsnaps == o.rsnaps;
}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<nest_info_t*>& ls);
// this frag + children
@@ -273,12 +273,12 @@ struct vinodeno_t {
vinodeno_t() {}
vinodeno_t(inodeno_t i, snapid_t s) : ino(i), snapid(s) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
using ceph::encode;
encode(ino, bl);
encode(snapid, bl);
}
- void decode(bufferlist::const_iterator& p) {
+ void decode(ceph::buffer::list::const_iterator& p) {
using ceph::decode;
decode(ino, p);
decode(snapid, p);
@@ -303,20 +303,20 @@ inline bool operator<(const vinodeno_t &l, const vinodeno_t &r) {
struct quota_info_t
{
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(max_bytes, bl);
encode(max_files, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& p) {
+ void decode(ceph::buffer::list::const_iterator& p) {
DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, p);
decode(max_bytes, p);
decode(max_files, p);
DECODE_FINISH(p);
}
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<quota_info_t *>& ls);
bool is_valid() const {
@@ -335,7 +335,7 @@ inline bool operator==(const quota_info_t &l, const quota_info_t &r) {
return memcmp(&l, &r, sizeof(l)) == 0;
}
-ostream& operator<<(ostream &out, const quota_info_t &n);
+std::ostream& operator<<(std::ostream &out, const quota_info_t &n);
namespace std {
template<> struct hash<vinodeno_t> {
@@ -361,16 +361,17 @@ struct client_writeable_range_t {
uint64_t first = 0, last = 0; // interval client can write to
};
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<client_writeable_range_t*>& ls);
byte_range_t range;
snapid_t follows = 0; // aka "data+metadata flushed thru"
};
-inline void decode(client_writeable_range_t::byte_range_t& range, bufferlist::const_iterator& bl) {
+inline void decode(client_writeable_range_t::byte_range_t& range, ceph::buffer::list::const_iterator& bl) {
+ using ceph::decode;
decode(range.first, bl);
decode(range.last, bl);
}
@@ -404,9 +405,9 @@ public:
void free_data() {
blp.reset();
}
- bufferlist& get_data() {
+ ceph::buffer::list& get_data() {
if (!blp)
- blp.reset(new bufferlist);
+ blp.reset(new ceph::buffer::list);
return *blp;
}
size_t length() const { return blp ? blp->length() : 0; }
@@ -414,18 +415,18 @@ public:
bool operator==(const inline_data_t& o) const {
return length() == o.length() &&
(length() == 0 ||
- (*const_cast<bufferlist*>(blp.get()) == *const_cast<bufferlist*>(o.blp.get())));
+ (*const_cast<ceph::buffer::list*>(blp.get()) == *const_cast<ceph::buffer::list*>(o.blp.get())));
}
bool operator!=(const inline_data_t& o) const {
return !(*this == o);
}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator& bl);
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
version_t version = 1;
private:
- std::unique_ptr<bufferlist> blp;
+ std::unique_ptr<ceph::buffer::list> blp;
};
WRITE_CLASS_ENCODER(inline_data_t)
@@ -524,9 +525,9 @@ struct inode_t {
old_pools.insert(l);
}
- void encode(bufferlist &bl, uint64_t features) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<inode_t*>& ls);
/**
* Compare this inode_t with another that represent *the same inode*
@@ -606,7 +607,7 @@ private:
// These methods may be moved back to mdstypes.cc when we have pmr
template<template<typename> class Allocator>
-void inode_t<Allocator>::encode(bufferlist &bl, uint64_t features) const
+void inode_t<Allocator>::encode(ceph::buffer::list &bl, uint64_t features) const
{
ENCODE_START(15, 6, bl);
@@ -664,7 +665,7 @@ void inode_t<Allocator>::encode(bufferlist &bl, uint64_t features) const
}
template<template<typename> class Allocator>
-void inode_t<Allocator>::decode(bufferlist::const_iterator &p)
+void inode_t<Allocator>::decode(ceph::buffer::list::const_iterator &p)
{
DECODE_START_LEGACY_COMPAT_LEN(15, 6, 6, p);
@@ -703,10 +704,9 @@ void inode_t<Allocator>::decode(bufferlist::const_iterator &p)
if (struct_v >= 3) {
decode(client_ranges, p);
} else {
- map<client_t, client_writeable_range_t::byte_range_t> m;
+ std::map<client_t, client_writeable_range_t::byte_range_t> m;
decode(m, p);
- for (map<client_t, client_writeable_range_t::byte_range_t>::iterator
- q = m.begin(); q != m.end(); ++q)
+ for (auto q = m.begin(); q != m.end(); ++q)
client_ranges[q->first].range = q->second;
}
@@ -761,7 +761,7 @@ void inode_t<Allocator>::decode(bufferlist::const_iterator &p)
}
template<template<typename> class Allocator>
-void inode_t<Allocator>::dump(Formatter *f) const
+void inode_t<Allocator>::dump(ceph::Formatter *f) const
{
f->dump_unsigned("ino", ino);
f->dump_unsigned("rdev", rdev);
@@ -907,14 +907,14 @@ bool inode_t<Allocator>::older_is_consistent(const inode_t<Allocator> &other) co
}
template<template<typename> class Allocator>
-inline void encode(const inode_t<Allocator> &c, ::ceph::bufferlist &bl, uint64_t features)
+inline void encode(const inode_t<Allocator> &c, ::ceph::buffer::list &bl, uint64_t features)
{
ENCODE_DUMP_PRE();
c.encode(bl, features);
ENCODE_DUMP_POST(cl);
}
template<template<typename> class Allocator>
-inline void decode(inode_t<Allocator> &c, ::ceph::bufferlist::const_iterator &p)
+inline void decode(inode_t<Allocator> &c, ::ceph::buffer::list::const_iterator &p)
{
c.decode(p);
}
@@ -923,7 +923,11 @@ template<template<typename> class Allocator>
using alloc_string = std::basic_string<char,std::char_traits<char>,Allocator<char>>;
template<template<typename> class Allocator>
-using xattr_map = compact_map<alloc_string<Allocator>, bufferptr, std::less<alloc_string<Allocator>>, Allocator<std::pair<const alloc_string<Allocator>, bufferptr>>>; // FIXME bufferptr not in mempool
+using xattr_map = compact_map<alloc_string<Allocator>,
+ ceph::bufferptr,
+ std::less<alloc_string<Allocator>>,
+ Allocator<std::pair<const alloc_string<Allocator>,
+ ceph::bufferptr>>>; // FIXME bufferptr not in mempool
template<template<typename> class Allocator = std::allocator>
struct old_inode_t {
@@ -931,15 +935,15 @@ struct old_inode_t {
inode_t<Allocator> inode;
xattr_map<Allocator> xattrs;
- void encode(bufferlist &bl, uint64_t features) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<old_inode_t*>& ls);
};
// These methods may be moved back to mdstypes.cc when we have pmr
template<template<typename> class Allocator>
-void old_inode_t<Allocator>::encode(bufferlist& bl, uint64_t features) const
+void old_inode_t<Allocator>::encode(ceph::buffer::list& bl, uint64_t features) const
{
ENCODE_START(2, 2, bl);
encode(first, bl);
@@ -949,7 +953,7 @@ void old_inode_t<Allocator>::encode(bufferlist& bl, uint64_t features) const
}
template<template<typename> class Allocator>
-void old_inode_t<Allocator>::decode(bufferlist::const_iterator& bl)
+void old_inode_t<Allocator>::decode(ceph::buffer::list::const_iterator& bl)
{
DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
decode(first, bl);
@@ -959,7 +963,7 @@ void old_inode_t<Allocator>::decode(bufferlist::const_iterator& bl)
}
template<template<typename> class Allocator>
-void old_inode_t<Allocator>::dump(Formatter *f) const
+void old_inode_t<Allocator>::dump(ceph::Formatter *f) const
{
f->dump_unsigned("first", first);
inode.dump(f);
@@ -980,19 +984,19 @@ void old_inode_t<Allocator>::generate_test_instances(std::list<old_inode_t<Alloc
std::list<inode_t<Allocator>*> ils;
inode_t<Allocator>::generate_test_instances(ils);
ls.back()->inode = *ils.back();
- ls.back()->xattrs["user.foo"] = buffer::copy("asdf", 4);
- ls.back()->xattrs["user.unprintable"] = buffer::copy("\000\001\002", 3);
+ ls.back()->xattrs["user.foo"] = ceph::buffer::copy("asdf", 4);
+ ls.back()->xattrs["user.unprintable"] = ceph::buffer::copy("\000\001\002", 3);
}
template<template<typename> class Allocator>
-inline void encode(const old_inode_t<Allocator> &c, ::ceph::bufferlist &bl, uint64_t features)
+inline void encode(const old_inode_t<Allocator> &c, ::ceph::buffer::list &bl, uint64_t features)
{
ENCODE_DUMP_PRE();
c.encode(bl, features);
ENCODE_DUMP_POST(cl);
}
template<template<typename> class Allocator>
-inline void decode(old_inode_t<Allocator> &c, ::ceph::bufferlist::const_iterator &p)
+inline void decode(old_inode_t<Allocator> &c, ::ceph::buffer::list::const_iterator &p)
{
c.decode(p);
}
@@ -1001,9 +1005,9 @@ inline void decode(old_inode_t<Allocator> &c, ::ceph::bufferlist::const_iterator
* like an inode, but for a dir frag
*/
struct fnode_t {
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<fnode_t*>& ls);
version_t version = 0;
@@ -1023,9 +1027,9 @@ WRITE_CLASS_ENCODER(fnode_t)
struct old_rstat_t {
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& p);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& p);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<old_rstat_t*>& ls);
snapid_t first;
@@ -1045,7 +1049,7 @@ public:
feature_bitset_t(const feature_bitset_t& other) : _vec(other._vec) {}
feature_bitset_t(feature_bitset_t&& other) : _vec(std::move(other._vec)) {}
feature_bitset_t(unsigned long value = 0);
- feature_bitset_t(const vector<size_t>& array);
+ feature_bitset_t(const std::vector<size_t>& array);
feature_bitset_t& operator=(const feature_bitset_t& other) {
_vec = other._vec;
return *this;
@@ -1071,12 +1075,12 @@ public:
void clear() {
_vec.clear();
}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator &p);
- void dump(Formatter *f) const;
- void print(ostream& out) const;
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator &p);
+ void dump(ceph::Formatter *f) const;
+ void print(std::ostream& out) const;
private:
- vector<block_type> _vec;
+ std::vector<block_type> _vec;
};
WRITE_CLASS_ENCODER(feature_bitset_t)
@@ -1113,10 +1117,10 @@ struct metric_spec_t {
metric_flags.clear();
}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& p);
- void dump(Formatter *f) const;
- void print(ostream& out) const;
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& p);
+ void dump(ceph::Formatter *f) const;
+ void print(std::ostream& out) const;
// set of metrics that a client is capable of forwarding
feature_bitset_t metric_flags;
@@ -1164,9 +1168,9 @@ struct client_metadata_t {
metric_spec.clear();
}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& p);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& p);
+ void dump(ceph::Formatter *f) const;
kv_map_t kv_map;
feature_bitset_t features;
@@ -1190,9 +1194,9 @@ struct session_info_t {
client_metadata.clear();
}
- void encode(bufferlist& bl, uint64_t features) const;
- void decode(bufferlist::const_iterator& p);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list& bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator& p);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<session_info_t*>& ls);
entity_inst_t inst;
@@ -1215,13 +1219,13 @@ struct dentry_key_t {
// encode into something that can be decoded as a string.
// name_ (head) or name_%x (!head)
- void encode(bufferlist& bl) const {
- string key;
+ void encode(ceph::buffer::list& bl) const {
+ std::string key;
encode(key);
using ceph::encode;
encode(key, bl);
}
- void encode(string& key) const {
+ void encode(std::string& key) const {
char b[20];
if (snapid != CEPH_NOSNAP) {
uint64_t val(snapid);
@@ -1229,18 +1233,20 @@ struct dentry_key_t {
} else {
snprintf(b, sizeof(b), "%s", "head");
}
- ostringstream oss;
+ std::ostringstream oss;
oss << name << "_" << b;
key = oss.str();
}
- static void decode_helper(bufferlist::const_iterator& bl, string& nm, snapid_t& sn) {
- string key;
+ static void decode_helper(ceph::buffer::list::const_iterator& bl, std::string& nm,
+ snapid_t& sn) {
+ std::string key;
+ using ceph::decode;
decode(key, bl);
decode_helper(key, nm, sn);
}
- static void decode_helper(std::string_view key, string& nm, snapid_t& sn) {
+ static void decode_helper(std::string_view key, std::string& nm, snapid_t& sn) {
size_t i = key.find_last_of('_');
- ceph_assert(i != string::npos);
+ ceph_assert(i != std::string::npos);
if (key.compare(i+1, std::string_view::npos, "head") == 0) {
// name_head
sn = CEPH_NOSNAP;
@@ -1285,12 +1291,12 @@ struct string_snap_t {
string_snap_t() {}
string_snap_t(std::string_view n, snapid_t s) : name(n), snapid(s) {}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& p);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& p);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<string_snap_t*>& ls);
- string name;
+ std::string name;
snapid_t snapid;
};
WRITE_CLASS_ENCODER(string_snap_t)
@@ -1312,9 +1318,9 @@ inline std::ostream& operator<<(std::ostream& out, const string_snap_t &k)
* pending mutation state in the table.
*/
struct mds_table_pending_t {
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<mds_table_pending_t*>& ls);
uint64_t reqid = 0;
@@ -1327,12 +1333,12 @@ WRITE_CLASS_ENCODER(mds_table_pending_t)
struct metareqid_t {
metareqid_t() {}
metareqid_t(entity_name_t n, ceph_tid_t t) : name(n), tid(t) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
using ceph::encode;
encode(name, bl);
encode(tid, bl);
}
- void decode(bufferlist::const_iterator &p) {
+ void decode(ceph::buffer::list::const_iterator &p) {
using ceph::decode;
decode(name, p);
decode(tid, p);
@@ -1377,7 +1383,7 @@ namespace std {
struct cap_reconnect_t {
cap_reconnect_t() {}
cap_reconnect_t(uint64_t cap_id, inodeno_t pino, std::string_view p, int w, int i,
- inodeno_t sr, snapid_t sf, bufferlist& lb) :
+ inodeno_t sr, snapid_t sf, ceph::buffer::list& lb) :
path(p) {
capinfo.cap_id = cap_id;
capinfo.wanted = w;
@@ -1388,18 +1394,18 @@ struct cap_reconnect_t {
snap_follows = sf;
flockbl.claim(lb);
}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& bl);
- void encode_old(bufferlist& bl) const;
- void decode_old(bufferlist::const_iterator& bl);
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void encode_old(ceph::buffer::list& bl) const;
+ void decode_old(ceph::buffer::list::const_iterator& bl);
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<cap_reconnect_t*>& ls);
- string path;
+ std::string path;
mutable ceph_mds_cap_reconnect capinfo = {};
snapid_t snap_follows = 0;
- bufferlist flockbl;
+ ceph::buffer::list flockbl;
};
WRITE_CLASS_ENCODER(cap_reconnect_t)
@@ -1410,12 +1416,12 @@ struct snaprealm_reconnect_t {
realm.seq = seq;
realm.parent = parent;
}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& bl);
- void encode_old(bufferlist& bl) const;
- void decode_old(bufferlist::const_iterator& bl);
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void encode_old(ceph::buffer::list& bl) const;
+ void decode_old(ceph::buffer::list::const_iterator& bl);
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<snaprealm_reconnect_t*>& ls);
mutable ceph_mds_snaprealm_reconnect realm = {};
@@ -1455,18 +1461,18 @@ struct old_cap_reconnect_t {
return n;
}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
using ceph::encode;
encode(path, bl);
encode(capinfo, bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
using ceph::decode;
decode(path, bl);
decode(capinfo, bl);
}
- string path;
+ std::string path;
old_ceph_mds_cap_reconnect capinfo;
};
WRITE_CLASS_ENCODER(old_cap_reconnect_t)
@@ -1476,12 +1482,12 @@ struct dirfrag_t {
dirfrag_t() {}
dirfrag_t(inodeno_t i, frag_t f) : ino(i), frag(f) { }
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
using ceph::encode;
encode(ino, bl);
encode(frag, bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
using ceph::decode;
decode(ino, bl);
decode(frag, bl);
@@ -1533,26 +1539,26 @@ public:
inode_load_vec_t() : vec{DecayCounter(DecayRate()), DecayCounter(DecayRate())} {}
inode_load_vec_t(const DecayRate &rate) : vec{DecayCounter(rate), DecayCounter(rate)} {}
- DecayCounter &get(int t) {
- return vec[t];
+ DecayCounter &get(int t) {
+ return vec[t];
}
void zero() {
for (auto &d : vec) {
d.reset();
}
}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator& p);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator& p);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<inode_load_vec_t*>& ls);
private:
std::array<DecayCounter, NUM> vec;
};
-inline void encode(const inode_load_vec_t &c, bufferlist &bl) {
+inline void encode(const inode_load_vec_t &c, ceph::buffer::list &bl) {
c.encode(bl);
}
-inline void decode(inode_load_vec_t & c, bufferlist::const_iterator &p) {
+inline void decode(inode_load_vec_t & c, ceph::buffer::list::const_iterator &p) {
c.decode(p);
}
@@ -1574,22 +1580,22 @@ public:
vec{DecayCounter(rate), DecayCounter(rate), DecayCounter(rate), DecayCounter(rate), DecayCounter(rate)}
{}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(2, 2, bl);
for (const auto &i : vec) {
encode(i, bl);
}
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &p) {
+ void decode(ceph::buffer::list::const_iterator &p) {
DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, p);
for (auto &i : vec) {
decode(i, p);
}
DECODE_FINISH(p);
}
- void dump(Formatter *f) const;
- void dump(Formatter *f, const DecayRate& rate) const;
+ void dump(ceph::Formatter *f) const;
+ void dump(ceph::Formatter *f, const DecayRate& rate) const;
static void generate_test_instances(std::list<dirfrag_load_vec_t*>& ls);
const DecayCounter &get(int t) const {
@@ -1635,10 +1641,10 @@ private:
std::array<DecayCounter, NUM> vec;
};
-inline void encode(const dirfrag_load_vec_t &c, bufferlist &bl) {
+inline void encode(const dirfrag_load_vec_t &c, ceph::buffer::list &bl) {
c.encode(bl);
}
-inline void decode(dirfrag_load_vec_t& c, bufferlist::const_iterator &p) {
+inline void decode(dirfrag_load_vec_t& c, ceph::buffer::list::const_iterator &p) {
c.decode(p);
}
@@ -1673,15 +1679,15 @@ struct mds_load_t {
double cpu_load_avg = 0.0;
double mds_load() const; // defiend in MDBalancer.cc
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<mds_load_t*>& ls);
};
-inline void encode(const mds_load_t &c, bufferlist &bl) {
+inline void encode(const mds_load_t &c, ceph::buffer::list &bl) {
c.encode(bl);
}
-inline void decode(mds_load_t &c, bufferlist::const_iterator &p) {
+inline void decode(mds_load_t &c, ceph::buffer::list::const_iterator &p) {
c.decode(p);
}
@@ -1743,14 +1749,14 @@ typedef std::pair<mds_rank_t, mds_rank_t> mds_authority_t;
class MDSCacheObjectInfo {
public:
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<MDSCacheObjectInfo*>& ls);
inodeno_t ino = 0;
dirfrag_t dirfrag;
- string dname;
+ std::string dname;
snapid_t snapid;
};
@@ -1774,7 +1780,7 @@ namespace qi = boost::spirit::qi;
template <typename Iterator>
struct keys_and_values
- : qi::grammar<Iterator, std::map<string, string>()>
+ : qi::grammar<Iterator, std::map<std::string, std::string>()>
{
keys_and_values()
: keys_and_values::base_type(query)
@@ -1784,9 +1790,9 @@ struct keys_and_values
key = qi::char_("a-zA-Z_") >> *qi::char_("a-zA-Z_0-9");
value = +qi::char_("a-zA-Z_0-9");
}
- qi::rule<Iterator, std::map<string, string>()> query;
- qi::rule<Iterator, std::pair<string, string>()> pair;
- qi::rule<Iterator, string()> key, value;
+ qi::rule<Iterator, std::map<std::string, std::string>()> query;
+ qi::rule<Iterator, std::pair<std::string, std::string>()> pair;
+ qi::rule<Iterator, std::string()> key, value;
};
#endif
diff --git a/src/mds/snap.h b/src/mds/snap.h
index 9ebadb1255b..227f84fccc2 100644
--- a/src/mds/snap.h
+++ b/src/mds/snap.h
@@ -26,9 +26,9 @@
* generic snap descriptor.
*/
struct SnapInfo {
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<SnapInfo*>& ls);
std::string_view get_long_name() const;
@@ -36,9 +36,9 @@ struct SnapInfo {
snapid_t snapid;
inodeno_t ino;
utime_t stamp;
- string name;
+ std::string name;
- mutable string long_name; ///< cached _$ino_$name
+ mutable std::string long_name; ///< cached _$ino_$name
};
WRITE_CLASS_ENCODER(SnapInfo)
@@ -48,7 +48,7 @@ inline bool operator==(const SnapInfo &l, const SnapInfo &r)
l.stamp == r.stamp && l.name == r.name;
}
-ostream& operator<<(ostream& out, const SnapInfo &sn);
+std::ostream& operator<<(std::ostream& out, const SnapInfo &sn);
/*
* SnapRealm - a subtree that shares the same set of snapshots.
@@ -56,9 +56,9 @@ ostream& operator<<(ostream& out, const SnapInfo &sn);
struct SnapRealm;
struct snaplink_t {
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<snaplink_t*>& ls);
inodeno_t ino;
@@ -66,7 +66,7 @@ struct snaplink_t {
};
WRITE_CLASS_ENCODER(snaplink_t)
-ostream& operator<<(ostream& out, const snaplink_t &l);
+std::ostream& operator<<(std::ostream& out, const snaplink_t &l);
// carry data about a specific version of a SnapRealm
struct sr_t {
@@ -74,9 +74,9 @@ struct sr_t {
void clear_parent_global() { flags &= ~PARENT_GLOBAL; }
bool is_parent_global() const { return flags & PARENT_GLOBAL; }
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<sr_t*>& ls);
snapid_t seq = 0; // basically, a version/seq # for changes to _this_ realm.
@@ -84,9 +84,9 @@ struct sr_t {
snapid_t last_created = 0; // last snap created in _this_ realm.
snapid_t last_destroyed = 0; // seq for last removal
snapid_t current_parent_since = 1;
- map<snapid_t, SnapInfo> snaps;
- map<snapid_t, snaplink_t> past_parents; // key is "last" (or NOSNAP)
- set<snapid_t> past_parent_snaps;
+ std::map<snapid_t, SnapInfo> snaps;
+ std::map<snapid_t, snaplink_t> past_parents; // key is "last" (or NOSNAP)
+ std::set<snapid_t> past_parent_snaps;
__u32 flags = 0;
enum {