hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/include/linux/ceph/osdmap.h
....@@ -113,16 +113,15 @@
113113 int name_len;
114114 };
115115
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
+
116121 static inline void ceph_oid_init(struct ceph_object_id *oid)
117122 {
118
- oid->name = oid->inline_name;
119
- oid->name_len = 0;
123
+ *oid = (struct ceph_object_id) __CEPH_OID_INITIALIZER(*oid);
120124 }
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)
126125
127126 static inline bool ceph_oid_empty(const struct ceph_object_id *oid)
128127 {
....@@ -137,6 +136,17 @@
137136 int ceph_oid_aprintf(struct ceph_object_id *oid, gfp_t gfp,
138137 const char *fmt, ...);
139138 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
+};
140150
141151 struct ceph_pg_mapping {
142152 struct rb_node node;
....@@ -185,8 +195,7 @@
185195 * the list of osds that store+replicate them. */
186196 struct crush_map *crush;
187197
188
- struct mutex crush_workspace_mutex;
189
- void *crush_workspace;
198
+ struct workspace_manager crush_wsm;
190199 };
191200
192201 static inline bool ceph_osd_exists(struct ceph_osdmap *map, int osd)
....@@ -303,9 +312,26 @@
303312 int ceph_pg_to_acting_primary(struct ceph_osdmap *osdmap,
304313 const struct ceph_pg *raw_pgid);
305314
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
+
306333 extern struct ceph_pg_pool_info *ceph_pg_pool_by_id(struct ceph_osdmap *map,
307334 u64 id);
308
-
309335 extern const char *ceph_pg_pool_name_by_id(struct ceph_osdmap *map, u64 id);
310336 extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name);
311337 u64 ceph_pg_pool_flags(struct ceph_osdmap *map, u64 id);