diff options
author | David Zafman <david.zafman@inktank.com> | 2013-09-25 09:19:16 -0700 |
---|---|---|
committer | David Zafman <david.zafman@inktank.com> | 2013-09-25 11:25:21 -0700 |
commit | fed06a7d038879bb39d9634dfa4d866b65f5a1d1 (patch) | |
tree | e665b3e247cd040b0e4fdb0b9837e1430ee34d73 /src/os/FileStore.h | |
parent | a0379725851c92b0ea9bb56990a1a62f43cdbdba (diff) | |
download | ceph-wip-compat-cuttlefish.tar.gz |
os, osd, tools: Add backportable compatibility checking for sharded objectswip-compat-cuttlefish
OSD
New CEPH_OSD_FEATURE_INCOMPAT_SHARDS
FileStore
NEW CEPH_FS_FEATURE_INCOMPAT_SHARDS
Add FSSuperblock with feature CompatSet in it
Store sharded_objects state using CompatSet
Add set_allow_sharded_objects() and get_allow_sharded_objects() to FileStore/ObjectStore
Add read_superblock()/write_superblock() internal filestore functions
ceph_filestore_dump
Add OSDsuperblock to export format
Use CompatSet from OSD code itself in filestore-dump tool
Always check compatibility of OSD features with on-disk features
On import verify compatibility of on-disk features with export data
Bump super_ver due to export format change
Backport: dumpling, cuttlefish
Signed-off-by: David Zafman <david.zafman@inktank.com>
(cherry picked from commit 5b70c2b0108f744c171364f26475fb7baaa8b6fe)
Conflicts:
src/os/FileStore.cc
src/os/FileStore.h
src/osd/OSD.cc
src/osd/OSD.h
Diffstat (limited to 'src/os/FileStore.h')
-rw-r--r-- | src/os/FileStore.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/os/FileStore.h b/src/os/FileStore.h index e4f7e81a502..a8aacbf5373 100644 --- a/src/os/FileStore.h +++ b/src/os/FileStore.h @@ -49,6 +49,26 @@ using namespace __gnu_cxx; # define FALLOC_FL_PUNCH_HOLE 0x2 #endif +#define CEPH_FS_FEATURE_INCOMPAT_SHARDS CompatSet::Feature(1, "sharded objects") + +class FSSuperblock { +public: + CompatSet compat_features; + + FSSuperblock() { } + + void encode(bufferlist &bl) const; + void decode(bufferlist::iterator &bl); + void dump(Formatter *f) const; + static void generate_test_instances(list<FSSuperblock*>& o); +}; +WRITE_CLASS_ENCODER(FSSuperblock) + +inline ostream& operator<<(ostream& out, const FSSuperblock& sb) +{ + return out << "sb(" << sb.compat_features << ")"; +} + class FileStore : public JournalingObjectStore, public md_config_obs_t { @@ -303,6 +323,8 @@ public: int get_max_object_name_length(); int mkfs(); int mkjournal(); + void set_allow_sharded_objects(); + bool get_allow_sharded_objects(); int statfs(struct statfs *buf); @@ -538,6 +560,10 @@ private: std::ofstream m_filestore_dump; JSONFormatter m_filestore_dump_fmt; atomic_t m_filestore_kill_at; + FSSuperblock superblock; + + int write_superblock(); + int read_superblock(); }; ostream& operator<<(ostream& out, const FileStore::OpSequencer& s); |