Lines Matching refs:bucket

74 static int bucket_perm_choose(const struct crush_bucket *bucket,  in bucket_perm_choose()  argument
78 unsigned int pr = r % bucket->size; in bucket_perm_choose()
83 dprintk("bucket %d new x=%d\n", bucket->id, x); in bucket_perm_choose()
88 s = crush_hash32_3(bucket->hash, x, bucket->id, 0) % in bucket_perm_choose()
89 bucket->size; in bucket_perm_choose()
95 for (i = 0; i < bucket->size; i++) in bucket_perm_choose()
100 for (i = 1; i < bucket->size; i++) in bucket_perm_choose()
112 if (p < bucket->size - 1) { in bucket_perm_choose()
113 i = crush_hash32_3(bucket->hash, x, bucket->id, p) % in bucket_perm_choose()
114 (bucket->size - p); in bucket_perm_choose()
124 for (i = 0; i < bucket->size; i++) in bucket_perm_choose()
129 dprintk(" perm_choose %d sz=%d x=%d r=%d (%d) s=%d\n", bucket->id, in bucket_perm_choose()
130 bucket->size, x, r, pr, s); in bucket_perm_choose()
131 return bucket->items[s]; in bucket_perm_choose()
135 static int bucket_uniform_choose(const struct crush_bucket_uniform *bucket, in bucket_uniform_choose() argument
138 return bucket_perm_choose(&bucket->h, work, x, r); in bucket_uniform_choose()
142 static int bucket_list_choose(const struct crush_bucket_list *bucket, in bucket_list_choose() argument
147 for (i = bucket->h.size-1; i >= 0; i--) { in bucket_list_choose()
148 __u64 w = crush_hash32_4(bucket->h.hash, x, bucket->h.items[i], in bucket_list_choose()
149 r, bucket->h.id); in bucket_list_choose()
153 i, x, r, bucket->h.items[i], bucket->item_weights[i], in bucket_list_choose()
154 bucket->sum_weights[i], w); in bucket_list_choose()
155 w *= bucket->sum_weights[i]; in bucket_list_choose()
158 if (w < bucket->item_weights[i]) { in bucket_list_choose()
159 return bucket->h.items[i]; in bucket_list_choose()
163 dprintk("bad list sums for bucket %d\n", bucket->h.id); in bucket_list_choose()
164 return bucket->h.items[0]; in bucket_list_choose()
196 static int bucket_tree_choose(const struct crush_bucket_tree *bucket, in bucket_tree_choose() argument
204 n = bucket->num_nodes >> 1; in bucket_tree_choose()
209 w = bucket->node_weights[n]; in bucket_tree_choose()
210 t = (__u64)crush_hash32_4(bucket->h.hash, x, n, r, in bucket_tree_choose()
211 bucket->h.id) * (__u64)w; in bucket_tree_choose()
216 if (t < bucket->node_weights[l]) in bucket_tree_choose()
222 return bucket->h.items[n >> 1]; in bucket_tree_choose()
228 static int bucket_straw_choose(const struct crush_bucket_straw *bucket, in bucket_straw_choose() argument
236 for (i = 0; i < bucket->h.size; i++) { in bucket_straw_choose()
237 draw = crush_hash32_3(bucket->h.hash, x, bucket->h.items[i], r); in bucket_straw_choose()
239 draw *= bucket->straws[i]; in bucket_straw_choose()
245 return bucket->h.items[high]; in bucket_straw_choose()
305 static __u32 *get_choose_arg_weights(const struct crush_bucket_straw2 *bucket, in get_choose_arg_weights() argument
310 return bucket->item_weights; in get_choose_arg_weights()
317 static __s32 *get_choose_arg_ids(const struct crush_bucket_straw2 *bucket, in get_choose_arg_ids() argument
321 return bucket->h.items; in get_choose_arg_ids()
326 static int bucket_straw2_choose(const struct crush_bucket_straw2 *bucket, in bucket_straw2_choose() argument
334 __u32 *weights = get_choose_arg_weights(bucket, arg, position); in bucket_straw2_choose()
335 __s32 *ids = get_choose_arg_ids(bucket, arg); in bucket_straw2_choose()
337 for (i = 0; i < bucket->h.size; i++) { in bucket_straw2_choose()
340 u = crush_hash32_3(bucket->h.hash, x, ids[i], r); in bucket_straw2_choose()
372 return bucket->h.items[high]; in bucket_straw2_choose()
451 const struct crush_bucket *bucket, in crush_choose_firstn() argument
470 const struct crush_bucket *in = bucket; in crush_choose_firstn()
480 bucket->id, x, outpos, numrep, in crush_choose_firstn()
490 in = bucket; /* initial bucket */ in crush_choose_firstn()
645 const struct crush_bucket *bucket, in crush_choose_indep() argument
656 const struct crush_bucket *in = bucket; in crush_choose_indep()
667 bucket->id, x, outpos, numrep); in crush_choose_indep()
695 in = bucket; /* initial bucket */ in crush_choose_indep()