libceph: add support for primary_temp mappings
authorIlya Dryomov <ilya.dryomov@inktank.com>
Mon, 24 Mar 2014 15:12:48 +0000 (17:12 +0200)
committerSage Weil <sage@inktank.com>
Sat, 5 Apr 2014 04:08:16 +0000 (21:08 -0700)
Change apply_temp() to override primary in the same way pg_temp
overrides osd set.  primary_temp overrides pg_temp primary too.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Alex Elder <elder@linaro.org>
net/ceph/osdmap.c

index df9389ddd56c0c662325a10b9d3fd68f2ba35bae..20a38a37794cedd554c23f70ca97e02748e3d4a1 100644 (file)
@@ -1597,7 +1597,7 @@ static int raw_to_up_osds(struct ceph_osdmap *osdmap,
 }
 
 /*
- * Given up set, apply pg_temp mapping.
+ * Given up set, apply pg_temp and primary_temp mappings.
  *
  * Return acting set length.  *primary is set to acting primary osd id,
  * or -1 if acting set is empty.
@@ -1644,6 +1644,11 @@ static int apply_temps(struct ceph_osdmap *osdmap,
                temp_primary = *primary;
        }
 
+       /* primary_temp? */
+       pg = __lookup_pg_mapping(&osdmap->primary_temp, pgid);
+       if (pg)
+               temp_primary = pg->primary_temp.osd;
+
        *primary = temp_primary;
        return temp_len;
 }