提交 c6d98a60 编写于 作者: I Ilya Dryomov

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.

Reflects ceph.git commit b1d4dd4eb044875874a1d01c01c7d766db5d0a80.
Signed-off-by: NIlya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: NSage Weil <sage@inktank.com>
上级 e8ef19c4
......@@ -19,10 +19,11 @@
#define CRUSH_MAGIC 0x00010000ul /* for detecting algorithm revisions */
#define CRUSH_MAX_DEPTH 10 /* max crush hierarchy depth */
#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
......
......@@ -455,8 +455,12 @@ static int crush_choose(const struct crush_map *map,
} 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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册