History

crush: straw2 bucket type with an efficient 64-bit crush_ln()

This is an improved straw bucket that correctly avoids any data movement between items A and B when neither A nor B's weights are changed. Said differently, if we adjust the weight of item C (including adding it anew or removing it completely), we will only see inputs move to or from C, never between other items in the bucket. Notably, there is not intermediate scaling factor that needs to be calculated. The mapping function is a simple function of the item weights. The below commits were squashed together into this one (mostly to avoid adding and then yanking a ~6000 lines worth of crush_ln_table): - crush: add a straw2 bucket type - crush: add crush_ln to calculate nature log efficently - crush: improve straw2 adjustment slightly - crush: change crush_ln to provide 32 more digits - crush: fix crush_get_bucket_item_weight and bucket destroy for straw2 - crush/mapper: fix divide-by-0 in straw2 (with div64_s64() for draw = ln / w and INT64_MIN -> S64_MIN - need to create a proper compat.h in ceph.git) Reflects ceph.git commits 242293c908e923d474910f2b8203fa3b41eb5a53, 32a1ead92efcd351822d22a5fc37d159c65c1338, 6289912418c4a3597a11778bcf29ed5415117ad9, 35fcb04e2945717cf5cfe150b9fa89cb3d2303a1, 6445d9ee7290938de1e4ee9563912a6ab6d8ee5f, b5921d55d16796e12d66ad2c4add7305f9ce2353.

Ilya Dryomov committed 11 years ago

Commit 958a2761 parent 45002265 files · +316 −2Browse files

Showing the changes to include/linux (1 of 5 files). Show all

Unified · Split

include/linux/crush/crush.h+10−2
@@ -96,13 +96,15 @@ struct crush_rule { · 95 unmodified lines
96 * uniform O(1) poor poor96 * uniform O(1) poor poor
97 * list O(n) optimal poor97 * list O(n) optimal poor
98 * tree O(log n) good good98 * tree O(log n) good good
99 * straw O(n) optimal optimal99 * straw O(n) better better
100 * straw2 O(n) optimal optimal
100 */101 */
101enum {102enum {
102 CRUSH_BUCKET_UNIFORM = 1,103 CRUSH_BUCKET_UNIFORM = 1,
103 CRUSH_BUCKET_LIST = 2,104 CRUSH_BUCKET_LIST = 2,
104 CRUSH_BUCKET_TREE = 3,105 CRUSH_BUCKET_TREE = 3,
105 CRUSH_BUCKET_STRAW = 4106 CRUSH_BUCKET_STRAW = 4,
107 CRUSH_BUCKET_STRAW2 = 5,
106};108};
107extern const char *crush_bucket_alg_name(int alg);109extern const char *crush_bucket_alg_name(int alg);
108 110
@@ -149,6 +151,11 @@ struct crush_bucket_straw { · 40 unmodified lines
149 __u32 *straws; /* 16-bit fixed point */151 __u32 *straws; /* 16-bit fixed point */
150};152};
151 153
154struct crush_bucket_straw2 {
155 struct crush_bucket h;
156 __u32 *item_weights; /* 16-bit fixed point */
157};
158
152 159
153 160
154/*161/*
@@ -189,6 +196,7 @@ extern void crush_destroy_bucket_uniform(struct crush_bucket_uniform *b); · 34 unmodified lines
189extern void crush_destroy_bucket_list(struct crush_bucket_list *b);196extern void crush_destroy_bucket_list(struct crush_bucket_list *b);
190extern void crush_destroy_bucket_tree(struct crush_bucket_tree *b);197extern void crush_destroy_bucket_tree(struct crush_bucket_tree *b);
191extern void crush_destroy_bucket_straw(struct crush_bucket_straw *b);198extern void crush_destroy_bucket_straw(struct crush_bucket_straw *b);
199extern void crush_destroy_bucket_straw2(struct crush_bucket_straw2 *b);
192extern void crush_destroy_bucket(struct crush_bucket *b);200extern void crush_destroy_bucket(struct crush_bucket *b);
193extern void crush_destroy_rule(struct crush_rule *r);201extern void crush_destroy_rule(struct crush_rule *r);
194extern void crush_destroy(struct crush_map *map);202extern void crush_destroy(struct crush_map *map);