summaryrefslogtreecommitdiffstats
path: root/src/osd
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/OSDMap.cc13
-rw-r--r--src/osd/OSDMap.h21
-rw-r--r--src/osd/PG.cc1
-rw-r--r--src/osd/PrimaryLogPG.cc10
-rw-r--r--src/osd/osd_types.cc12
-rw-r--r--src/osd/osd_types.h4
6 files changed, 31 insertions, 30 deletions
diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc
index 67f9e5cd1d7..dead2fd616e 100644
--- a/src/osd/OSDMap.cc
+++ b/src/osd/OSDMap.cc
@@ -1870,7 +1870,7 @@ void OSDMap::_remove_nonexistent_osds(const pg_pool_t& pool,
}
}
-int OSDMap::_pg_to_raw_osds(
+void OSDMap::_pg_to_raw_osds(
const pg_pool_t& pool, pg_t pg,
vector<int> *osds,
ps_t *ppps) const
@@ -1888,8 +1888,6 @@ int OSDMap::_pg_to_raw_osds(
if (ppps)
*ppps = pps;
-
- return osds->size();
}
int OSDMap::_pick_primary(const vector<int>& osds) const
@@ -2062,17 +2060,16 @@ void OSDMap::_get_temp_osds(const pg_pool_t& pool, pg_t pg,
}
}
-int OSDMap::pg_to_raw_osds(pg_t pg, vector<int> *raw, int *primary) const
+void OSDMap::pg_to_raw_osds(pg_t pg, vector<int> *raw, int *primary) const
{
*primary = -1;
raw->clear();
const pg_pool_t *pool = get_pg_pool(pg.pool());
if (!pool)
- return 0;
- int r = _pg_to_raw_osds(*pool, pg, raw, NULL);
+ return;
+ _pg_to_raw_osds(*pool, pg, raw, NULL);
if (primary)
*primary = _pick_primary(*raw);
- return r;
}
void OSDMap::pg_to_raw_up(pg_t pg, vector<int> *up, int *primary) const
@@ -2093,7 +2090,7 @@ void OSDMap::pg_to_raw_up(pg_t pg, vector<int> *up, int *primary) const
*primary = _pick_primary(raw);
_apply_primary_affinity(pps, *pool, up, primary);
}
-
+
void OSDMap::_pg_to_up_acting_osds(
const pg_t& pg, vector<int> *up, int *up_primary,
vector<int> *acting, int *acting_primary,
diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h
index 84bcf2fb756..a4b124d938d 100644
--- a/src/osd/OSDMap.h
+++ b/src/osd/OSDMap.h
@@ -996,7 +996,7 @@ public:
private:
/// pg -> (raw osd list)
- int _pg_to_raw_osds(
+ void _pg_to_raw_osds(
const pg_pool_t& pool, pg_t pg,
vector<int> *osds,
ps_t *ppps) const;
@@ -1037,14 +1037,13 @@ public:
* by anybody for data mapping purposes.
* raw and primary must be non-NULL
*/
- int pg_to_raw_osds(pg_t pg, vector<int> *raw, int *primary) const;
+ void pg_to_raw_osds(pg_t pg, vector<int> *raw, int *primary) const;
/// map a pg to its acting set. @return acting set size
- int pg_to_acting_osds(const pg_t& pg, vector<int> *acting,
+ void pg_to_acting_osds(const pg_t& pg, vector<int> *acting,
int *acting_primary) const {
_pg_to_up_acting_osds(pg, NULL, NULL, acting, acting_primary);
- return acting->size();
}
- int pg_to_acting_osds(pg_t pg, vector<int>& acting) const {
+ void pg_to_acting_osds(pg_t pg, vector<int>& acting) const {
return pg_to_acting_osds(pg, &acting, NULL);
}
/**
@@ -1180,26 +1179,26 @@ public:
/* rank is -1 (stray), 0 (primary), 1,2,3,... (replica) */
int get_pg_acting_rank(pg_t pg, int osd) const {
vector<int> group;
- int nrep = pg_to_acting_osds(pg, group);
- return calc_pg_rank(osd, group, nrep);
+ pg_to_acting_osds(pg, group);
+ return calc_pg_rank(osd, group, group.size());
}
/* role is -1 (stray), 0 (primary), 1 (replica) */
int get_pg_acting_role(const pg_t& pg, int osd) const {
vector<int> group;
- int nrep = pg_to_acting_osds(pg, group);
- return calc_pg_role(osd, group, nrep);
+ pg_to_acting_osds(pg, group);
+ return calc_pg_role(osd, group, group.size());
}
bool osd_is_valid_op_target(pg_t pg, int osd) const {
int primary;
vector<int> group;
- int nrep = pg_to_acting_osds(pg, &group, &primary);
+ pg_to_acting_osds(pg, &group, &primary);
if (osd == primary)
return true;
if (pg_is_ec(pg))
return false;
- return calc_pg_role(osd, group, nrep) >= 0;
+ return calc_pg_role(osd, group, group.size()) >= 0;
}
int clean_pg_upmaps(
diff --git a/src/osd/PG.cc b/src/osd/PG.cc
index c186548a6c6..cea01f32002 100644
--- a/src/osd/PG.cc
+++ b/src/osd/PG.cc
@@ -799,7 +799,6 @@ void PG::check_past_interval_bounds() const
derr << info.pgid << " required past_interval bounds are"
<< " empty [" << rpib << ") but past_intervals is not: "
<< past_intervals << dendl;
- assert(past_intervals.empty());
}
} else {
if (past_intervals.empty()) {
diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc
index bb578d8447b..8f8ef6ce292 100644
--- a/src/osd/PrimaryLogPG.cc
+++ b/src/osd/PrimaryLogPG.cc
@@ -3768,7 +3768,7 @@ PrimaryLogPG::OpContextUPtr PrimaryLogPG::trim_object(
old_snaps,
new_snaps);
- obc->obs.oi = object_info_t(coid);
+ coi = object_info_t(coid);
ctx->at_version.version++;
} else {
@@ -3838,20 +3838,19 @@ PrimaryLogPG::OpContextUPtr PrimaryLogPG::trim_object(
ctx->delta_stats.num_objects--;
if (oi.is_dirty()) {
ctx->delta_stats.num_objects_dirty--;
- oi.clear_flag(object_info_t::FLAG_DIRTY);
}
if (oi.is_omap())
ctx->delta_stats.num_objects_omap--;
if (oi.is_whiteout()) {
dout(20) << __func__ << " trimming whiteout on " << oi.soid << dendl;
ctx->delta_stats.num_whiteouts--;
- oi.clear_flag(object_info_t::FLAG_WHITEOUT);
}
- if (oi.is_cache_pinned())
+ if (oi.is_cache_pinned()) {
ctx->delta_stats.num_objects_pinned--;
+ }
}
ctx->snapset_obc->obs.exists = false;
- obc->obs.oi = object_info_t(coid);
+ ctx->snapset_obc->obs.oi = object_info_t(snapoid);
t->remove(snapoid);
} else {
dout(10) << coid << " filtering snapset on " << snapoid << dendl;
@@ -5961,6 +5960,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
result = -EINVAL;
break;
}
+ oi.set_flag(object_info_t::FLAG_MANIFEST);
oi.manifest.redirect_target = target;
oi.manifest.type = object_manifest_t::TYPE_REDIRECT;
t->truncate(soid, 0);
diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc
index dcfe790567f..e2846c65da7 100644
--- a/src/osd/osd_types.cc
+++ b/src/osd/osd_types.cc
@@ -1581,7 +1581,7 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const
void pg_pool_t::decode(bufferlist::iterator& bl)
{
- DECODE_START_LEGACY_COMPAT_LEN(24, 5, 5, bl);
+ DECODE_START_LEGACY_COMPAT_LEN(25, 5, 5, bl);
::decode(type, bl);
::decode(size, bl);
::decode(crush_ruleset, bl);
@@ -5057,14 +5057,16 @@ void object_info_t::encode(bufferlist& bl, uint64_t features) const
::encode(expected_object_size, bl);
::encode(expected_write_size, bl);
::encode(alloc_hint_flags, bl);
- ::encode(manifest, bl);
+ if (has_manifest()) {
+ ::encode(manifest, bl);
+ }
ENCODE_FINISH(bl);
}
void object_info_t::decode(bufferlist::iterator& bl)
{
object_locator_t myoloc;
- DECODE_START_LEGACY_COMPAT_LEN(16, 8, 8, bl);
+ DECODE_START_LEGACY_COMPAT_LEN(17, 8, 8, bl);
map<entity_name_t, watch_info_t> old_watchers;
::decode(soid, bl);
::decode(myoloc, bl);
@@ -5147,7 +5149,9 @@ void object_info_t::decode(bufferlist::iterator& bl)
alloc_hint_flags = 0;
}
if (struct_v >= 17) {
- ::decode(manifest, bl);
+ if (has_manifest()) {
+ ::decode(manifest, bl);
+ }
}
DECODE_FINISH(bl);
}
diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h
index 3e2128e414e..124e40c82aa 100644
--- a/src/osd/osd_types.h
+++ b/src/osd/osd_types.h
@@ -4508,6 +4508,8 @@ struct object_info_t {
s += "|omap_digest";
if (flags & FLAG_CACHE_PIN)
s += "|cache_pin";
+ if (flags & FLAG_MANIFEST)
+ s += "|manifest";
if (s.length())
return s.substr(1);
return s;
@@ -4569,7 +4571,7 @@ struct object_info_t {
return test_flag(FLAG_CACHE_PIN);
}
bool has_manifest() const {
- return !manifest.is_empty();
+ return test_flag(FLAG_MANIFEST);
}
void set_data_digest(__u32 d) {