From bf7b84c951edbc2c799f66071ca748905341416f Mon Sep 17 00:00:00 2001 From: John Spray Date: Tue, 25 Mar 2014 13:31:03 +0000 Subject: [PATCH] mds: Add get_metablob to LogEvent Previously the only way to get at the payload of things like EUpdate and EOpen was to replay() them (required a full running MDS) or to use downcasting (yuck). Signed-off-by: John Spray --- src/mds/LogEvent.h | 7 ++++++- src/mds/events/EOpen.h | 1 + src/mds/events/EUpdate.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mds/LogEvent.h b/src/mds/LogEvent.h index 97a4233da6d24..1245d256cd19d 100644 --- a/src/mds/LogEvent.h +++ b/src/mds/LogEvent.h @@ -48,6 +48,7 @@ class MDS; class LogSegment; +class EMetaBlob; // generic log event class LogEvent { @@ -106,7 +107,11 @@ protected: */ virtual void replay(MDS *m) { assert(0); } - + /** + * If the subclass embeds a MetaBlob, return it here so that + * tools can examine metablobs while traversing lists of LogEvent. + */ + virtual EMetaBlob *get_metablob() {return NULL;} }; inline ostream& operator<<(ostream& out, LogEvent& le) { diff --git a/src/mds/events/EOpen.h b/src/mds/events/EOpen.h index 1267cf0af72f1..baf93344a230d 100644 --- a/src/mds/events/EOpen.h +++ b/src/mds/events/EOpen.h @@ -49,6 +49,7 @@ public: void update_segment(); void replay(MDS *mds); + EMetaBlob *get_metablob() {return &metablob;} }; #endif diff --git a/src/mds/events/EUpdate.h b/src/mds/events/EUpdate.h index 645386e2511fd..d0be0a4f28bcc 100644 --- a/src/mds/events/EUpdate.h +++ b/src/mds/events/EUpdate.h @@ -45,6 +45,7 @@ public: void update_segment(); void replay(MDS *mds); + EMetaBlob *get_metablob() {return &metablob;} }; #endif -- 2.39.5