]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - net/ceph/osdmap.c
Merge tag 'for-linus-20170812' of git://git.infradead.org/linux-mtd
[karo-tx-linux.git] / net / ceph / osdmap.c
index 2586e55461438bd1cd7a1127bfc8179e6ba84cb0..f358d0bfa76b35cb978e9e92b57aea38a4e3b391 100644 (file)
@@ -2082,6 +2082,8 @@ bool ceph_is_new_interval(const struct ceph_osds *old_acting,
                          u32 new_pg_num,
                          bool old_sort_bitwise,
                          bool new_sort_bitwise,
+                         bool old_recovery_deletes,
+                         bool new_recovery_deletes,
                          const struct ceph_pg *pgid)
 {
        return !osds_equal(old_acting, new_acting) ||
@@ -2089,7 +2091,8 @@ bool ceph_is_new_interval(const struct ceph_osds *old_acting,
               old_size != new_size ||
               old_min_size != new_min_size ||
               ceph_pg_is_split(pgid, old_pg_num, new_pg_num) ||
-              old_sort_bitwise != new_sort_bitwise;
+              old_sort_bitwise != new_sort_bitwise ||
+              old_recovery_deletes != new_recovery_deletes;
 }
 
 static int calc_pg_rank(int osd, const struct ceph_osds *acting)
@@ -2437,40 +2440,23 @@ static void apply_upmap(struct ceph_osdmap *osdmap,
                for (i = 0; i < pg->pg_upmap.len; i++)
                        raw->osds[i] = pg->pg_upmap.osds[i];
                raw->size = pg->pg_upmap.len;
-               return;
+               /* check and apply pg_upmap_items, if any */
        }
 
        pg = lookup_pg_mapping(&osdmap->pg_upmap_items, pgid);
        if (pg) {
-               /*
-                * Note: this approach does not allow a bidirectional swap,
-                * e.g., [[1,2],[2,1]] applied to [0,1,2] -> [0,2,1].
-                */
-               for (i = 0; i < pg->pg_upmap_items.len; i++) {
-                       int from = pg->pg_upmap_items.from_to[i][0];
-                       int to = pg->pg_upmap_items.from_to[i][1];
-                       int pos = -1;
-                       bool exists = false;
-
-                       /* make sure replacement doesn't already appear */
-                       for (j = 0; j < raw->size; j++) {
-                               int osd = raw->osds[j];
-
-                               if (osd == to) {
-                                       exists = true;
+               for (i = 0; i < raw->size; i++) {
+                       for (j = 0; j < pg->pg_upmap_items.len; j++) {
+                               int from = pg->pg_upmap_items.from_to[j][0];
+                               int to = pg->pg_upmap_items.from_to[j][1];
+
+                               if (from == raw->osds[i]) {
+                                       if (!(to != CRUSH_ITEM_NONE &&
+                                             to < osdmap->max_osd &&
+                                             osdmap->osd_weight[to] == 0))
+                                               raw->osds[i] = to;
                                        break;
                                }
-                               /* ignore mapping if target is marked out */
-                               if (osd == from && pos < 0 &&
-                                   !(to != CRUSH_ITEM_NONE &&
-                                     to < osdmap->max_osd &&
-                                     osdmap->osd_weight[to] == 0)) {
-                                       pos = j;
-                               }
-                       }
-                       if (!exists && pos >= 0) {
-                               raw->osds[pos] = to;
-                               return;
                        }
                }
        }