diff options
author | Xiubo Li <xiubli@redhat.com> | 2020-11-20 03:02:42 +0100 |
---|---|---|
committer | Patrick Donnelly <pdonnell@redhat.com> | 2021-01-16 02:30:39 +0100 |
commit | bd0b90ffbfe528c0f85100837ca1e7ab56e10b82 (patch) | |
tree | 75143eb848bae68abf53d3a0e76f8012e023ce69 /src/mds/CDentry.cc | |
parent | mds: add "fscrypt" flag support for inode_t (diff) | |
download | ceph-bd0b90ffbfe528c0f85100837ca1e7ab56e10b82.tar.xz ceph-bd0b90ffbfe528c0f85100837ca1e7ab56e10b82.zip |
mds: add static encode/decode helpers for remote in CDentry
This will unify all the same work in different places.
Fixes: https://tracker.ceph.com/issues/47162
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Diffstat (limited to 'src/mds/CDentry.cc')
-rw-r--r-- | src/mds/CDentry.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/mds/CDentry.cc b/src/mds/CDentry.cc index 335ee402fec..b674f8ba0d4 100644 --- a/src/mds/CDentry.cc +++ b/src/mds/CDentry.cc @@ -530,6 +530,31 @@ void CDentry::_put() } } +void CDentry::encode_remote(inodeno_t& ino, unsigned char d_type, bufferlist &bl) +{ + bl.append("l", 1); // remote link + + // marker, name, ino + ENCODE_START(1, 1, bl); + encode(ino, bl); + encode(d_type, bl); + ENCODE_FINISH(bl); +} + +void CDentry::decode_remote(char icode, inodeno_t& ino, unsigned char& d_type, + ceph::buffer::list::const_iterator& bl) +{ + if (icode == 'l') { + DECODE_START(1, bl); + decode(ino, bl); + decode(d_type, bl); + DECODE_FINISH(bl); + } else if (icode == 'L') { + decode(ino, bl); + decode(d_type, bl); + } else ceph_assert(0); +} + void CDentry::dump(Formatter *f) const { ceph_assert(f != NULL); |