Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef CEPH_CRUSH_MAPPER_H
0003 #define CEPH_CRUSH_MAPPER_H
0004 
0005 /*
0006  * CRUSH functions for find rules and then mapping an input to an
0007  * output set.
0008  *
0009  * LGPL2
0010  */
0011 
0012 #include "crush.h"
0013 
0014 extern int crush_find_rule(const struct crush_map *map, int ruleset, int type, int size);
0015 int crush_do_rule(const struct crush_map *map,
0016           int ruleno, int x, int *result, int result_max,
0017           const __u32 *weight, int weight_max,
0018           void *cwin, const struct crush_choose_arg *choose_args);
0019 
0020 /*
0021  * Returns the exact amount of workspace that will need to be used
0022  * for a given combination of crush_map and result_max. The caller can
0023  * then allocate this much on its own, either on the stack, in a
0024  * per-thread long-lived buffer, or however it likes.
0025  */
0026 static inline size_t crush_work_size(const struct crush_map *map,
0027                      int result_max)
0028 {
0029     return map->working_size + result_max * 3 * sizeof(__u32);
0030 }
0031 
0032 void crush_init_workspace(const struct crush_map *map, void *v);
0033 
0034 #endif