28 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CONF 41 #define CONF_PVER_VECTOR_LOG(owner, fid, vector) \ 42 M0_LOG(M0_DEBUG, owner"="FID_F" "#vector"=[%u %u %u %u %u]", fid, \ 43 vector[M0_CONF_PVER_LVL_SITES], \ 44 vector[M0_CONF_PVER_LVL_RACKS], \ 45 vector[M0_CONF_PVER_LVL_ENCLS], \ 46 vector[M0_CONF_PVER_LVL_CTRLS], \ 47 vector[M0_CONF_PVER_LVL_DRIVES]) 73 const uint32_t *allowance,
92 M0_CONF_ROOT_POOLS_FID, M0_CONF_ANY_FID,
93 M0_CONF_POOL_PVERS_FID, M0_CONF_ANY_FID);
95 for (
i = 0;
i <
rc; ++
i) {
98 pver->pv_u.formulaic.pvf_id == fpver_id) {
104 return rc == 0 ?
M0_ERR_INFO(-ENOENT,
"Formulaic pver with id=%u" 105 " is missing", fpver_id) :
M0_ERR(
rc);
119 pver->pv_u.subtree.pvs_recd);
127 const struct m0_fid *pver_to_skip,
143 if (pver_to_skip !=
NULL &&
208 const struct m0_fid *pver_to_skip,
284 const uint32_t *recd;
285 const uint32_t *allowance;
290 recd =
pver->pv_u.subtree.pvs_recd;
298 recd =
base->pv_u.subtree.pvs_recd;
299 allowance =
pver->pv_u.formulaic.pvf_allowance;
303 recd[
i] == allowance[
i]));
390 1ULL << (64 - 8 - 1),
391 cache->ca_fid_counter++);
422 uint64_t failures_cid;
452 const bool skip_sanity_check =
false;
458 if (objv->
cv_ix == 0) {
460 if (skip_sanity_check)
499 obj = m0_conf_dir_tlist_tail(&
base->pv_u.subtree.pvs_sitevs->cd_items);
503 return M0_ERR_INFO(-ENOENT,
"Cannot reach the rightmost" 504 " disk-v from "FID_F"; reached" 521 uint32_t *recd =
args;
576 +
base->pv_u.subtree.pvs_recd[
i]);
636 " compatible with allowance vector at" 653 const struct m0_fid *downlink;
676 if (downlink ==
NULL) {
707 }
while (
rc == -EINVAL);
727 const uint32_t *allowance,
746 base->pv_u.subtree.pvs_recd[
i] ==
759 pvsub = &
pver->pv_u.subtree;
817 const uint32_t *srecd)
824 tolerance =
pv->pv_u.subtree.pvs_tolerance[
i];
826 if (srecd[
i] > 0 && srecd[
i] == tolerance)
828 else if (srecd[
i] > tolerance) {
847 uint32_t failures = 0;
861 K =
pver->pv_u.subtree.pvs_attr.pa_K;
871 failures += srecd[
i++];
874 tolerance =
pver->pv_u.subtree.pvs_tolerance;
887 if (failures > 0 && failures < K &&
905 obj->co_deleted =
true;
920 #undef CONF_PVER_VECTOR_LOG 922 #undef M0_TRACE_SUBSYSTEM const struct m0_conf_obj_type * m0_conf_obj_type(const struct m0_conf_obj *obj)
struct m0_conf_obj * cc_root
#define M0_ALLOC_ARR(arr, nr)
const struct m0_conf_obj_type M0_CONF_OBJV_TYPE
#define m0_conf_glob_init(glob, flags, errfunc, cache, origin,...)
uint32_t bws_allowance[M0_CONF_PVER_HEIGHT]
struct m0_conf_dir * pvs_sitevs
M0_INTERNAL bool m0_conf_pver_is_clean(const struct m0_conf_pver *pver)
struct m0_pdclust_attr pvs_attr
const struct m0_conf_obj_type M0_CONF_SITE_TYPE
M0_INTERNAL int m0_fd_tolerance_check(struct m0_conf_pver *pv, uint32_t *failure_level)
struct m0_conf_obj rt_obj
M0_INTERNAL struct m0_conf_obj * m0_conf_cache_lookup(const struct m0_conf_cache *cache, const struct m0_fid *id)
M0_INTERNAL void m0_conf_dir_add(struct m0_conf_dir *dir, struct m0_conf_obj *obj)
struct m0_pool_version * pv
#define M0_LOG(level,...)
struct m0_container container
const struct m0_conf_obj_type * m0_conf_fid_type(const struct m0_fid *fid)
enum m0_trace_level level
const struct m0_conf_obj_type M0_CONF_PVER_TYPE
static int conf_pver_formulate(const struct m0_conf_pver *fpver, struct m0_conf_pver **out)
struct m0_conf_obj pv_obj
#define CONF_PVER_VECTOR_LOG(owner, fid, vector)
static int conf_pver_failures_cid(struct m0_conf_pver *base, uint64_t *out)
M0_INTERNAL void m0_combination_inverse(int cid, int N, int K, int *x)
static int conf_pver_objvs_count(struct m0_conf_pver *base, uint32_t *out)
struct m0_conf_cache * co_cache
M0_INTERNAL unsigned m0_conf_pver_level(const struct m0_conf_obj *obj)
struct m0_conf_dir * bws_dirs[M0_CONF_PVER_HEIGHT]
M0_INTERNAL bool m0_conf_obj_is_stub(const struct m0_conf_obj *obj)
const struct m0_conf_obj_type M0_CONF_CONTROLLER_TYPE
static int conf_pver_find_by_fid_locked(const struct m0_fid *fid, const struct m0_conf_root *root, struct m0_conf_pver **out)
enum m0_conf_pver_state cpi_state
enum m0_conf_pver_kind pv_kind
const struct arr_int * bws_failed
struct m0_pdclust_attr cpi_attr
M0_INTERNAL int m0_conf_dir_new(struct m0_conf_obj *parent, const struct m0_fid *relfid, const struct m0_conf_obj_type *children_type, const struct m0_fid_arr *children_ids, struct m0_conf_dir **out)
#define M0_ERR_INFO(rc, fmt,...)
M0_INTERNAL int m0_conf_walk(int(*fn)(struct m0_conf_obj *obj, void *args), struct m0_conf_obj *origin, void *args)
struct m0_conf_root * root
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL int m0_conf_pver_formulaic_find(uint32_t fpver_id, const struct m0_conf_root *root, const struct m0_conf_pver **out)
#define M0_FID_TINIT(type, container, key)
const struct m0_conf_obj_type M0_CONF_ENCLOSURE_TYPE
const struct m0_fid_type cot_ftype
static struct m0_confc * confc
M0_INTERNAL int m0_combination_index(int N, int K, int *x)
const struct m0_fid **(* coo_downlinks)(const struct m0_conf_obj *obj)
static struct m0_fid conf_objv_virtual_fid(struct m0_conf_cache *cache)
union m0_conf_pver::@122 pv_u
enum m0_ha_obj_state co_ha_state
static struct m0_thread t[8]
uint32_t pvs_tolerance[M0_CONF_PVER_HEIGHT]
M0_INTERNAL struct m0_fid m0_conf_pver_fid(enum m0_conf_pver_kind kind, uint64_t container, uint64_t key)
struct m0_conf_cache cc_cache
static int conf_pver_virtual_create(const struct m0_fid *fid, struct m0_conf_pver *base, const uint32_t *allowance, struct arr_int *failed, struct m0_conf_pver **out)
M0_INTERNAL bool m0_conf_cache_is_locked(const struct m0_conf_cache *cache)
M0_INTERNAL int m0_conf_pver_fid_read(const struct m0_fid *fid, enum m0_conf_pver_kind *kind, uint64_t *container, uint64_t *key)
const struct m0_conf_obj_type M0_CONF_DRIVE_TYPE
static int conf_pver_base_w(struct m0_conf_obj *obj, void *args)
static int conf_obj_mark_deleted(struct m0_conf_obj *obj, void *args M0_UNUSED)
#define M0_CONF_CAST(ptr, type)
static int conf_pver_base_recd_update(const struct m0_conf_pool *pool)
M0_INTERNAL int m0_conf_cache_add(struct m0_conf_cache *cache, struct m0_conf_obj *obj)
static int conf_objv_failed_fill(struct m0_conf_obj *obj, void *args)
int m0_conf_pver_status(struct m0_fid *fid, struct m0_confc *confc, struct m0_conf_pver_info *out_info)
static struct m0_pool pool
M0_INTERNAL bool m0_fid_eq(const struct m0_fid *fid0, const struct m0_fid *fid1)
#define m0_forall(var, nr,...)
static int conf_pver_find_locked(const struct m0_conf_pool *pool, const struct m0_fid *pver_to_skip, struct m0_conf_pver **out)
M0_INTERNAL struct m0_conf_obj * m0_conf_obj_create(const struct m0_fid *id, struct m0_conf_cache *cache)
M0_INTERNAL int m0_conf_pver_find_by_fid(const struct m0_fid *fid, const struct m0_conf_root *root, struct m0_conf_pver **out)
struct m0_conf_pver_formulaic formulaic
static void conf_pver_subtree_delete(struct m0_conf_obj *obj)
static int conf_pver_recd_build(struct m0_conf_obj *obj, void *args)
enum m0_conf_status co_status
static int conf_pver_base_obj_check(struct m0_conf_obj *obj, struct conf_pver_base_walk_st *st)
struct m0_conf_dir * cv_children
M0_INTERNAL int m0_conf_glob(struct m0_conf_glob *glob, uint32_t nr, const struct m0_conf_obj **objv)
#define M0_ASSERT_INFO(cond, fmt,...)
static int conf_pver_formulaic_base(const struct m0_conf_pver *fpver, struct m0_conf_pver **out)
M0_INTERNAL void m0_conf_cache_gc(struct m0_conf_cache *cache)
static void conf_pver_enumerate(struct m0_conf_pver *pver)
static int tolerance_failure_cmp(struct m0_conf_pver *pv, const uint32_t *srecd)
M0_INTERNAL int m0_conf_pver_find(const struct m0_conf_pool *pool, const struct m0_fid *pver_to_skip, struct m0_conf_pver **out)
M0_INTERNAL void m0_conf_cache_lock(struct m0_conf_cache *cache)
#define m0_tl_for(name, head, obj)
static int conf_pver_formulaic_find_locked(uint32_t fpver_id, const struct m0_conf_root *root, const struct m0_conf_pver **out)
M0_INTERNAL int m0_conf_pver_formulaic_from_virtual(const struct m0_conf_pver *virtual, const struct m0_conf_root *root, const struct m0_conf_pver **out)
M0_INTERNAL void m0_conf_cache_unlock(struct m0_conf_cache *cache)
M0_INTERNAL bool m0_conf_obj_invariant(const struct m0_conf_obj *obj)
const struct m0_conf_obj_type M0_CONF_RACK_TYPE
struct m0_conf_obj * cv_real
static int conf_pver_tolerance_adjust(struct m0_conf_pver *pver)
const struct m0_conf_obj_ops * co_ops
#define M0_IMPOSSIBLE(fmt,...)
static int conf_pver_enumerate_w(struct m0_conf_obj *obj, void *args)
M0_INTERNAL bool m0_pdclust_attr_check(const struct m0_pdclust_attr *attr)