diff options
author | Sage Weil <sage@inktank.com> | 2013-08-11 14:35:19 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-08-11 14:35:19 -0700 |
commit | d87b1aa5d3b7c42bbe7760ad818937c48d33f2f5 (patch) | |
tree | 615de50a9f3eb9cfba9e1e7aca666e41b85ae56e | |
parent | a56ed9dbf777c5a702bde7075ddabd9eba4b8d31 (diff) | |
download | ceph-d87b1aa5d3b7c42bbe7760ad818937c48d33f2f5.tar.gz |
crush: return CRUSH_ITEM_UNDEF for failed placements with indep
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>
-rw-r--r-- | src/crush/crush.h | 2 | ||||
-rw-r--r-- | src/crush/mapper.c | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/crush/crush.h b/src/crush/crush.h index 4d55f8a12ff..cf8ac1c4985 100644 --- a/src/crush/crush.h +++ b/src/crush/crush.h @@ -30,6 +30,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 diff --git a/src/crush/mapper.c b/src/crush/mapper.c index 8af8810f3d3..8d7e3c7c06c 100644 --- a/src/crush/mapper.c +++ b/src/crush/mapper.c @@ -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); |