Skip to content

Commit d27b115

Browse files
committed
mds: add warning about encoding new fields
It's never a good idea to put new fields in the middle of other encoded values unless you're willing to break all backwards-compatibility. Signed-off-by: Patrick Donnelly <[email protected]>
1 parent 6db8780 commit d27b115

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/mds/CDentry.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ void CDentry::encode_remote(inodeno_t& ino, unsigned char d_type,
568568

569569
// marker, name, ino
570570
ENCODE_START(2, 1, bl);
571+
// WARNING: always put new fields at the end of bl
571572
encode(ino, bl);
572573
encode(d_type, bl);
573574
encode(alternate_name, bl);

src/mds/CDir.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2506,6 +2506,7 @@ void CDir::_omap_commit_ops(int r, int op_prio, int64_t metapool, version_t vers
25062506
bl.append('i'); // inode
25072507

25082508
ENCODE_START(2, 1, bl);
2509+
// WARNING: always put new fields at the end of bl
25092510
encode(item.alternate_name, bl);
25102511
_encode_primary_inode_base(item, dfts, bl);
25112512
ENCODE_FINISH(bl);

0 commit comments

Comments
 (0)