#define CRUSH_MAGIC 0x00010000ul /* for detecting algorithm revisions */
#define CRUSH_MAX_DEPTH 10/* max crush hierarchy depth */ #define CRUSH_MAX_RULESET (1<<8) /* max crush ruleset number */ #define CRUSH_MAX_RULES CRUSH_MAX_RULESET /* should be the same as max rulesets */
struct crush_bucket {
__s32 id; /* this'll be negative */
__u16 type; /* non-zero; type=0 is reserved for devices */
__u8 alg; /* one of CRUSH_BUCKET_* */
__u8 hash; /* which hash function to use, CRUSH_HASH_* */
__u32 weight; /* 16-bit fixed point */
__u32 size; /* num items */
__s32 *items;
};
/** @ingroup API * *Replacementweightsforeachiteminabucket.Thesizeofthe *arraymustbeexactlythesizeofthestraw2bucket,justasthe *item_weightsarray. *
*/ struct crush_weight_set {
__u32 *weights; /*!< 16.16 fixed point weights
in the same order as items */
__u32 size; /*!< size of the __weights__ array */
};
/** @ingroup API * *Replacementweightsandidsforagivenstraw2bucket,for *placementpurposes. * *Whencrush_do_rule()choosestheNthitemfromastraw2bucket,the *replacementweightsfoundat__weight_set[N]__areusedinsteadof *theweightsfrom__item_weights__.If__N__isgreaterthan *__weight_set_size__,theweightsfoundat__weight_set_size-1__are *usedinstead.Forinstanceif__weight_set__is: * *[[0x10000,0x20000],// position 0 *[0x20000,0x40000]]// position 1 * *choosingthe0thitemwilluseposition0weights[0x10000,0x20000] *choosingthe1thitemwilluseposition1weights[0x20000,0x40000] *choosingthe2thitemwilluseposition1weights[0x20000,0x40000] *etc. *
*/ struct crush_choose_arg {
__s32 *ids; /*!< values to use instead of items */
__u32 ids_size; /*!< size of the __ids__ array */ struct crush_weight_set *weight_set; /*!< weight replacements for
a given position */
__u32 weight_set_size; /*!< size of the __weight_set__ array */
};
/** @ingroup API * *Replacementweightsandidsforeachbucketinthecrushmap.The *__size__ofthe__args__arraymustbeexactlythesameasthe *__map->max_buckets__. * *The__crush_choose_arg__atindexNwillbeusedwhenchoosing *anitemfromthebucket__map->buckets[N]__bucket,providedit *isastraw2bucket. *
*/ struct crush_choose_arg_map { #ifdef __KERNEL__ struct rb_node node;
s64 choose_args_index; #endif struct crush_choose_arg *args; /*!< replacement for each bucket
in the crushmap */
__u32 size; /*!< size of the __args__ array */
};
struct crush_bucket_list { struct crush_bucket h;
__u32 *item_weights; /* 16-bit fixed point */
__u32 *sum_weights; /* 16-bit fixed point. element i is sum
of weights 0..i, inclusive */
};
struct crush_bucket_tree { struct crush_bucket h; /* note: h.size is _tree_ size, not number of
actual items */
__u8 num_nodes;
__u32 *node_weights;
};
/* choose local retries before re-descent */
__u32 choose_local_tries; /* choose local attempts using a fallback permutation before
* re-descent */
__u32 choose_local_fallback_tries; /* choose attempts before giving up */
__u32 choose_total_tries; /* attempt chooseleaf inner descent once for firstn mode; on *rejectretryouterdescent.Notethatthisdoes*not* *applytoacollision:inthatcasewewillretryasweused
* to. */
__u32 chooseleaf_descend_once;
/* if non-zero, feed r into chooseleaf, bit-shifted right by (r-1) *bits.avalueof1isbestfornewclusters.forlegacyclusters *thatwanttolimitreshuffling,avalueof3or4willmakethe
* mappings line up a bit better with previous mappings. */
__u8 chooseleaf_vary_r;
/* if true, it makes chooseleaf firstn to return stable results (if *nolocalretry)sothatdatamigrationswouldbeoptimalwhensome
* device fails. */
__u8 chooseleaf_stable;
/* *ThesedatastructuresareprivatetotheCRUSHimplementation.They *areexposedinthisheaderfilebecausebuilderneedstheir *definitionstocalculatethetotalworkingsize. * *MovingthisoutofthecrushmapallowustotreattheCRUSHmapas *immutablewithinthemapperandremovestherequirementforaCRUSH *maplock.
*/ struct crush_work_bucket {
__u32 perm_x; /* @x for which *perm is defined */
__u32 perm_n; /* num elements of *perm that are permuted/defined */
__u32 *perm; /* Permutation of the bucket's items */
};
struct crush_work { struct crush_work_bucket **work; /* Per-bucket working store */ #ifdef __KERNEL__ struct list_head item; #endif
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.