summaryrefslogtreecommitdiffstats
path: root/src/mds/journal.cc
diff options
context:
space:
mode:
authorYan, Zheng <zheng.z.yan@intel.com>2014-06-27 08:08:54 +0200
committerYan, Zheng <zheng.z.yan@intel.com>2014-06-27 09:45:56 +0200
commit55ed85b194659d56c715b24f4b407a4020b0361b (patch)
tree264d892e6a9faee1b550b4607895c57fd69c2ea9 /src/mds/journal.cc
parentmds: add get_metablob() to log events (diff)
downloadceph-55ed85b194659d56c715b24f4b407a4020b0361b.tar.xz
ceph-55ed85b194659d56c715b24f4b407a4020b0361b.zip
mds: introduce sequence number for log events
Use the sequence number to index log segments. Later commit will defer encoding/submitting log events to separate thread, log events' offsets are unknown before they are encoded. Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Diffstat (limited to 'src/mds/journal.cc')
-rw-r--r--src/mds/journal.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mds/journal.cc b/src/mds/journal.cc
index 5a3d1045b49..1db55d11e6a 100644
--- a/src/mds/journal.cc
+++ b/src/mds/journal.cc
@@ -291,10 +291,8 @@ void LogSegment::try_to_expire(MDS *mds, C_GatherBuilder &gather_bld, int op_pri
// EMetaBlob
EMetaBlob::EMetaBlob(MDLog *mdlog) : opened_ino(0), renamed_dirino(0),
- inotablev(0), sessionmapv(0),
- allocated_ino(0),
- last_subtree_map(mdlog ? mdlog->get_last_segment_offset() : 0),
- my_offset(mdlog ? mdlog->get_write_pos() : 0) //, _segment(0)
+ inotablev(0), sessionmapv(0), allocated_ino(0),
+ last_subtree_map(0), event_seq(0)
{ }
void EMetaBlob::add_dir_context(CDir *dir, int mode)
@@ -339,7 +337,7 @@ void EMetaBlob::add_dir_context(CDir *dir, int mode)
}
// was the inode journaled in this blob?
- if (my_offset && diri->last_journaled == my_offset) {
+ if (event_seq && diri->last_journaled == event_seq) {
dout(20) << "EMetaBlob::add_dir_context(" << dir << ") already have diri this blob " << *diri << dendl;
break;
}
@@ -2415,18 +2413,19 @@ void ESlaveUpdate::replay(MDS *mds)
void ESubtreeMap::encode(bufferlist& bl) const
{
- ENCODE_START(5, 5, bl);
+ ENCODE_START(6, 5, bl);
::encode(stamp, bl);
::encode(metablob, bl);
::encode(subtrees, bl);
::encode(ambiguous_subtrees, bl);
::encode(expire_pos, bl);
+ ::encode(event_seq, bl);
ENCODE_FINISH(bl);
}
void ESubtreeMap::decode(bufferlist::iterator &bl)
{
- DECODE_START_LEGACY_COMPAT_LEN(5, 5, 5, bl);
+ DECODE_START_LEGACY_COMPAT_LEN(6, 5, 5, bl);
if (struct_v >= 2)
::decode(stamp, bl);
::decode(metablob, bl);
@@ -2435,6 +2434,8 @@ void ESubtreeMap::decode(bufferlist::iterator &bl)
::decode(ambiguous_subtrees, bl);
if (struct_v >= 3)
::decode(expire_pos, bl);
+ if (struct_v >= 6)
+ ::decode(event_seq, bl);
DECODE_FINISH(bl);
}