summaryrefslogtreecommitdiffstats
path: root/src/messages
diff options
context:
space:
mode:
Diffstat (limited to 'src/messages')
-rw-r--r--src/messages/MCacheExpire.h30
-rw-r--r--src/messages/MClientCapRelease.h3
-rw-r--r--src/messages/MClientCaps.h61
-rw-r--r--src/messages/MClientLease.h10
-rw-r--r--src/messages/MClientReconnect.h2
-rw-r--r--src/messages/MClientReply.h8
-rw-r--r--src/messages/MClientRequest.h23
-rw-r--r--src/messages/MClientSession.h2
-rw-r--r--src/messages/MClientSnap.h3
-rw-r--r--src/messages/MCommand.h3
-rw-r--r--src/messages/MDentryLink.h4
-rw-r--r--src/messages/MDentryUnlink.h8
-rw-r--r--src/messages/MDirUpdate.h37
-rw-r--r--src/messages/MDiscover.h16
-rw-r--r--src/messages/MDiscoverReply.h38
-rw-r--r--src/messages/MExportCaps.h2
-rw-r--r--src/messages/MExportCapsAck.h2
-rw-r--r--src/messages/MExportDir.h2
-rw-r--r--src/messages/MExportDirAck.h5
-rw-r--r--src/messages/MExportDirCancel.h4
-rw-r--r--src/messages/MExportDirDiscover.h10
-rw-r--r--src/messages/MExportDirDiscoverAck.h8
-rw-r--r--src/messages/MExportDirFinish.h6
-rw-r--r--src/messages/MExportDirNotify.h11
-rw-r--r--src/messages/MExportDirNotifyAck.h6
-rw-r--r--src/messages/MExportDirPrep.h10
-rw-r--r--src/messages/MExportDirPrepAck.h8
-rw-r--r--src/messages/MGatherCaps.h5
-rw-r--r--src/messages/MHeartbeat.h11
-rw-r--r--src/messages/MInodeFileCaps.h9
-rw-r--r--src/messages/MInterMDS.h42
-rw-r--r--src/messages/MLock.h22
-rw-r--r--src/messages/MMDSBeacon.h24
-rw-r--r--src/messages/MMDSCacheRejoin.h9
-rw-r--r--src/messages/MMDSFindIno.h5
-rw-r--r--src/messages/MMDSFindInoReply.h5
-rw-r--r--src/messages/MMDSFragmentNotify.h8
-rw-r--r--src/messages/MMDSMap.h10
-rw-r--r--src/messages/MMDSOpenIno.h3
-rw-r--r--src/messages/MMDSOpenInoReply.h6
-rw-r--r--src/messages/MMDSResolve.h2
-rw-r--r--src/messages/MMDSResolveAck.h2
-rw-r--r--src/messages/MMDSSlaveRequest.h34
-rw-r--r--src/messages/MMDSSnapUpdate.h6
-rw-r--r--src/messages/MMDSTableRequest.h3
45 files changed, 357 insertions, 171 deletions
diff --git a/src/messages/MCacheExpire.h b/src/messages/MCacheExpire.h
index e82e2e5adca..e8542424467 100644
--- a/src/messages/MCacheExpire.h
+++ b/src/messages/MCacheExpire.h
@@ -17,12 +17,16 @@
#include <string_view>
+#include "msg/Message.h"
+
#include "mds/mdstypes.h"
class MCacheExpire : public Message {
__s32 from;
public:
+ typedef boost::intrusive_ptr<MCacheExpire> ref;
+ typedef boost::intrusive_ptr<MCacheExpire const> const_ref;
/*
group things by realm (auth delgation root), since that's how auth is determined.
that makes it less work to process when exports are in progress.
@@ -32,16 +36,14 @@ public:
map<dirfrag_t, uint32_t> dirs;
map<dirfrag_t, map<pair<string,snapid_t>,uint32_t> > dentries;
- void merge(realm& o) {
+ void merge(const realm& o) {
inodes.insert(o.inodes.begin(), o.inodes.end());
dirs.insert(o.dirs.begin(), o.dirs.end());
- for (map<dirfrag_t,map<pair<string,snapid_t>,uint32_t> >::iterator p = o.dentries.begin();
- p != o.dentries.end();
- ++p) {
- if (dentries.count(p->first) == 0)
- dentries[p->first] = p->second;
- else
- dentries[p->first].insert(p->second.begin(), p->second.end());
+ for (const auto &p : o.dentries) {
+ auto em = dentries.emplace(std::piecewise_construct, std::forward_as_tuple(p.first), std::forward_as_tuple(p.second));
+ if (!em.second) {
+ em.first->second.insert(p.second.begin(), p.second.end());
+ }
}
}
@@ -62,7 +64,7 @@ public:
map<dirfrag_t, realm> realms;
- int get_from() { return from; }
+ int get_from() const { return from; }
MCacheExpire() : Message(MSG_MDS_CACHEEXPIRE), from(-1) {}
MCacheExpire(int f) :
@@ -84,11 +86,11 @@ public:
realms[r].dentries[df][pair<string,snapid_t>(dn,last)] = nonce;
}
- void add_realm(dirfrag_t df, realm& r) {
- if (realms.count(df) == 0)
- realms[df] = r;
- else
- realms[df].merge(r);
+ void add_realm(dirfrag_t df, const realm& r) {
+ auto em = realms.emplace(std::piecewise_construct, std::forward_as_tuple(df), std::forward_as_tuple(r));
+ if (!em.second) {
+ em.first->second.merge(r);
+ }
}
void decode_payload() override {
diff --git a/src/messages/MClientCapRelease.h b/src/messages/MClientCapRelease.h
index 275e2d08cc9..07692a7263f 100644
--- a/src/messages/MClientCapRelease.h
+++ b/src/messages/MClientCapRelease.h
@@ -22,6 +22,9 @@ class MClientCapRelease : public Message {
static const int HEAD_VERSION = 2;
static const int COMPAT_VERSION = 1;
public:
+ typedef boost::intrusive_ptr<MClientCapRelease> ref;
+ typedef boost::intrusive_ptr<MClientCapRelease const> const_ref;
+
struct ceph_mds_cap_release head;
vector<ceph_mds_cap_item> caps;
diff --git a/src/messages/MClientCaps.h b/src/messages/MClientCaps.h
index cc93dbbf00f..57a21bae03d 100644
--- a/src/messages/MClientCaps.h
+++ b/src/messages/MClientCaps.h
@@ -23,6 +23,9 @@ class MClientCaps : public Message {
static const int COMPAT_VERSION = 1;
public:
+ typedef boost::intrusive_ptr<MClientCaps> ref;
+ typedef boost::intrusive_ptr<MClientCaps const> const_ref;
+
static const unsigned FLAG_SYNC = (1<<0);
static const unsigned FLAG_NO_CAPSNAP = (1<<1); // unused
static const unsigned FLAG_PENDING_CAPSNAP = (1<<2);
@@ -56,32 +59,32 @@ class MClientCaps : public Message {
/* advisory CLIENT_CAPS_* flags to send to mds */
unsigned flags = 0;
- int get_caps() { return head.caps; }
- int get_wanted() { return head.wanted; }
- int get_dirty() { return head.dirty; }
- ceph_seq_t get_seq() { return head.seq; }
- ceph_seq_t get_issue_seq() { return head.issue_seq; }
- ceph_seq_t get_mseq() { return head.migrate_seq; }
-
- inodeno_t get_ino() { return inodeno_t(head.ino); }
- inodeno_t get_realm() { return inodeno_t(head.realm); }
- uint64_t get_cap_id() { return head.cap_id; }
-
- uint64_t get_size() { return size; }
- uint64_t get_max_size() { return max_size; }
- __u32 get_truncate_seq() { return truncate_seq; }
- uint64_t get_truncate_size() { return truncate_size; }
- utime_t get_ctime() { return ctime; }
- utime_t get_btime() { return btime; }
- utime_t get_mtime() { return mtime; }
- utime_t get_atime() { return atime; }
- __u64 get_change_attr() { return change_attr; }
- __u32 get_time_warp_seq() { return time_warp_seq; }
- uint64_t get_nfiles() { return nfiles; }
- uint64_t get_nsubdirs() { return nsubdirs; }
+ int get_caps() const { return head.caps; }
+ int get_wanted() const { return head.wanted; }
+ int get_dirty() const { return head.dirty; }
+ ceph_seq_t get_seq() const { return head.seq; }
+ ceph_seq_t get_issue_seq() const { return head.issue_seq; }
+ ceph_seq_t get_mseq() const { return head.migrate_seq; }
+
+ inodeno_t get_ino() const { return inodeno_t(head.ino); }
+ inodeno_t get_realm() const { return inodeno_t(head.realm); }
+ uint64_t get_cap_id() const { return head.cap_id; }
+
+ uint64_t get_size() const { return size; }
+ uint64_t get_max_size() const { return max_size; }
+ __u32 get_truncate_seq() const { return truncate_seq; }
+ uint64_t get_truncate_size() const { return truncate_size; }
+ utime_t get_ctime() const { return ctime; }
+ utime_t get_btime() const { return btime; }
+ utime_t get_mtime() const { return mtime; }
+ utime_t get_atime() const { return atime; }
+ __u64 get_change_attr() const { return change_attr; }
+ __u32 get_time_warp_seq() const { return time_warp_seq; }
+ uint64_t get_nfiles() const { return nfiles; }
+ uint64_t get_nsubdirs() const { return nsubdirs; }
bool dirstat_is_valid() const { return nfiles != -1 || nsubdirs != -1; }
- const file_layout_t& get_layout() {
+ const file_layout_t& get_layout() const {
return layout;
}
@@ -89,13 +92,13 @@ class MClientCaps : public Message {
layout = l;
}
- int get_migrate_seq() { return head.migrate_seq; }
- int get_op() { return head.op; }
+ int get_migrate_seq() const { return head.migrate_seq; }
+ int get_op() const { return head.op; }
- uint64_t get_client_tid() { return get_tid(); }
+ uint64_t get_client_tid() const { return get_tid(); }
void set_client_tid(uint64_t s) { set_tid(s); }
- snapid_t get_snap_follows() { return snapid_t(head.snap_follows); }
+ snapid_t get_snap_follows() const { return snapid_t(head.snap_follows); }
void set_snap_follows(snapid_t s) { head.snap_follows = s; }
void set_caps(int c) { head.caps = c; }
@@ -120,7 +123,7 @@ class MClientCaps : public Message {
}
void set_oldest_flush_tid(ceph_tid_t tid) { oldest_flush_tid = tid; }
- ceph_tid_t get_oldest_flush_tid() { return oldest_flush_tid; }
+ ceph_tid_t get_oldest_flush_tid() const { return oldest_flush_tid; }
void clear_dirty() { head.dirty = 0; }
diff --git a/src/messages/MClientLease.h b/src/messages/MClientLease.h
index 2b6487e7e2f..b127c90e1fb 100644
--- a/src/messages/MClientLease.h
+++ b/src/messages/MClientLease.h
@@ -20,7 +20,11 @@
#include "msg/Message.h"
-struct MClientLease : public Message {
+class MClientLease : public Message {
+public:
+ typedef boost::intrusive_ptr<MClientLease> ref;
+ typedef boost::intrusive_ptr<MClientLease const> const_ref;
+
struct ceph_mds_lease h;
std::string dname;
@@ -32,6 +36,10 @@ struct MClientLease : public Message {
snapid_t get_last() const { return snapid_t(h.last); }
MClientLease() : Message(CEPH_MSG_CLIENT_LEASE) {}
+ MClientLease(const MClientLease& m) :
+ Message(CEPH_MSG_CLIENT_LEASE),
+ h(m.h),
+ dname(m.dname) {}
MClientLease(int ac, ceph_seq_t seq, int m, uint64_t i, uint64_t sf, uint64_t sl) :
Message(CEPH_MSG_CLIENT_LEASE) {
h.action = ac;
diff --git a/src/messages/MClientReconnect.h b/src/messages/MClientReconnect.h
index 6c888b89e69..6740fbb1d40 100644
--- a/src/messages/MClientReconnect.h
+++ b/src/messages/MClientReconnect.h
@@ -25,6 +25,8 @@ class MClientReconnect : public Message {
const static int HEAD_VERSION = 3;
public:
+ typedef boost::intrusive_ptr<MClientReconnect> ref;
+ typedef boost::intrusive_ptr<MClientReconnect const> const_ref;
map<inodeno_t, cap_reconnect_t> caps; // only head inodes
vector<ceph_mds_snaprealm_reconnect> realms;
diff --git a/src/messages/MClientReply.h b/src/messages/MClientReply.h
index edd3d19c2bb..34a017ffb09 100644
--- a/src/messages/MClientReply.h
+++ b/src/messages/MClientReply.h
@@ -256,6 +256,8 @@ struct InodeStat {
class MClientReply : public Message {
// reply data
public:
+ typedef boost::intrusive_ptr<MClientReply> ref;
+ typedef boost::intrusive_ptr<MClientReply const> const_ref;
struct ceph_mds_reply_head head {};
bufferlist trace_bl;
bufferlist extra_bl;
@@ -278,11 +280,11 @@ public:
bool is_safe() const { return head.safe; }
MClientReply() : Message(CEPH_MSG_CLIENT_REPLY) {}
- MClientReply(MClientRequest *req, int result = 0) :
+ MClientReply(const MClientRequest &req, int result = 0) :
Message(CEPH_MSG_CLIENT_REPLY) {
memset(&head, 0, sizeof(head));
- header.tid = req->get_tid();
- head.op = req->get_op();
+ header.tid = req.get_tid();
+ head.op = req.get_op();
head.result = result;
head.safe = 1;
}
diff --git a/src/messages/MClientRequest.h b/src/messages/MClientRequest.h
index edb33e1acdf..f7771d133ff 100644
--- a/src/messages/MClientRequest.h
+++ b/src/messages/MClientRequest.h
@@ -53,7 +53,9 @@ class MClientRequest : public Message {
static const int COMPAT_VERSION = 1;
public:
- struct ceph_mds_request_head head;
+ typedef boost::intrusive_ptr<MClientRequest> ref;
+ typedef boost::intrusive_ptr<MClientRequest const> const_ref;
+ mutable struct ceph_mds_request_head head; /* XXX HACK! */
utime_t stamp;
struct Release {
@@ -76,13 +78,14 @@ public:
decode_nohead(item.dname_len, dname, bl);
}
};
- vector<Release> releases;
+ mutable vector<Release> releases; /* XXX HACK! */
// path arguments
filepath path, path2;
vector<uint64_t> gid_list;
- bool queued_for_replay = false;
+ /* XXX HACK */
+ mutable bool queued_for_replay = false;
public:
// cons
@@ -98,7 +101,7 @@ private:
public:
void set_mdsmap_epoch(epoch_t e) { head.mdsmap_epoch = e; }
- epoch_t get_mdsmap_epoch() { return head.mdsmap_epoch; }
+ epoch_t get_mdsmap_epoch() const { return head.mdsmap_epoch; }
epoch_t get_osdmap_epoch() const {
assert(head.op == CEPH_MDS_OP_SETXATTR);
if (header.version >= 3)
@@ -111,7 +114,7 @@ public:
head.args.setxattr.osdmap_epoch = e;
}
- metareqid_t get_reqid() {
+ metareqid_t get_reqid() const {
// FIXME: for now, assume clients always have 1 incarnation
return metareqid_t(get_orig_source(), header.tid);
}
@@ -119,7 +122,7 @@ public:
/*bool open_file_mode_is_readonly() {
return file_mode_is_readonly(ceph_flags_to_mode(head.args.open.flags));
}*/
- bool may_write() {
+ bool may_write() const {
return
(head.op & CEPH_MDS_OP_WRITE) ||
(head.op == CEPH_MDS_OP_OPEN && (head.args.open.flags & (O_CREAT|O_TRUNC)));
@@ -128,7 +131,7 @@ public:
int get_flags() const {
return head.flags;
}
- bool is_replay() {
+ bool is_replay() const {
return get_flags() & CEPH_MDS_FLAG_REPLAY;
}
@@ -169,10 +172,10 @@ public:
const string& get_path2() const { return path2.get_path(); }
const filepath& get_filepath2() const { return path2; }
- int get_dentry_wanted() { return get_flags() & CEPH_MDS_FLAG_WANT_DENTRY; }
+ int get_dentry_wanted() const { return get_flags() & CEPH_MDS_FLAG_WANT_DENTRY; }
- void mark_queued_for_replay() { queued_for_replay = true; }
- bool is_queued_for_replay() { return queued_for_replay; }
+ void mark_queued_for_replay() const { queued_for_replay = true; }
+ bool is_queued_for_replay() const { return queued_for_replay; }
void decode_payload() override {
auto p = payload.cbegin();
diff --git a/src/messages/MClientSession.h b/src/messages/MClientSession.h
index 31d943c89fb..3589d291e69 100644
--- a/src/messages/MClientSession.h
+++ b/src/messages/MClientSession.h
@@ -23,6 +23,8 @@ class MClientSession : public Message {
static const int COMPAT_VERSION = 1;
public:
+ typedef boost::intrusive_ptr<MClientSession> ref;
+ typedef boost::intrusive_ptr<MClientSession const> const_ref;
ceph_mds_session_head head;
std::map<std::string, std::string> metadata;
diff --git a/src/messages/MClientSnap.h b/src/messages/MClientSnap.h
index 8ef9970650d..b7b8864c5c3 100644
--- a/src/messages/MClientSnap.h
+++ b/src/messages/MClientSnap.h
@@ -18,6 +18,9 @@
#include "msg/Message.h"
struct MClientSnap : public Message {
+ typedef boost::intrusive_ptr<MClientSnap> ref;
+ typedef boost::intrusive_ptr<MClientSnap const> const_ref;
+
ceph_mds_snap_head head;
bufferlist bl;
diff --git a/src/messages/MCommand.h b/src/messages/MCommand.h
index 1b7cfd6da73..e0773181be9 100644
--- a/src/messages/MCommand.h
+++ b/src/messages/MCommand.h
@@ -21,6 +21,9 @@
class MCommand : public Message {
public:
+ typedef boost::intrusive_ptr<MCommand> ref;
+ typedef boost::intrusive_ptr<MCommand const> const_ref;
+
uuid_d fsid;
std::vector<string> cmd;
diff --git a/src/messages/MDentryLink.h b/src/messages/MDentryLink.h
index 4819421fd6b..3799f393b61 100644
--- a/src/messages/MDentryLink.h
+++ b/src/messages/MDentryLink.h
@@ -18,6 +18,8 @@
#include <string_view>
+#include "msg/Message.h"
+
class MDentryLink : public Message {
dirfrag_t subtree;
dirfrag_t dirfrag;
@@ -25,6 +27,8 @@ class MDentryLink : public Message {
bool is_primary = false;
public:
+ typedef boost::intrusive_ptr<MDentryLink> ref;
+ typedef boost::intrusive_ptr<MDentryLink const> const_ref;
dirfrag_t get_subtree() const { return subtree; }
dirfrag_t get_dirfrag() const { return dirfrag; }
const string& get_dn() const { return dn; }
diff --git a/src/messages/MDentryUnlink.h b/src/messages/MDentryUnlink.h
index af86c5e92ff..613c1077bbb 100644
--- a/src/messages/MDentryUnlink.h
+++ b/src/messages/MDentryUnlink.h
@@ -18,13 +18,17 @@
#include <string_view>
+#include "msg/Message.h"
+
class MDentryUnlink : public Message {
dirfrag_t dirfrag;
string dn;
public:
- dirfrag_t get_dirfrag() { return dirfrag; }
- string& get_dn() { return dn; }
+ typedef boost::intrusive_ptr<MDentryUnlink> ref;
+ typedef boost::intrusive_ptr<MDentryUnlink const> const_ref;
+ dirfrag_t get_dirfrag() const { return dirfrag; }
+ const string& get_dn() const { return dn; }
bufferlist straybl;
bufferlist snapbl;
diff --git a/src/messages/MDirUpdate.h b/src/messages/MDirUpdate.h
index e73351bff9e..a35de0b8db2 100644
--- a/src/messages/MDirUpdate.h
+++ b/src/messages/MDirUpdate.h
@@ -16,18 +16,20 @@
#ifndef CEPH_MDIRUPDATE_H
#define CEPH_MDIRUPDATE_H
-#include "msg/Message.h"
+#include "MInterMDS.h"
-class MDirUpdate : public Message {
+class MDirUpdate : public MInterMDS {
public:
- MDirUpdate() : Message(MSG_MDS_DIRUPDATE) {}
+ typedef boost::intrusive_ptr<MDirUpdate> ref;
+ typedef boost::intrusive_ptr<MDirUpdate const> const_ref;
+ MDirUpdate() : MInterMDS(MSG_MDS_DIRUPDATE) {}
MDirUpdate(mds_rank_t f,
dirfrag_t dirfrag,
int dir_rep,
const std::set<int32_t>& dir_rep_by,
filepath& path,
bool discover = false) :
- Message(MSG_MDS_DIRUPDATE), from_mds(f), dirfrag(dirfrag),
+ MInterMDS(MSG_MDS_DIRUPDATE), from_mds(f), dirfrag(dirfrag),
dir_rep(dir_rep), dir_rep_by(dir_rep_by), path(path) {
this->discover = discover ? 5 : 0;
}
@@ -40,7 +42,7 @@ public:
const filepath& get_path() const { return path; }
bool has_tried_discover() const { return tried_discover > 0; }
- void inc_tried_discover() { ++tried_discover; }
+ void inc_tried_discover() const { ++tried_discover; }
const char *get_type_name() const override { return "dir_update"; }
void print(ostream& out) const override {
@@ -67,8 +69,27 @@ public:
encode(path, payload);
}
-private:
- ~MDirUpdate() override {}
+ bool is_forwardable() const override {
+ return true;
+ }
+
+ MInterMDS::ref forwardable() const override {
+ MDirUpdate::ref m(new MDirUpdate(*this), false);
+ return m;
+ }
+
+protected:
+ ~MDirUpdate() {}
+ MDirUpdate(const MDirUpdate& m)
+ : MInterMDS(MSG_MDS_DIRUPDATE),
+ from_mds(m.from_mds),
+ dirfrag(m.dirfrag),
+ dir_rep(m.dir_rep),
+ discover(m.discover),
+ dir_rep_by(m.dir_rep_by),
+ path(m.path),
+ tried_discover(m.tried_discover)
+ {}
mds_rank_t from_mds = -1;
dirfrag_t dirfrag;
@@ -76,7 +97,7 @@ private:
int32_t discover = 5;
std::set<int32_t> dir_rep_by;
filepath path;
- int tried_discover = 0;
+ mutable int tried_discover = 0; // XXX HACK
};
#endif
diff --git a/src/messages/MDiscover.h b/src/messages/MDiscover.h
index b891fa27c11..a1004f2e325 100644
--- a/src/messages/MDiscover.h
+++ b/src/messages/MDiscover.h
@@ -33,15 +33,17 @@ class MDiscover : public Message {
bool want_xlocked = false;
public:
- inodeno_t get_base_ino() { return base_ino; }
- frag_t get_base_dir_frag() { return base_dir_frag; }
- snapid_t get_snapid() { return snapid; }
+ typedef boost::intrusive_ptr<MDiscover> ref;
+ typedef boost::intrusive_ptr<MDiscover const> const_ref;
+ inodeno_t get_base_ino() const { return base_ino; }
+ frag_t get_base_dir_frag() const { return base_dir_frag; }
+ snapid_t get_snapid() const { return snapid; }
- filepath& get_want() { return want; }
- const std::string& get_dentry(int n) { return want[n]; }
+ const filepath& get_want() const { return want; }
+ const std::string& get_dentry(int n) const { return want[n]; }
- bool wants_base_dir() { return want_base_dir; }
- bool wants_xlocked() { return want_xlocked; }
+ bool wants_base_dir() const { return want_base_dir; }
+ bool wants_xlocked() const { return want_xlocked; }
void set_base_dir_frag(frag_t f) { base_dir_frag = f; }
diff --git a/src/messages/MDiscoverReply.h b/src/messages/MDiscoverReply.h
index d6e0d8967cd..8d86f267e44 100644
--- a/src/messages/MDiscoverReply.h
+++ b/src/messages/MDiscoverReply.h
@@ -83,47 +83,49 @@ class MDiscoverReply : public Message {
mds_rank_t dir_auth_hint = 0;
public:
+ typedef boost::intrusive_ptr<MDiscoverReply> ref;
+ typedef boost::intrusive_ptr<MDiscoverReply const> const_ref;
__u8 starts_with = 0;
bufferlist trace;
enum { DIR, DENTRY, INODE };
// accessors
- inodeno_t get_base_ino() { return base_ino; }
- frag_t get_base_dir_frag() { return base_dir_frag; }
- bool get_wanted_base_dir() { return wanted_base_dir; }
- bool get_wanted_xlocked() { return wanted_xlocked; }
- snapid_t get_wanted_snapid() { return wanted_snapid; }
+ inodeno_t get_base_ino() const { return base_ino; }
+ frag_t get_base_dir_frag() const { return base_dir_frag; }
+ bool get_wanted_base_dir() const { return wanted_base_dir; }
+ bool get_wanted_xlocked() const { return wanted_xlocked; }
+ snapid_t get_wanted_snapid() const { return wanted_snapid; }
- bool is_flag_error_dn() { return flag_error_dn; }
- bool is_flag_error_dir() { return flag_error_dir; }
- const std::string& get_error_dentry() { return error_dentry; }
+ bool is_flag_error_dn() const { return flag_error_dn; }
+ bool is_flag_error_dir() const { return flag_error_dir; }
+ const std::string& get_error_dentry() const { return error_dentry; }
- int get_starts_with() { return starts_with; }
+ int get_starts_with() const { return starts_with; }
mds_rank_t get_dir_auth_hint() const { return dir_auth_hint; }
- bool is_unsolicited() { return unsolicited; }
+ bool is_unsolicited() const { return unsolicited; }
void mark_unsolicited() { unsolicited = true; }
void set_base_dir_frag(frag_t df) { base_dir_frag = df; }
// cons
MDiscoverReply() : Message(MSG_MDS_DISCOVERREPLY, HEAD_VERSION) { }
- MDiscoverReply(MDiscover *dis) :
+ MDiscoverReply(const MDiscover &dis) :
Message(MSG_MDS_DISCOVERREPLY, HEAD_VERSION),
- base_ino(dis->get_base_ino()),
- base_dir_frag(dis->get_base_dir_frag()),
- wanted_base_dir(dis->wants_base_dir()),
- wanted_xlocked(dis->wants_xlocked()),
- wanted_snapid(dis->get_snapid()),
+ base_ino(dis.get_base_ino()),
+ base_dir_frag(dis.get_base_dir_frag()),
+ wanted_base_dir(dis.wants_base_dir()),
+ wanted_xlocked(dis.wants_xlocked()),
+ wanted_snapid(dis.get_snapid()),
flag_error_dn(false),
flag_error_dir(false),
unsolicited(false),
dir_auth_hint(CDIR_AUTH_UNKNOWN),
starts_with(DIR)
{
- header.tid = dis->get_tid();
+ header.tid = dis.get_tid();
}
MDiscoverReply(dirfrag_t df) :
Message(MSG_MDS_DISCOVERREPLY, HEAD_VERSION),
@@ -150,7 +152,7 @@ public:
}
// builders
- bool is_empty() {
+ bool is_empty() const {
return trace.length() == 0 &&
!flag_error_dn &&
!flag_error_dir &&
diff --git a/src/messages/MExportCaps.h b/src/messages/MExportCaps.h
index 6d80b2eff82..82d64935fab 100644
--- a/src/messages/MExportCaps.h
+++ b/src/messages/MExportCaps.h
@@ -23,6 +23,8 @@ class MExportCaps : public Message {
static const int HEAD_VERSION = 2;
static const int COMPAT_VERSION = 1;
public:
+ typedef boost::intrusive_ptr<MExportCaps> ref;
+ typedef boost::intrusive_ptr<MExportCaps const> const_ref;
inodeno_t ino;
bufferlist cap_bl;
map<client_t,entity_inst_t> client_map;
diff --git a/src/messages/MExportCapsAck.h b/src/messages/MExportCapsAck.h
index 03b89bcd39d..2ff1643661f 100644
--- a/src/messages/MExportCapsAck.h
+++ b/src/messages/MExportCapsAck.h
@@ -21,6 +21,8 @@
class MExportCapsAck : public Message {
public:
+ typedef boost::intrusive_ptr<MExportCapsAck> ref;
+ typedef boost::intrusive_ptr<MExportCapsAck const> const_ref;
inodeno_t ino;
bufferlist cap_bl;
diff --git a/src/messages/MExportDir.h b/src/messages/MExportDir.h
index fc43720d81b..29e9fa7fc04 100644
--- a/src/messages/MExportDir.h
+++ b/src/messages/MExportDir.h
@@ -21,6 +21,8 @@
class MExportDir : public Message {
public:
+ typedef boost::intrusive_ptr<MExportDir>ref;
+ typedef boost::intrusive_ptr<MExportDir const> const_ref;
dirfrag_t dirfrag;
bufferlist export_data;
vector<dirfrag_t> bounds;
diff --git a/src/messages/MExportDirAck.h b/src/messages/MExportDirAck.h
index dcf1c7d3a5c..ff076eca5d2 100644
--- a/src/messages/MExportDirAck.h
+++ b/src/messages/MExportDirAck.h
@@ -16,13 +16,16 @@
#define CEPH_MEXPORTDIRACK_H
#include "MExportDir.h"
+#include "msg/Message.h"
class MExportDirAck : public Message {
public:
+ typedef boost::intrusive_ptr<MExportDirAck> ref;
+ typedef boost::intrusive_ptr<MExportDirAck const> const_ref;
dirfrag_t dirfrag;
bufferlist imported_caps;
- dirfrag_t get_dirfrag() { return dirfrag; }
+ dirfrag_t get_dirfrag() const { return dirfrag; }
MExportDirAck() : Message(MSG_MDS_EXPORTDIRACK) {}
MExportDirAck(dirfrag_t df, uint64_t tid) :
diff --git a/src/messages/MExportDirCancel.h b/src/messages/MExportDirCancel.h
index 195aa316d43..96892a13a28 100644
--- a/src/messages/MExportDirCancel.h
+++ b/src/messages/MExportDirCancel.h
@@ -22,7 +22,9 @@ class MExportDirCancel : public Message {
dirfrag_t dirfrag;
public:
- dirfrag_t get_dirfrag() { return dirfrag; }
+ typedef boost::intrusive_ptr<MExportDirCancel> ref;
+ typedef boost::intrusive_ptr<MExportDirCancel const> const_ref;
+ dirfrag_t get_dirfrag() const { return dirfrag; }
MExportDirCancel() : Message(MSG_MDS_EXPORTDIRCANCEL) {}
MExportDirCancel(dirfrag_t df, uint64_t tid) :
diff --git a/src/messages/MExportDirDiscover.h b/src/messages/MExportDirDiscover.h
index c616939d760..cb581d207db 100644
--- a/src/messages/MExportDirDiscover.h
+++ b/src/messages/MExportDirDiscover.h
@@ -24,10 +24,12 @@ class MExportDirDiscover : public Message {
filepath path;
public:
- mds_rank_t get_source_mds() { return from; }
- inodeno_t get_ino() { return dirfrag.ino; }
- dirfrag_t get_dirfrag() { return dirfrag; }
- filepath& get_path() { return path; }
+ typedef boost::intrusive_ptr<MExportDirDiscover> ref;
+ typedef boost::intrusive_ptr<MExportDirDiscover const> const_ref;
+ mds_rank_t get_source_mds() const { return from; }
+ inodeno_t get_ino() const { return dirfrag.ino; }
+ dirfrag_t get_dirfrag() const { return dirfrag; }
+ const filepath& get_path() const { return path; }
bool started;
diff --git a/src/messages/MExportDirDiscoverAck.h b/src/messages/MExportDirDiscoverAck.h
index 118d5f8c8e1..c6bc716f9c5 100644
--- a/src/messages/MExportDirDiscoverAck.h
+++ b/src/messages/MExportDirDiscoverAck.h
@@ -23,9 +23,11 @@ class MExportDirDiscoverAck : public Message {
bool success;
public:
- inodeno_t get_ino() { return dirfrag.ino; }
- dirfrag_t get_dirfrag() { return dirfrag; }
- bool is_success() { return success; }
+ typedef boost::intrusive_ptr<MExportDirDiscoverAck> ref;
+ typedef boost::intrusive_ptr<MExportDirDiscoverAck const> const_ref;
+ inodeno_t get_ino() const { return dirfrag.ino; }
+ dirfrag_t get_dirfrag() const { return dirfrag; }
+ bool is_success() const { return success; }
MExportDirDiscoverAck() : Message(MSG_MDS_EXPORTDIRDISCOVERACK) {}
MExportDirDiscoverAck(dirfrag_t df, uint64_t tid, bool s=true) :
diff --git a/src/messages/MExportDirFinish.h b/src/messages/MExportDirFinish.h
index 38f4f0b51fe..6f7bb1aa2f8 100644
--- a/src/messages/MExportDirFinish.h
+++ b/src/messages/MExportDirFinish.h
@@ -22,8 +22,10 @@ class MExportDirFinish : public Message {
bool last;
public:
- dirfrag_t get_dirfrag() { return dirfrag; }
- bool is_last() { return last; }
+ typedef boost::intrusive_ptr<MExportDirFinish> ref;
+ typedef boost::intrusive_ptr<MExportDirFinish const> const_ref;
+ dirfrag_t get_dirfrag() const { return dirfrag; }
+ bool is_last() const { return last; }
MExportDirFinish() : last(false) {}
MExportDirFinish(dirfrag_t df, bool l, uint64_t tid) :
diff --git a/src/messages/MExportDirNotify.h b/src/messages/MExportDirNotify.h
index 48190173fd1..21142a0a83f 100644
--- a/src/messages/MExportDirNotify.h
+++ b/src/messages/MExportDirNotify.h
@@ -24,10 +24,13 @@ class MExportDirNotify : public Message {
list<dirfrag_t> bounds; // bounds; these dirs are _not_ included (tho the dirfragdes are)
public:
- dirfrag_t get_dirfrag() { return base; }
- pair<__s32,__s32> get_old_auth() { return old_auth; }
- pair<__s32,__s32> get_new_auth() { return new_auth; }
- bool wants_ack() { return ack; }
+ typedef boost::intrusive_ptr<MExportDirNotify> ref;
+ typedef boost::intrusive_ptr<MExportDirNotify const> const_ref;
+ dirfrag_t get_dirfrag() const { return base; }
+ pair<__s32,__s32> get_old_auth() const { return old_auth; }
+ pair<__s32,__s32> get_new_auth() const { return new_auth; }
+ bool wants_ack() const { return ack; }
+ const list<dirfrag_t>& get_bounds() const { return bounds; }
list<dirfrag_t>& get_bounds() { return bounds; }
MExportDirNotify() {}
diff --git a/src/messages/MExportDirNotifyAck.h b/src/messages/MExportDirNotifyAck.h
index 9248a376ddc..64c4a5272fd 100644
--- a/src/messages/MExportDirNotifyAck.h
+++ b/src/messages/MExportDirNotifyAck.h
@@ -22,8 +22,10 @@ class MExportDirNotifyAck : public Message {
pair<__s32,__s32> new_auth;
public:
- dirfrag_t get_dirfrag() { return dirfrag; }
- pair<__s32,__s32> get_new_auth() { return new_auth; }
+ typedef boost::intrusive_ptr<MExportDirNotifyAck>ref;
+ typedef boost::intrusive_ptr<MExportDirNotifyAck const> const_ref;
+ dirfrag_t get_dirfrag() const { return dirfrag; }
+ pair<__s32,__s32> get_new_auth() const { return new_auth; }
MExportDirNotifyAck() {}
MExportDirNotifyAck(dirfrag_t df, uint64_t tid, pair<__s32,__s32> na) :
diff --git a/src/messages/MExportDirPrep.h b/src/messages/MExportDirPrep.h
index bb6540b04fc..8eb0eda78c8 100644
--- a/src/messages/MExportDirPrep.h
+++ b/src/messages/MExportDirPrep.h
@@ -22,6 +22,8 @@
class MExportDirPrep : public Message {
dirfrag_t dirfrag;
public:
+ typedef boost::intrusive_ptr<MExportDirPrep> ref;
+ typedef boost::intrusive_ptr<MExportDirPrep const> const_ref;
bufferlist basedir;
list<dirfrag_t> bounds;
list<bufferlist> traces;
@@ -30,11 +32,11 @@ private:
bool b_did_assim;
public:
- dirfrag_t get_dirfrag() { return dirfrag; }
- list<dirfrag_t>& get_bounds() { return bounds; }
- set<mds_rank_t> &get_bystanders() { return bystanders; }
+ dirfrag_t get_dirfrag() const { return dirfrag; }
+ const list<dirfrag_t>& get_bounds() const { return bounds; }
+ const set<mds_rank_t> &get_bystanders() const { return bystanders; }
- bool did_assim() { return b_did_assim; }
+ bool did_assim() const { return b_did_assim; }
void mark_assim() { b_did_assim = true; }
MExportDirPrep() {
diff --git a/src/messages/MExportDirPrepAck.h b/src/messages/MExportDirPrepAck.h
index b9155e2dc15..94a36bdcaa4 100644
--- a/src/messages/MExportDirPrepAck.h
+++ b/src/messages/MExportDirPrepAck.h
@@ -23,8 +23,10 @@ class MExportDirPrepAck : public Message {
bool success = false;
public:
- dirfrag_t get_dirfrag() { return dirfrag; }
-
+ typedef boost::intrusive_ptr<MExportDirPrepAck> ref;
+ typedef boost::intrusive_ptr<MExportDirPrepAck const> const_ref;
+ dirfrag_t get_dirfrag() const { return dirfrag; }
+
MExportDirPrepAck() {}
MExportDirPrepAck(dirfrag_t df, bool s, uint64_t tid) :
Message(MSG_MDS_EXPORTDIRPREPACK), dirfrag(df), success(s) {
@@ -34,7 +36,7 @@ private:
~MExportDirPrepAck() override {}
public:
- bool is_success() { return success; }
+ bool is_success() const { return success; }
const char *get_type_name() const override { return "ExPAck"; }
void print(ostream& o) const override {
o << "export_prep_ack(" << dirfrag << (success ? " success)" : " fail)");
diff --git a/src/messages/MGatherCaps.h b/src/messages/MGatherCaps.h
index 28737df212c..73d8d08d409 100644
--- a/src/messages/MGatherCaps.h
+++ b/src/messages/MGatherCaps.h
@@ -5,7 +5,10 @@
class MGatherCaps : public Message {
- public:
+public:
+ typedef boost::intrusive_ptr<MGatherCaps> ref;
+ typedef boost::intrusive_ptr<MGatherCaps const> const_ref;
+
inodeno_t ino;
MGatherCaps() :
diff --git a/src/messages/MHeartbeat.h b/src/messages/MHeartbeat.h
index 367a1b3733d..3d7f98dd02c 100644
--- a/src/messages/MHeartbeat.h
+++ b/src/messages/MHeartbeat.h
@@ -26,12 +26,13 @@ class MHeartbeat : public Message {
map<mds_rank_t, float> import_map;
public:
- mds_load_t& get_load() { return load; }
- int get_beat() { return beat; }
+ typedef boost::intrusive_ptr<MHeartbeat> ref;
+ typedef boost::intrusive_ptr<MHeartbeat const> const_ref;
+ const mds_load_t& get_load() const { return load; }
+ int get_beat() const { return beat; }
- map<mds_rank_t, float>& get_import_map() {
- return import_map;
- }
+ const map<mds_rank_t, float>& get_import_map() const { return import_map; }
+ map<mds_rank_t, float>& get_import_map() { return import_map; }
MHeartbeat() : Message(MSG_MDS_HEARTBEAT), load(DecayRate()) {}
MHeartbeat(mds_load_t& load, int beat)
diff --git a/src/messages/MInodeFileCaps.h b/src/messages/MInodeFileCaps.h
index de7d1fb276f..a5e5c541652 100644
--- a/src/messages/MInodeFileCaps.h
+++ b/src/messages/MInodeFileCaps.h
@@ -16,13 +16,18 @@
#ifndef CEPH_MINODEFILECAPS_H
#define CEPH_MINODEFILECAPS_H
+#include "msg/Message.h"
+
class MInodeFileCaps : public Message {
inodeno_t ino;
__u32 caps = 0;
public:
- inodeno_t get_ino() { return ino; }
- int get_caps() { return caps; }
+ typedef boost::intrusive_ptr<MInodeFileCaps> ref;
+ typedef boost::intrusive_ptr<MInodeFileCaps const> const_ref;
+
+ inodeno_t get_ino() const { return ino; }
+ int get_caps() const { return caps; }
MInodeFileCaps() : Message(MSG_MDS_INODEFILECAPS) {}
MInodeFileCaps(inodeno_t ino, int caps) :
diff --git a/src/messages/MInterMDS.h b/src/messages/MInterMDS.h
new file mode 100644
index 00000000000..fecd737401f
--- /dev/null
+++ b/src/messages/MInterMDS.h
@@ -0,0 +1,42 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (c) 2018 Red Hat, Inc.
+ *
+ * This is free software; you can redistribute it and/or
+ * 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_MINTERMDS_H
+#define CEPH_MINTERMDS_H
+
+#include "include/types.h"
+#include "include/fs_types.h"
+
+#include "msg/Message.h"
+
+class MInterMDS : public Message {
+public:
+ typedef boost::intrusive_ptr<MInterMDS> ref;
+ typedef boost::intrusive_ptr<MInterMDS const> const_ref;
+
+ template <typename... T>
+ MInterMDS(T&&... args) : Message(std::forward<T>(args)...) {}
+
+ virtual bool is_forwardable() const { return false; }
+
+ // N.B. only some types of messages we should be 'forwarding'; they
+ // explicitly encode their source mds, which gets clobbered when resent
+ virtual MInterMDS::ref forwardable() const {ceph_abort();}
+
+protected:
+ virtual ~MInterMDS() {}
+};
+
+#endif
diff --git a/src/messages/MLock.h b/src/messages/MLock.h
index 45086214d4e..4b992ff1bc8 100644
--- a/src/messages/MLock.h
+++ b/src/messages/MLock.h
@@ -18,10 +18,11 @@
#include "msg/Message.h"
#include "mds/locks.h"
+#include "mds/SimpleLock.h"
class MLock : public Message {
int32_t action = 0; // action type
- int32_t asker = 0; // who is initiating this request
+ mds_rank_t asker = 0; // who is initiating this request
metareqid_t reqid; // for remote lock requests
__u16 lock_type = 0; // lock object type
@@ -30,26 +31,31 @@ class MLock : public Message {
bufferlist lockdata; // and possibly some data
public:
+ typedef boost::intrusive_ptr<MLock> ref;
+ typedef boost::intrusive_ptr<MLock const> const_ref;
+
bufferlist& get_data() { return lockdata; }
- int get_asker() { return asker; }
- int get_action() { return action; }
- metareqid_t get_reqid() { return reqid; }
+ const bufferlist& get_data() const { return lockdata; }
+ int get_asker() const { return asker; }
+ int get_action() const { return action; }
+ metareqid_t get_reqid() const { return reqid; }
- int get_lock_type() { return lock_type; }
+ int get_lock_type() const { return lock_type; }
+ const MDSCacheObjectInfo &get_object_info() const { return object_info; }
MDSCacheObjectInfo &get_object_info() { return object_info; }
MLock() : Message(MSG_MDS_LOCK) {}
- MLock(int ac, int as) :
+ MLock(int ac, mds_rank_t as) :
Message(MSG_MDS_LOCK),
action(ac), asker(as),
lock_type(0) { }
- MLock(SimpleLock *lock, int ac, int as) :
+ MLock(SimpleLock *lock, int ac, mds_rank_t as) :
Message(MSG_MDS_LOCK),
action(ac), asker(as),
lock_type(lock->get_type()) {
lock->get_parent()->set_object_info(object_info);
}
- MLock(SimpleLock *lock, int ac, int as, bufferlist& bl) :
+ MLock(SimpleLock *lock, int ac, mds_rank_t as, bufferlist& bl) :
Message(MSG_MDS_LOCK),
action(ac), asker(as), lock_type(lock->get_type()) {
lock->get_parent()->set_object_info(object_info);
diff --git a/src/messages/MMDSBeacon.h b/src/messages/MMDSBeacon.h
index 3ba46ed7fd9..036c6d5a991 100644
--- a/src/messages/MMDSBeacon.h
+++ b/src/messages/MMDSBeacon.h
@@ -17,6 +17,7 @@
#include <string_view>
+#include "msg/Message.h"
#include "messages/PaxosServiceMessage.h"
#include "include/types.h"
@@ -204,6 +205,9 @@ class MMDSBeacon : public PaxosServiceMessage {
uint64_t mds_features;
public:
+ typedef boost::intrusive_ptr<MMDSBeacon> ref;
+ typedef boost::intrusive_ptr<MMDSBeacon const> const_ref;
+
MMDSBeacon()
: PaxosServiceMessage(MSG_MDS_BEACON, 0, HEAD_VERSION, COMPAT_VERSION),
global_id(0), state(MDSMap::STATE_NULL), standby_for_rank(MDS_RANK_NONE),
@@ -211,7 +215,7 @@ class MMDSBeacon : public PaxosServiceMessage {
mds_features(0) {
set_priority(CEPH_MSG_PRIO_HIGH);
}
- MMDSBeacon(const uuid_d &f, mds_gid_t g, string& n, epoch_t les, MDSMap::DaemonState st, version_t se, uint64_t feat) :
+ MMDSBeacon(const uuid_d &f, mds_gid_t g, const string& n, epoch_t les, MDSMap::DaemonState st, version_t se, uint64_t feat) :
PaxosServiceMessage(MSG_MDS_BEACON, les, HEAD_VERSION, COMPAT_VERSION),
fsid(f), global_id(g), name(n), state(st), seq(se),
standby_for_rank(MDS_RANK_NONE), standby_for_fscid(FS_CLUSTER_ID_NONE),
@@ -222,16 +226,16 @@ private:
~MMDSBeacon() override {}
public:
- uuid_d& get_fsid() { return fsid; }
- mds_gid_t get_global_id() { return global_id; }
- string& get_name() { return name; }
- epoch_t get_last_epoch_seen() { return version; }
- MDSMap::DaemonState get_state() { return state; }
- version_t get_seq() { return seq; }
+ const uuid_d& get_fsid() const { return fsid; }
+ mds_gid_t get_global_id() const { return global_id; }
+ const string& get_name() const { return name; }
+ epoch_t get_last_epoch_seen() const { return version; }
+ MDSMap::DaemonState get_state() const { return state; }
+ version_t get_seq() const { return seq; }
const char *get_type_name() const override { return "mdsbeacon"; }
- mds_rank_t get_standby_for_rank() { return standby_for_rank; }
- const string& get_standby_for_name() { return standby_for_name; }
- const fs_cluster_id_t& get_standby_for_fscid() { return standby_for_fscid; }
+ mds_rank_t get_standby_for_rank() const { return standby_for_rank; }
+ const string& get_standby_for_name() const { return standby_for_name; }
+ const fs_cluster_id_t& get_standby_for_fscid() const { return standby_for_fscid; }
bool get_standby_replay() const { return standby_replay; }
uint64_t get_mds_features() const { return mds_features; }
diff --git a/src/messages/MMDSCacheRejoin.h b/src/messages/MMDSCacheRejoin.h
index ead58765a55..c49c2ecebdd 100644
--- a/src/messages/MMDSCacheRejoin.h
+++ b/src/messages/MMDSCacheRejoin.h
@@ -33,6 +33,9 @@ class MMDSCacheRejoin : public Message {
static const int COMPAT_VERSION = 1;
public:
+ typedef boost::intrusive_ptr<MMDSCacheRejoin> ref;
+ typedef boost::intrusive_ptr<MMDSCacheRejoin const> const_ref;
+
static const int OP_WEAK = 1; // replica -> auth, i exist, + maybe open files.
static const int OP_STRONG = 2; // replica -> auth, i exist, + open files and lock state.
static const int OP_ACK = 3; // auth -> replica, here is your lock state.
@@ -102,9 +105,9 @@ class MMDSCacheRejoin : public Message {
ino(0), remote_ino(0), remote_d_type(0), nonce(0), lock(0) {}
dn_strong(snapid_t f, inodeno_t pi, inodeno_t ri, unsigned char rdt, int n, int l) :
first(f), ino(pi), remote_ino(ri), remote_d_type(rdt), nonce(n), lock(l) {}
- bool is_primary() { return ino > 0; }
- bool is_remote() { return remote_ino > 0; }
- bool is_null() { return ino == 0 && remote_ino == 0; }
+ bool is_primary() const { return ino > 0; }
+ bool is_remote() const { return remote_ino > 0; }
+ bool is_null() const { return ino == 0 && remote_ino == 0; }
void encode(bufferlist &bl) const {
using ceph::encode;
encode(first, bl);
diff --git a/src/messages/MMDSFindIno.h b/src/messages/MMDSFindIno.h
index 06db7914138..2d0cd8c6c69 100644
--- a/src/messages/MMDSFindIno.h
+++ b/src/messages/MMDSFindIno.h
@@ -18,7 +18,10 @@
#include "msg/Message.h"
#include "include/filepath.h"
-struct MMDSFindIno : public Message {
+class MMDSFindIno : public Message {
+public:
+ typedef boost::intrusive_ptr<MMDSFindIno> ref;
+ typedef boost::intrusive_ptr<MMDSFindIno const> const_ref;
ceph_tid_t tid {0};
inodeno_t ino;
diff --git a/src/messages/MMDSFindInoReply.h b/src/messages/MMDSFindInoReply.h
index 46eef3f7775..4680dd90d8a 100644
--- a/src/messages/MMDSFindInoReply.h
+++ b/src/messages/MMDSFindInoReply.h
@@ -18,7 +18,10 @@
#include "msg/Message.h"
#include "include/filepath.h"
-struct MMDSFindInoReply : public Message {
+class MMDSFindInoReply : public Message {
+public:
+ typedef boost::intrusive_ptr<MMDSFindInoReply> ref;
+ typedef boost::intrusive_ptr<MMDSFindInoReply const> const_ref;
ceph_tid_t tid = 0;
filepath path;
diff --git a/src/messages/MMDSFragmentNotify.h b/src/messages/MMDSFragmentNotify.h
index f60909649bd..650bba7d0eb 100644
--- a/src/messages/MMDSFragmentNotify.h
+++ b/src/messages/MMDSFragmentNotify.h
@@ -23,9 +23,11 @@ class MMDSFragmentNotify : public Message {
int8_t bits = 0;
public:
- inodeno_t get_ino() { return ino; }
- frag_t get_basefrag() { return basefrag; }
- int get_bits() { return bits; }
+ typedef boost::intrusive_ptr<MMDSFragmentNotify> ref;
+ typedef boost::intrusive_ptr<MMDSFragmentNotify const> const_ref;
+ inodeno_t get_ino() const { return ino; }
+ frag_t get_basefrag() const { return basefrag; }
+ int get_bits() const { return bits; }
bufferlist basebl;
diff --git a/src/messages/MMDSMap.h b/src/messages/MMDSMap.h
index fea57ee7a22..7f9f764d692 100644
--- a/src/messages/MMDSMap.h
+++ b/src/messages/MMDSMap.h
@@ -24,21 +24,23 @@ class MMDSMap : public Message {
static const int HEAD_VERSION = 1;
static const int COMPAT_VERSION = 1;
public:
+ typedef boost::intrusive_ptr<MMDSMap> ref;
+ typedef boost::intrusive_ptr<MMDSMap const> const_ref;
uuid_d fsid;
epoch_t epoch = 0;
bufferlist encoded;
version_t get_epoch() const { return epoch; }
- bufferlist& get_encoded() { return encoded; }
+ const bufferlist& get_encoded() const { return encoded; }
MMDSMap() :
Message(CEPH_MSG_MDS_MAP, HEAD_VERSION, COMPAT_VERSION) {}
- MMDSMap(const uuid_d &f, const MDSMap *mm) :
+ MMDSMap(const uuid_d &f, const MDSMap &mm) :
Message(CEPH_MSG_MDS_MAP, HEAD_VERSION, COMPAT_VERSION),
fsid(f) {
- epoch = mm->get_epoch();
- mm->encode(encoded, -1); // we will reencode with fewer features as necessary
+ epoch = mm.get_epoch();
+ mm.encode(encoded, -1); // we will reencode with fewer features as necessary
}
private:
~MMDSMap() override {}
diff --git a/src/messages/MMDSOpenIno.h b/src/messages/MMDSOpenIno.h
index ea9d67cd8f3..a7f775302bb 100644
--- a/src/messages/MMDSOpenIno.h
+++ b/src/messages/MMDSOpenIno.h
@@ -18,6 +18,9 @@
#include "msg/Message.h"
struct MMDSOpenIno : public Message {
+public:
+ typedef boost::intrusive_ptr<MMDSOpenIno> ref;
+ typedef boost::intrusive_ptr<MMDSOpenIno const> const_ref;
inodeno_t ino;
vector<inode_backpointer_t> ancestors;
diff --git a/src/messages/MMDSOpenInoReply.h b/src/messages/MMDSOpenInoReply.h
index b52e33e341d..555b9fd33c6 100644
--- a/src/messages/MMDSOpenInoReply.h
+++ b/src/messages/MMDSOpenInoReply.h
@@ -17,7 +17,11 @@
#include "msg/Message.h"
-struct MMDSOpenInoReply : public Message {
+class MMDSOpenInoReply : public Message {
+public:
+ typedef boost::intrusive_ptr<MMDSOpenInoReply> ref;
+ typedef boost::intrusive_ptr<MMDSOpenInoReply const> const_ref;
+
inodeno_t ino;
vector<inode_backpointer_t> ancestors;
mds_rank_t hint;
diff --git a/src/messages/MMDSResolve.h b/src/messages/MMDSResolve.h
index a158a0c83db..65de1f31331 100644
--- a/src/messages/MMDSResolve.h
+++ b/src/messages/MMDSResolve.h
@@ -21,6 +21,8 @@
class MMDSResolve : public Message {
public:
+ typedef boost::intrusive_ptr<MMDSResolve> ref;
+ typedef boost::intrusive_ptr<MMDSResolve const> const_ref;
map<dirfrag_t, vector<dirfrag_t> > subtrees;
map<dirfrag_t, vector<dirfrag_t> > ambiguous_imports;
diff --git a/src/messages/MMDSResolveAck.h b/src/messages/MMDSResolveAck.h
index 38b288523bd..68cd164124d 100644
--- a/src/messages/MMDSResolveAck.h
+++ b/src/messages/MMDSResolveAck.h
@@ -22,6 +22,8 @@
class MMDSResolveAck : public Message {
public:
+ typedef boost::intrusive_ptr<MMDSResolveAck> ref;
+ typedef boost::intrusive_ptr<MMDSResolveAck const> const_ref;
map<metareqid_t, bufferlist> commit;
vector<metareqid_t> abort;
diff --git a/src/messages/MMDSSlaveRequest.h b/src/messages/MMDSSlaveRequest.h
index 78ef3c87120..2b688921e1c 100644
--- a/src/messages/MMDSSlaveRequest.h
+++ b/src/messages/MMDSSlaveRequest.h
@@ -21,6 +21,8 @@
class MMDSSlaveRequest : public Message {
public:
+ typedef boost::intrusive_ptr<MMDSSlaveRequest> ref;
+ typedef boost::intrusive_ptr<MMDSSlaveRequest const> const_ref;
static const int OP_XLOCK = 1;
static const int OP_XLOCKACK = -1;
static const int OP_UNXLOCK = 2;
@@ -53,7 +55,7 @@ class MMDSSlaveRequest : public Message {
//static const int OP_COMMIT = 21; // used for recovery only
- const static char *get_opname(int o) {
+ static const char *get_opname(int o) {
switch (o) {
case OP_XLOCK: return "xlock";
case OP_XLOCKACK: return "xlock_ack";
@@ -94,7 +96,7 @@ class MMDSSlaveRequest : public Message {
metareqid_t reqid;
__u32 attempt;
__s16 op;
- __u16 flags;
+ mutable __u16 flags; /* XXX HACK for mark_interrupted */
static const unsigned FLAG_NONBLOCK = 1<<0;
static const unsigned FLAG_WOULDBLOCK = 1<<1;
@@ -120,35 +122,39 @@ class MMDSSlaveRequest : public Message {
mds_rank_t srcdn_auth;
utime_t op_stamp;
- bufferlist straybl; // stray dir + dentry
+ mutable bufferlist straybl; // stray dir + dentry
bufferlist srci_snapbl;
bufferlist desti_snapbl;
public:
- metareqid_t get_reqid() { return reqid; }
+ metareqid_t get_reqid() const { return reqid; }
__u32 get_attempt() const { return attempt; }
- int get_op() { return op; }
- bool is_reply() { return op < 0; }
+ int get_op() const { return op; }
+ bool is_reply() const { return op < 0; }
- int get_lock_type() { return lock_type; }
+ int get_lock_type() const { return lock_type; }
+ const MDSCacheObjectInfo &get_object_info() const { return object_info; }
MDSCacheObjectInfo &get_object_info() { return object_info; }
+ const MDSCacheObjectInfo &get_authpin_freeze() const { return object_info; }
MDSCacheObjectInfo &get_authpin_freeze() { return object_info; }
+ const vector<MDSCacheObjectInfo>& get_authpins() const { return authpins; }
vector<MDSCacheObjectInfo>& get_authpins() { return authpins; }
void mark_nonblock() { flags |= FLAG_NONBLOCK; }
- bool is_nonblock() { return (flags & FLAG_NONBLOCK); }
+ bool is_nonblock() const { return (flags & FLAG_NONBLOCK); }
void mark_error_wouldblock() { flags |= FLAG_WOULDBLOCK; }
- bool is_error_wouldblock() { return (flags & FLAG_WOULDBLOCK); }
+ bool is_error_wouldblock() const { return (flags & FLAG_WOULDBLOCK); }
void mark_not_journaled() { flags |= FLAG_NOTJOURNALED; }
- bool is_not_journaled() { return (flags & FLAG_NOTJOURNALED); }
+ bool is_not_journaled() const { return (flags & FLAG_NOTJOURNALED); }
void mark_error_rofs() { flags |= FLAG_EROFS; }
- bool is_error_rofs() { return (flags & FLAG_EROFS); }
- bool is_abort() { return (flags & FLAG_ABORT); }
+ bool is_error_rofs() const { return (flags & FLAG_EROFS); }
+ bool is_abort() const { return (flags & FLAG_ABORT); }
void mark_abort() { flags |= FLAG_ABORT; }
- bool is_interrupted() { return (flags & FLAG_INTERRUPTED); }
- void mark_interrupted() { flags |= FLAG_INTERRUPTED; }
+ bool is_interrupted() const { return (flags & FLAG_INTERRUPTED); }
+ void mark_interrupted() const { flags |= FLAG_INTERRUPTED; }
void set_lock_type(int t) { lock_type = t; }
+ const bufferlist& get_lock_data() const { return inode_export; }
bufferlist& get_lock_data() { return inode_export; }
diff --git a/src/messages/MMDSSnapUpdate.h b/src/messages/MMDSSnapUpdate.h
index 2e132c1e362..0c848ca0382 100644
--- a/src/messages/MMDSSnapUpdate.h
+++ b/src/messages/MMDSSnapUpdate.h
@@ -22,8 +22,10 @@ class MMDSSnapUpdate : public Message {
__s16 snap_op;
public:
- inodeno_t get_ino() { return ino; }
- int get_snap_op() { return snap_op; }
+ typedef boost::intrusive_ptr<MMDSSnapUpdate> ref;
+ typedef boost::intrusive_ptr<MMDSSnapUpdate const> const_ref;
+ inodeno_t get_ino() const { return ino; }
+ int get_snap_op() const { return snap_op; }
bufferlist snap_blob;
diff --git a/src/messages/MMDSTableRequest.h b/src/messages/MMDSTableRequest.h
index 13355bdccf6..cac5d33f822 100644
--- a/src/messages/MMDSTableRequest.h
+++ b/src/messages/MMDSTableRequest.h
@@ -21,6 +21,9 @@
class MMDSTableRequest : public Message {
public:
+ typedef boost::intrusive_ptr<MMDSTableRequest> ref;
+ typedef boost::intrusive_ptr<MMDSTableRequest const> const_ref;
+
__u16 table = 0;
__s16 op = 0;
uint64_t reqid = 0;