]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: return CRUSH_ITEM_UNDEF for failed placements with indep
authorSage Weil <sage@inktank.com>
Sun, 11 Aug 2013 21:35:19 +0000 (14:35 -0700)
committerSage Weil <sage@inktank.com>
Tue, 3 Dec 2013 22:41:24 +0000 (14:41 -0800)
For firstn mode, if we fail to make a valid placement choice, we just
continue and return a short result to the caller.  For indep mode, however,
we need to make the position stable, and return an undefined value on
failed placements to avoid shifting later results to the left.

Signed-off-by: Sage Weil <sage@inktank.com>
src/crush/crush.h
src/crush/mapper.c

index 7a0867744c488cb12e78ef6881e9ca566083c7ab..99ac1ff7aef4ddb4a4cbda4dc6a6b122f9b28163 100644 (file)
@@ -31,6 +31,8 @@
 #define CRUSH_MAX_DEVICE_WEIGHT (100u * 0x10000u)
 #define CRUSH_MAX_BUCKET_WEIGHT (65535u * 0x10000u)
 
+#define CRUSH_ITEM_UNDEF  0x7fffffff  /* undefined result */
+
 /*
  * CRUSH uses user-defined "rules" to describe how inputs should be
  * mapped to devices.  A rule consists of sequence of steps to perform
index 8af8810f3d3e4d32af46fedc07237263cba43fb8..8d7e3c7c06c70d8f7fe9912bf5f39c765a629ff9 100644 (file)
@@ -451,8 +451,12 @@ reject:
                } while (retry_descent);
 
                if (skip_rep) {
-                       dprintk("skip rep\n");
-                       continue;
+                       if (firstn) {
+                               dprintk("skip rep\n");
+                               continue;
+                       }
+                       dprintk("undef rep, continuing\n");
+                       item = CRUSH_ITEM_UNDEF;
                }
 
                dprintk("CHOOSE got %d\n", item);