95 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_LAYOUT 141 m0_pdclust_layout_bob_check(pl) &&
153 const struct tile_cache *tc;
161 m0_pdclust_instance_bob_check(
pi) &&
169 tc->tc_lcode[
i] +
i <
P &&
170 (tc->tc_permute[
i] <
P && tc->tc_inverse[
i] <
P) &&
171 tc->tc_permute[tc->tc_inverse[
i]] ==
i &&
172 tc->tc_inverse[tc->tc_permute[
i]] ==
i);
200 M0_ENTRY(
"lid %llu", (
unsigned long long)
l->l_id);
202 m0_pdclust_layout_bob_fini(pl);
220 M0_ENTRY(
"lid %llu", (
unsigned long long)lid);
233 m0_pdclust_layout_bob_init(pl);
239 M0_LEAVE(
"lid %llu, pl pointer %p", (
unsigned long long)lid, pl);
253 M0_ENTRY(
"lid %llu", (
unsigned long long)
l->l_id);
255 m0_pdclust_layout_bob_fini(pl);
289 M0_ENTRY(
"lid %llu", (
unsigned long long)lid);
301 M0_LEAVE(
"lid %llu", (
unsigned long long)lid);
317 M0_ENTRY(
"domain %p, lid %llu",
dom,(
unsigned long long)lid);
335 M0_LEAVE(
"domain %p, lid %llu, pl %p, rc %d",
336 dom, (
unsigned long long)lid, *
out,
rc);
427 if (unit < pl->pl_attr.pa_N)
429 else if (unit < pl->pl_attr.pa_N + pl->
pl_attr.
pa_K)
463 M0_ENTRY(
"lid %llu", (
unsigned long long)
l->l_id);
480 (
unsigned long long)
l->l_id,
rc);
486 (
unsigned long long)
l->l_id,
rc);
494 (
unsigned long long)
l->l_id,
rc);
504 (
unsigned long long)
l->l_id,
rc);
509 M0_LEAVE(
"lid %llu, rc %d", (
unsigned long long)
l->l_id,
rc);
536 M0_ENTRY(
"%llu", (
unsigned long long)
l->l_id);
548 (
unsigned long long)
l->l_id,
rc);
550 M0_LEAVE(
"lid %llu, rc %d", (
unsigned long long)
l->l_id,
rc);
566 e->le_ops->leo_recsize(e);
578 static uint64_t
m_enc(uint64_t width, uint64_t row, uint64_t column)
581 return row * width + column;
591 static void m_dec(uint64_t width, uint64_t pos, uint64_t *row, uint64_t *column)
594 *column = pos % width;
611 static void permute(uint32_t
n, uint32_t *k, uint32_t *
s, uint32_t *
r)
632 for (
i = 0;
i <
n - 1; ++
i) {
636 for (j =
t; j >
i; --j)
653 uint64_t omega, uint64_t
t)
655 struct tile_cache *tc;
664 M0_ENTRY(
"t %lu, P %lu", (
unsigned long)
t, (
unsigned long)
attr.pa_P);
669 if (tc->tc_tile_no != omega) {
674 for (
i = 0;
i <
attr.pa_P; ++
i)
675 tc->tc_permute[
i] =
i;
682 for (
i = 0;
i <
attr.pa_P - 1; ++
i)
687 tc->tc_permute, tc->tc_inverse);
688 tc->tc_tile_no = omega;
696 M0_POST(tc->tc_inverse[tc->tc_permute[
t]] ==
t);
697 M0_POST(tc->tc_permute[tc->tc_inverse[
t]] ==
t);
698 return tc->tc_permute[
t];
799 for (
i = 0;
i < cache_cnt; ++
i)
817 for (
i = 0;
i < cache_info->
fci_nr; ++
i) {
850 struct tile_cache *tc =
NULL;
861 (
unsigned long long)
l->l_id,
FID_P(
fid));
882 if (tc->tc_lcode !=
NULL &&
883 tc->tc_permute !=
NULL &&
884 tc->tc_inverse !=
NULL) {
888 {
rc = -EPROTO;
goto err3_injected; }
895 m0_pdclust_instance_bob_init(
pi);
901 " failed, rc %d",
pi,
rc);
944 m0_pdclust_instance_bob_fini(
pi);
980 #undef M0_TRACE_SUBSYSTEM static void pdclust_fini(struct m0_ref *ref)
static struct m0_layout_enum * pdclust_instance_to_enum(const struct m0_layout_instance *li)
static const struct m0_layout_type_ops pdclust_type_ops
M0_INTERNAL m0_bcount_t m0_layout_max_recsize(const struct m0_layout_domain *dom)
M0_INTERNAL struct m0_striped_layout * m0_layout_to_striped(const struct m0_layout *l)
static const struct m0_layout_instance_ops pdclust_instance_ops
M0_INTERNAL void m0_parity_math_fini(struct m0_parity_math *math)
static const struct m0_bob_type pdclust_bob
M0_INTERNAL bool m0_pdclust_is_replicated(struct m0_pdclust_layout *play)
#define M0_ALLOC_ARR(arr, nr)
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
static int pdclust_instance_build(struct m0_layout *l, const struct m0_fid *fid, struct m0_layout_instance **out)
struct m0_pool_version * l_pver
static struct buffer * cur(struct m0_addb2_mach *mach, m0_bcount_t space)
const struct m0_layout_enum_type_ops * let_ops
M0_INTERNAL void m0_fd_perm_cache_fini(struct m0_fd_perm_cache *cache)
#define M0_LOG(level,...)
void(* leo_fini)(struct m0_layout_enum *e)
M0_INTERNAL bool m0_mutex_is_not_locked(const struct m0_mutex *mutex)
M0_INTERNAL void m0_layout__striped_init(struct m0_striped_layout *stl, struct m0_layout_domain *dom, uint64_t lid, struct m0_layout_type *type, const struct m0_layout_ops *ops)
M0_INTERNAL struct m0_layout_enum * m0_striped_layout_to_enum(const struct m0_striped_layout *stl)
struct m0_layout_instance pi_base
struct m0_pool_version pool_ver
M0_INTERNAL bool m0_layout__instance_invariant(const struct m0_layout_instance *li)
M0_INTERNAL int m0_pdclust_perm_cache_build(struct m0_layout *layout, struct m0_pdclust_instance *pi)
M0_INTERNAL void pdclust_instance_fini(struct m0_layout_instance *li)
M0_INTERNAL void * m0_bufvec_cursor_addr(struct m0_bufvec_cursor *cur)
#define container_of(ptr, type, member)
M0_INTERNAL int m0_fd_perm_cache_init(struct m0_fd_perm_cache *cache, uint64_t len)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
M0_INTERNAL bool m0_layout__striped_allocated_invariant(const struct m0_striped_layout *stl)
static m0_bcount_t pdclust_max_recsize(struct m0_layout_domain *dom)
static const struct m0_layout_ops pdclust_ops
struct m0_pdclust_attr pl_attr
struct m0_layout_enum_type * le_type
int(* leo_decode)(struct m0_layout_enum *e, struct m0_bufvec_cursor *cur, enum m0_layout_xcode_op op, struct m0_be_tx *tx, struct m0_striped_layout *stl)
struct m0_pdclust_attr pr_attr
static m0_bcount_t pdclust_recsize(const struct m0_layout *l)
M0_INTERNAL bool m0_bufvec_cursor_move(struct m0_bufvec_cursor *cur, m0_bcount_t count)
static bool pdclust_invariant(const struct m0_pdclust_layout *pl)
int(* leo_encode)(const struct m0_layout_enum *le, enum m0_layout_xcode_op op, struct m0_be_tx *tx, struct m0_bufvec_cursor *out)
M0_INTERNAL const struct m0_pdclust_src_addr M0_PDCLUST_SRC_NULL
return M0_ERR(-EOPNOTSUPP)
struct m0_layout_type m0_pdclust_layout_type
M0_INTERNAL uint64_t m0_rnd(uint64_t max, uint64_t *seed)
M0_INTERNAL void m0_layout__striped_delete(struct m0_striped_layout *stl)
static void attr(struct m0_addb2__context *ctx, const uint64_t *v, char *buf)
const struct m0_layout_enum_ops * le_ops
struct m0_parity_math pi_math
struct m0_fd_tree pv_fd_tree
M0_INTERNAL m0_bcount_t m0_bufvec_cursor_step(const struct m0_bufvec_cursor *cur)
struct m0_striped_layout pl_base
M0_INTERNAL uint32_t m0_pdclust_N(const struct m0_pdclust_layout *pl)
M0_INTERNAL bool m0_mutex_is_locked(const struct m0_mutex *mutex)
M0_INTERNAL m0_bcount_t m0_layout__enum_max_recsize(struct m0_layout_domain *dom)
static struct m0_thread t[8]
#define bob_of(ptr, type, field, bt)
struct m0_layout_enum * sl_enum
struct m0_fd_cache_info ft_cache_info
static struct m0_stob_domain * dom
M0_INTERNAL void m0_layout__instance_init(struct m0_layout_instance *li, const struct m0_fid *gfid, struct m0_layout *l, const struct m0_layout_instance_ops *ops)
M0_INTERNAL uint32_t m0_pdclust_S(const struct m0_pdclust_layout *pl)
static int pdclust_encode(struct m0_layout *l, enum m0_layout_xcode_op op, struct m0_be_tx *tx, struct m0_bufvec_cursor *out)
M0_INTERNAL void m0_layout__striped_fini(struct m0_striped_layout *str_l)
M0_INTERNAL struct m0_pdclust_layout * m0_layout_to_pdl(const struct m0_layout *l)
M0_INTERNAL int m0_parity_math_init(struct m0_parity_math *math, uint32_t data_count, uint32_t parity_count)
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
struct m0_pdclust_instance pi
M0_INTERNAL uint32_t m0_pdclust_K(const struct m0_pdclust_layout *pl)
M0_INTERNAL bool m0_layout__domain_invariant(const struct m0_layout_domain *dom)
M0_INTERNAL bool m0_layout__striped_invariant(const struct m0_striped_layout *stl)
M0_INTERNAL void m0_layout__log(const char *fn_name, const char *err_msg, uint64_t lid, int rc)
static bool pdclust_instance_invariant(const struct m0_pdclust_instance *pi)
M0_INTERNAL void m0_pdclust_instance_map(struct m0_pdclust_instance *pi, const struct m0_pdclust_src_addr *src, struct m0_pdclust_tgt_addr *tgt)
struct m0_pdclust_instance::tile_cache pi_tile_cache
M0_INTERNAL void m0_pdclust_instance_inv(struct m0_pdclust_instance *pi, const struct m0_pdclust_tgt_addr *tgt, struct m0_pdclust_src_addr *src)
M0_INTERNAL void m0_layout__instance_fini(struct m0_layout_instance *li)
static struct m0_clink l[NR]
M0_INTERNAL uint64_t m0_gcd64(uint64_t p, uint64_t q)
static void pdclust_delete(struct m0_layout *l)
M0_INTERNAL struct m0_layout * m0_pdl_to_layout(struct m0_pdclust_layout *pl)
static void m_dec(uint64_t width, uint64_t pos, uint64_t *row, uint64_t *column)
M0_INTERNAL void m0_layout__striped_populate(struct m0_striped_layout *str_l, struct m0_layout_enum *e, uint32_t user_count)
static int pdclust_register(struct m0_layout_domain *dom, const struct m0_layout_type *lt)
#define m0_forall(var, nr,...)
M0_INTERNAL uint32_t m0_pdclust_size(const struct m0_pdclust_layout *pl)
M0_INTERNAL bool m0_layout__allocated_invariant(const struct m0_layout *l)
struct m0_pdclust_tgt_addr tgt
static struct m0_pdclust_layout * pi_to_pl(struct m0_pdclust_instance *pi)
M0_INTERNAL int64_t m0_ref_read(const struct m0_ref *ref)
#define M0_FI_ENABLED(tag)
struct m0_fd_perm_cache * pi_perm_cache
static void pdclust_unregister(struct m0_layout_domain *dom, const struct m0_layout_type *lt)
static int pdclust_populate(struct m0_pdclust_layout *pl, const struct m0_pdclust_attr *attr, struct m0_layout_enum *le, uint32_t user_count)
#define M0_ALLOC_PTR(ptr)
int(* lto_register)(struct m0_layout_domain *dom, const struct m0_layout_type *lt)
static bool pdclust_allocated_invariant(const struct m0_pdclust_layout *pl)
void(* lio_fini)(struct m0_layout_instance *li)
M0_BOB_DEFINE(static, &pdclust_bob, m0_pdclust_layout)
M0_INTERNAL m0_bcount_t m0_bufvec_cursor_copyto(struct m0_bufvec_cursor *dcur, void *sdata, m0_bcount_t num_bytes)
M0_INTERNAL enum m0_pdclust_unit_type m0_pdclust_unit_classify(const struct m0_pdclust_layout *pl, int unit)
static void permute(uint32_t n, uint32_t *k, uint32_t *s, uint32_t *r)
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
M0_INTERNAL int m0_pdclust_build(struct m0_layout_domain *dom, uint64_t lid, const struct m0_pdclust_attr *attr, struct m0_layout_enum *le, struct m0_pdclust_layout **out)
#define IS_IN_ARRAY(idx, array)
M0_INTERNAL struct m0_layout_enum * m0_layout_to_enum(const struct m0_layout *l)
int(* leto_allocate)(struct m0_layout_domain *dom, struct m0_layout_enum **out)
M0_INTERNAL void m0_pdclust_perm_cache_destroy(struct m0_layout *layout, struct m0_pdclust_instance *pi)
M0_INTERNAL struct m0_pdclust_instance * m0_layout_instance_to_pdi(const struct m0_layout_instance *li)
uint32_t(* leo_nr)(const struct m0_layout_enum *e)
static uint64_t permute_column(struct m0_pdclust_instance *pi, uint64_t omega, uint64_t t)
static const struct m0_bob_type pdclust_instance_bob
M0_INTERNAL bool m0_fid_is_valid(const struct m0_fid *fid)
static int pdclust_decode(struct m0_layout *l, struct m0_bufvec_cursor *cur, enum m0_layout_xcode_op op, struct m0_be_tx *tx, uint32_t user_count)
static struct m0_addb2_source * s
struct m0_pdclust_src_addr src
static int pdclust_allocate(struct m0_layout_domain *dom, uint64_t lid, struct m0_layout **out)
#define offsetof(typ, memb)
M0_INTERNAL uint32_t m0_pdclust_P(const struct m0_pdclust_layout *pl)
M0_INTERNAL uint64_t m0_pdclust_unit_size(const struct m0_pdclust_layout *pl)
static uint64_t m_enc(uint64_t width, uint64_t row, uint64_t column)
M0_INTERNAL uint64_t m0_hash(uint64_t x)
void(* leo_delete)(struct m0_layout_enum *e)
void(* lo_fini)(struct m0_ref *ref)
M0_INTERNAL bool m0_pdclust_attr_check(const struct m0_pdclust_attr *attr)