Merge pull request #872 from harshavardhana/fix-decoding-failure

Fix Linux/Mac OS X erasure decoding failure with new Golang version 1…
master
Harshavardhana 9 years ago
commit 43eac57c7e
  1. 24
      pkg/erasure/ec_minio_decode.c
  2. 2
      pkg/erasure/ec_minio_encode.c
  3. 1
      pkg/erasure/erasure_encode.go

@ -80,12 +80,18 @@ int minio_init_decoder (int32_t *error_index,
unsigned char **decode_tbls,
uint32_t **decode_index)
{
int i, j, r, s, l, z;
unsigned char input_matrix[k * n];
unsigned char inverse_matrix[k * n];
unsigned char tmp_decode_matrix[k * n];
unsigned char tmp_decode_tbls[k * n * 32];
uint32_t tmp_decode_index[k];
int i, j, r, l;
uint32_t *tmp_decode_index = (uint32_t *) malloc(sizeof(uint32_t) * k);
unsigned char *input_matrix;
unsigned char *inverse_matrix;
unsigned char *tmp_decode_matrix;
unsigned char *tmp_decode_tbls;
input_matrix = (unsigned char *) malloc(sizeof(unsigned char) * k * n);
inverse_matrix = (unsigned char *) malloc(sizeof(unsigned char) * k * n);
tmp_decode_matrix = (unsigned char *) malloc(sizeof(unsigned char) * k * n);;
tmp_decode_tbls = (unsigned char *) malloc(sizeof(unsigned char) * k * n * 32);
for (i = 0, r = 0; i < k; i++, r++) {
while (_minio_src_index_in_error(r, error_index, errs))
@ -98,6 +104,9 @@ int minio_init_decoder (int32_t *error_index,
// Not all vandermonde matrix can be inverted
if (gf_invert_matrix(input_matrix, inverse_matrix, k) < 0) {
free(tmp_decode_matrix);
free(tmp_decode_tbls);
free(tmp_decode_index);
return -1;
}
@ -110,10 +119,9 @@ int minio_init_decoder (int32_t *error_index,
error_index[l] + j];
}
} else {
int s = 0;
// decoding matrix element for coding chunks
for (i = 0; i < k; i++) {
s = 0;
unsigned char s = 0;
for (j = 0; j < k; j++) {
s ^= gf_mul(inverse_matrix[j * k + i],
encode_matrix[k *

@ -28,8 +28,6 @@ int32_t minio_init_encoder (int technique, int k, int m,
unsigned char **encode_matrix,
unsigned char **encode_tbls)
{
size_t encode_matrix_size;
size_t encode_tbls_size;
unsigned char *tmp_matrix;
unsigned char *tmp_tbls;

@ -16,7 +16,6 @@
package erasure
// #cgo CFLAGS: -O0
// #include <stdlib.h>
// #include "ec_isal-l.h"
// #include "ec_minio_common.h"

Loading…
Cancel
Save