mirror of
https://github.com/ceph/ceph
synced 2024-12-18 01:16:55 +00:00
OSDMap: add primary out params to internal _pg_to_up_acting_osds function
And use pointers instead of references for out params. Now pg_to_up_acting_osds and pg_to_acting_osds can plug in to this slightly more real implementation, instead of making up their own. (We are still just using the first member anyway, but we're about to plug it into the bottom layer of functions.) Signed-off-by: Greg Farnum <greg@inktank.com>
This commit is contained in:
parent
1c750c65f5
commit
0c3050932b
@ -1324,17 +1324,22 @@ void OSDMap::pg_to_raw_up(pg_t pg, vector<int> *up, int *primary) const
|
||||
*primary = (up->empty() ? -1 : up->front());
|
||||
}
|
||||
|
||||
void OSDMap::_pg_to_up_acting_osds(pg_t pg, vector<int> *up, vector<int>& acting) const
|
||||
void OSDMap::_pg_to_up_acting_osds(pg_t pg, vector<int> *up, int *up_primary,
|
||||
vector<int> *acting, int *acting_primary) const
|
||||
{
|
||||
const pg_pool_t *pool = get_pg_pool(pg.pool());
|
||||
if (!pool)
|
||||
return;
|
||||
vector<int> raw;
|
||||
vector<int> *_up = (up ? up : new vector<int>);
|
||||
_pg_to_osds(*pool, pg, raw);
|
||||
_raw_to_up_osds(pg, raw, *up);
|
||||
if (!_get_temp_osds(*pool, pg, acting))
|
||||
acting = *_up;
|
||||
_pg_to_osds(*pool, pg, *raw);
|
||||
_raw_to_up_osds(pg, raw, *_up);
|
||||
if (up_primary)
|
||||
*up_primary = (_up->empty() ? -1 : _up->front());
|
||||
if (acting && !_get_temp_osds(*pool, pg, *acting))
|
||||
*acting = *_up;
|
||||
if (acting_primary)
|
||||
*acting_primary = (acting->empty() ? -1 : acting->front());
|
||||
if (_up != up)
|
||||
delete _up;
|
||||
}
|
||||
|
@ -513,9 +513,12 @@ private:
|
||||
|
||||
bool _get_temp_osds(const pg_pool_t& pool, pg_t pg, vector<int>& temp) const;
|
||||
|
||||
/// map to up and acting. Only provides up if pointer is non-NULL
|
||||
void _pg_to_up_acting_osds(pg_t pg, vector<int> *up,
|
||||
vector<int>& acting) const;
|
||||
/**
|
||||
* map to up and acting. Fills in whatever fields are non-NULL, but
|
||||
* the passed-in vectors must be empty.
|
||||
*/
|
||||
void _pg_to_up_acting_osds(pg_t pg, vector<int> *up, int *up_primary,
|
||||
vector<int> *acting, int *acting_primary) const;
|
||||
|
||||
public:
|
||||
/***
|
||||
@ -528,8 +531,7 @@ public:
|
||||
/// map a pg to its acting set. @return acting set size
|
||||
int pg_to_acting_osds(pg_t pg, vector<int> *acting,
|
||||
int *acting_primary) const {
|
||||
_pg_to_up_acting_osds(pg, NULL, *acting);
|
||||
*acting_primary = (acting->empty() ? -1 : acting->front());
|
||||
_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 {
|
||||
@ -552,9 +554,7 @@ public:
|
||||
*/
|
||||
void pg_to_up_acting_osds(pg_t pg, vector<int> *up, int *up_primary,
|
||||
vector<int> *acting, int *acting_primary) const {
|
||||
_pg_to_up_acting_osds(pg, up, *acting);
|
||||
*up_primary = (up->empty() ? -1 : up.front());
|
||||
*acting_primary = (acting->empty() ? -1 : acting.front());
|
||||
_pg_to_up_acting_osds(pg, up, up_primary, acting, acting_primary);
|
||||
}
|
||||
void pg_to_up_acting_osds(pg_t pg, vector<int>& up, vector<int>& acting) const {
|
||||
int up_primary, acting_primary;
|
||||
|
Loading…
Reference in New Issue
Block a user