From ad16db31df793d90a40fbfced82cae1c86d94658 Mon Sep 17 00:00:00 2001 From: Xavier Hernandez Date: Tue, 25 Nov 2014 09:54:29 +0100 Subject: ec: Fix incorrect value of EC_MAX_NODES EC_MAX_NODES was incorrectly calculated. Now the value if computed as the minimum between the theoretical maximum and the limit imposed by the Galois Field. This is a backport of http://review.gluster.org/9193/ Change-Id: I75a8345147f344f051923d66be2c10d405370c7b BUG: 1170959 Signed-off-by: Xavier Hernandez Reviewed-on: http://review.gluster.org/9245 Reviewed-by: Dan Lambright Tested-by: Gluster Build System Reviewed-by: Raghavendra Bhat Tested-by: Raghavendra Bhat --- xlators/cluster/ec/src/ec-method.h | 3 +++ xlators/cluster/ec/src/ec.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'xlators/cluster') diff --git a/xlators/cluster/ec/src/ec-method.h b/xlators/cluster/ec/src/ec-method.h index 085de8f4b17..29b46e10443 100644 --- a/xlators/cluster/ec/src/ec-method.h +++ b/xlators/cluster/ec/src/ec-method.h @@ -13,7 +13,10 @@ #include "ec-gf.h" +/* Determines the maximum size of the matrix used to encode/decode data */ #define EC_METHOD_MAX_FRAGMENTS 16 +/* Determines the maximum number of usable elements in the Galois Field */ +#define EC_METHOD_MAX_NODES (EC_GF_SIZE - 1) #define EC_METHOD_WORD_SIZE 64 diff --git a/xlators/cluster/ec/src/ec.c b/xlators/cluster/ec/src/ec.c index c702ce3f0fd..c6d3b9fe718 100644 --- a/xlators/cluster/ec/src/ec.c +++ b/xlators/cluster/ec/src/ec.c @@ -23,7 +23,7 @@ * using the rule that redundancy cannot be equal or greater than the number * of fragments. */ -#define EC_MAX_NODES (EC_MAX_FRAGMENTS + ((EC_MAX_FRAGMENTS - 1) / 2)) +#define EC_MAX_NODES min(EC_MAX_FRAGMENTS * 2 - 1, EC_METHOD_MAX_NODES) int32_t ec_parse_options(xlator_t * this) { -- cgit