summaryrefslogtreecommitdiff
path: root/src/mds
diff options
context:
space:
mode:
authorSage Weil <sage.weil@dreamhost.com>2012-02-22 21:24:27 -0800
committerSage Weil <sage.weil@dreamhost.com>2012-02-22 21:24:27 -0800
commit3628f901d471a484ca6c1e22c6f8601af95cd205 (patch)
treee805db31a13d8870efb434e0df4feda51927ad15 /src/mds
parent7842bb50c7814cc16c22589bf41df7db1f7492eb (diff)
downloadceph-3628f901d471a484ca6c1e22c6f8601af95cd205.tar.gz
mds: make EMetaBlob::fullbit::old_inodes non-ptr
No need to put this separately on the heap, as a static map<> isn't much more expensive than a pointer. Also, this ensures we unconditonally reset in->old_inodes to a potentially empty value if we replay the same inode multiple times and lose old inodes in subsequent versions. Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
Diffstat (limited to 'src/mds')
-rw-r--r--src/mds/events/EMetaBlob.h12
-rw-r--r--src/mds/journal.cc3
2 files changed, 6 insertions, 9 deletions
diff --git a/src/mds/events/EMetaBlob.h b/src/mds/events/EMetaBlob.h
index 747bff36ce1..c8e1db21d42 100644
--- a/src/mds/events/EMetaBlob.h
+++ b/src/mds/events/EMetaBlob.h
@@ -69,7 +69,7 @@ public:
bool dirty;
struct default_file_layout *dir_layout;
typedef map<snapid_t, old_inode_t> old_inodes_t;
- old_inodes_t *old_inodes;
+ old_inodes_t old_inodes;
bufferlist _enc;
@@ -83,7 +83,7 @@ public:
old_inodes_t *oi = NULL) :
//dn(d), dnfirst(df), dnlast(dl), dnv(v),
//inode(i), dirfragtree(dft), xattrs(xa), symlink(sym), snapbl(sbl), dirty(dr)
- dir_layout(NULL), old_inodes(NULL), _enc(1024)
+ dir_layout(NULL), _enc(1024)
{
::encode(d, _enc);
::encode(df, _enc);
@@ -105,12 +105,11 @@ public:
if (oi)
::encode(*oi, _enc);
}
- fullbit(bufferlist::iterator &p) : dir_layout(NULL), old_inodes(NULL) {
+ fullbit(bufferlist::iterator &p) : dir_layout(NULL) {
decode(p);
}
- fullbit() : dir_layout(NULL), old_inodes(NULL) {}
+ fullbit() : dir_layout(NULL) {}
~fullbit() {
- delete old_inodes;
delete dir_layout;
}
@@ -148,8 +147,7 @@ public:
bool old_inodes_present;
::decode(old_inodes_present, bl);
if (old_inodes_present) {
- old_inodes = new old_inodes_t;
- ::decode(*old_inodes, bl);
+ ::decode(old_inodes, bl);
}
}
}
diff --git a/src/mds/journal.cc b/src/mds/journal.cc
index fd45213e5f2..c35a33e7219 100644
--- a/src/mds/journal.cc
+++ b/src/mds/journal.cc
@@ -416,8 +416,7 @@ void EMetaBlob::fullbit::update_inode(MDS *mds, CInode *in)
} else if (in->inode.is_symlink()) {
in->symlink = symlink;
}
- if (old_inodes)
- in->old_inodes = *old_inodes;
+ in->old_inodes = old_inodes;
}
void EMetaBlob::replay(MDS *mds, LogSegment *logseg)