.. | .. |
---|
113 | 113 | int name_len; |
---|
114 | 114 | }; |
---|
115 | 115 | |
---|
| 116 | +#define __CEPH_OID_INITIALIZER(oid) { .name = (oid).inline_name } |
---|
| 117 | + |
---|
| 118 | +#define CEPH_DEFINE_OID_ONSTACK(oid) \ |
---|
| 119 | + struct ceph_object_id oid = __CEPH_OID_INITIALIZER(oid) |
---|
| 120 | + |
---|
116 | 121 | static inline void ceph_oid_init(struct ceph_object_id *oid) |
---|
117 | 122 | { |
---|
118 | | - oid->name = oid->inline_name; |
---|
119 | | - oid->name_len = 0; |
---|
| 123 | + *oid = (struct ceph_object_id) __CEPH_OID_INITIALIZER(*oid); |
---|
120 | 124 | } |
---|
121 | | - |
---|
122 | | -#define CEPH_OID_INIT_ONSTACK(oid) \ |
---|
123 | | - ({ ceph_oid_init(&oid); oid; }) |
---|
124 | | -#define CEPH_DEFINE_OID_ONSTACK(oid) \ |
---|
125 | | - struct ceph_object_id oid = CEPH_OID_INIT_ONSTACK(oid) |
---|
126 | 125 | |
---|
127 | 126 | static inline bool ceph_oid_empty(const struct ceph_object_id *oid) |
---|
128 | 127 | { |
---|
.. | .. |
---|
137 | 136 | int ceph_oid_aprintf(struct ceph_object_id *oid, gfp_t gfp, |
---|
138 | 137 | const char *fmt, ...); |
---|
139 | 138 | void ceph_oid_destroy(struct ceph_object_id *oid); |
---|
| 139 | + |
---|
| 140 | +struct workspace_manager { |
---|
| 141 | + struct list_head idle_ws; |
---|
| 142 | + spinlock_t ws_lock; |
---|
| 143 | + /* Number of free workspaces */ |
---|
| 144 | + int free_ws; |
---|
| 145 | + /* Total number of allocated workspaces */ |
---|
| 146 | + atomic_t total_ws; |
---|
| 147 | + /* Waiters for a free workspace */ |
---|
| 148 | + wait_queue_head_t ws_wait; |
---|
| 149 | +}; |
---|
140 | 150 | |
---|
141 | 151 | struct ceph_pg_mapping { |
---|
142 | 152 | struct rb_node node; |
---|
.. | .. |
---|
185 | 195 | * the list of osds that store+replicate them. */ |
---|
186 | 196 | struct crush_map *crush; |
---|
187 | 197 | |
---|
188 | | - struct mutex crush_workspace_mutex; |
---|
189 | | - void *crush_workspace; |
---|
| 198 | + struct workspace_manager crush_wsm; |
---|
190 | 199 | }; |
---|
191 | 200 | |
---|
192 | 201 | static inline bool ceph_osd_exists(struct ceph_osdmap *map, int osd) |
---|
.. | .. |
---|
303 | 312 | int ceph_pg_to_acting_primary(struct ceph_osdmap *osdmap, |
---|
304 | 313 | const struct ceph_pg *raw_pgid); |
---|
305 | 314 | |
---|
| 315 | +struct crush_loc { |
---|
| 316 | + char *cl_type_name; |
---|
| 317 | + char *cl_name; |
---|
| 318 | +}; |
---|
| 319 | + |
---|
| 320 | +struct crush_loc_node { |
---|
| 321 | + struct rb_node cl_node; |
---|
| 322 | + struct crush_loc cl_loc; /* pointers into cl_data */ |
---|
| 323 | + char cl_data[]; |
---|
| 324 | +}; |
---|
| 325 | + |
---|
| 326 | +int ceph_parse_crush_location(char *crush_location, struct rb_root *locs); |
---|
| 327 | +int ceph_compare_crush_locs(struct rb_root *locs1, struct rb_root *locs2); |
---|
| 328 | +void ceph_clear_crush_locs(struct rb_root *locs); |
---|
| 329 | + |
---|
| 330 | +int ceph_get_crush_locality(struct ceph_osdmap *osdmap, int id, |
---|
| 331 | + struct rb_root *locs); |
---|
| 332 | + |
---|
306 | 333 | extern struct ceph_pg_pool_info *ceph_pg_pool_by_id(struct ceph_osdmap *map, |
---|
307 | 334 | u64 id); |
---|
308 | | - |
---|
309 | 335 | extern const char *ceph_pg_pool_name_by_id(struct ceph_osdmap *map, u64 id); |
---|
310 | 336 | extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name); |
---|
311 | 337 | u64 ceph_pg_pool_flags(struct ceph_osdmap *map, u64 id); |
---|