libceph: pg_upmap[_items] infrastructure

pg_temp and pg_upmap encodings are the same (PG -> array of osds),
except for the incremental remove: it's an empty mapping in new_pg_temp
for pg_temp and a separate old_pg_upmap set for pg_upmap.  (This isn't
to allow for empty pg_upmap mappings -- apparently, pg_temp just wasn't
looked at as an example for pg_upmap encoding.)

Reuse __decode_pg_temp() for decoding pg_upmap and new_pg_upmap.
__decode_pg_temp() stores into pg_temp union member, but since pg_upmap
union member is identical, reading through pg_upmap later is OK.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
Ilya Dryomov
2017-06-21 17:27:18 +02:00
parent 278b1d709c
commit 6f428df47d
3 changed files with 164 additions and 4 deletions

View File

@@ -143,10 +143,14 @@ struct ceph_pg_mapping {
struct {
int len;
int osds[];
} pg_temp;
} pg_temp, pg_upmap;
struct {
int osd;
} primary_temp;
struct {
int len;
int from_to[][2];
} pg_upmap_items;
};
};
@@ -165,6 +169,10 @@ struct ceph_osdmap {
struct rb_root pg_temp;
struct rb_root primary_temp;
/* remap (post-CRUSH, pre-up) */
struct rb_root pg_upmap; /* PG := raw set */
struct rb_root pg_upmap_items; /* from -> to within raw set */
u32 *osd_primary_affinity;
struct rb_root pg_pools;