summaryrefslogtreecommitdiff
path: root/src/osd/OSD.cc
diff options
context:
space:
mode:
authorDavid Zafman <david.zafman@inktank.com>2013-09-25 09:19:16 -0700
committerDavid Zafman <david.zafman@inktank.com>2013-09-25 11:25:21 -0700
commitfed06a7d038879bb39d9634dfa4d866b65f5a1d1 (patch)
treee665b3e247cd040b0e4fdb0b9837e1430ee34d73 /src/osd/OSD.cc
parenta0379725851c92b0ea9bb56990a1a62f43cdbdba (diff)
downloadceph-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/osd/OSD.cc')
-rw-r--r--src/osd/OSD.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc
index a93545d4437..1e91d5a2096 100644
--- a/src/osd/OSD.cc
+++ b/src/osd/OSD.cc
@@ -129,7 +129,9 @@ static ostream& _prefix(std::ostream* _dout, int whoami, OSDMapRef osdmap) {
const coll_t coll_t::META_COLL("meta");
-static CompatSet get_osd_compat_set() {
+//Initial features in new superblock.
+//Features here are also automatically upgraded
+CompatSet OSD::get_osd_initial_compat_set() {
CompatSet::FeatureSet ceph_osd_feature_compat;
CompatSet::FeatureSet ceph_osd_feature_ro_compat;
CompatSet::FeatureSet ceph_osd_feature_incompat;
@@ -147,6 +149,13 @@ static CompatSet get_osd_compat_set() {
ceph_osd_feature_incompat);
}
+//Features are added here that this OSD supports.
+CompatSet OSD::get_osd_compat_set() {
+ CompatSet compat = get_osd_initial_compat_set();
+ //Any features here can be set in code, but not in initial superblock
+ return compat;
+}
+
OSDService::OSDService(OSD *osd) :
osd(osd),
whoami(osd->whoami), store(osd->store), clog(osd->clog),
@@ -611,7 +620,7 @@ int OSD::mkfs(const std::string &dev, const std::string &jdev, uuid_d fsid, int
sb.cluster_fsid = fsid;
sb.osd_fsid = store->get_fsid();
sb.whoami = whoami;
- sb.compat_features = get_osd_compat_set();
+ sb.compat_features = get_osd_initial_compat_set();
// benchmark?
if (g_conf->osd_auto_weight) {
@@ -1080,11 +1089,12 @@ int OSD::init()
return r;
}
- if (osd_compat.compare(superblock.compat_features) != 0) {
+ CompatSet initial = get_osd_initial_compat_set();
+ if (initial.compare(superblock.compat_features) != 0) {
// We need to persist the new compat_set before we
// do anything else
dout(5) << "Upgrading superblock compat_set" << dendl;
- superblock.compat_features = osd_compat;
+ superblock.compat_features = initial;
ObjectStore::Transaction t;
write_superblock(t);
r = store->apply_transaction(t);