Merge pull request #47 from harshavardhana/pr_out_erasure_restructuring
Erasure restructuringmaster
commit
c2b8fee677
@ -0,0 +1,25 @@ |
|||||||
|
/*
|
||||||
|
* Mini Object Storage, (C) 2014 Minio, Inc. |
||||||
|
* |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
#ifndef __DECODE_H__ |
||||||
|
#define __DECODE_H__ |
||||||
|
|
||||||
|
int minio_init_decoder (int *src_err_list, |
||||||
|
unsigned char *encoding_matrix, |
||||||
|
unsigned char **decode_matrix, |
||||||
|
unsigned char **decode_tbls, |
||||||
|
int k, int n, int errs); |
||||||
|
#endif /* __DECODE_H__ */ |
@ -0,0 +1,75 @@ |
|||||||
|
/*
|
||||||
|
* Mini Object Storage, (C) 2014 Minio, Inc. |
||||||
|
* |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <stdlib.h> |
||||||
|
#include <stdio.h> |
||||||
|
|
||||||
|
#include <erasure-code.h> |
||||||
|
#include "encode.h" |
||||||
|
|
||||||
|
void 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, *tmp_tbls; |
||||||
|
|
||||||
|
encode_matrix_size = k * (k + m); |
||||||
|
encode_tbls_size = k * (k + m) * 32; |
||||||
|
|
||||||
|
tmp_matrix = (unsigned char *) malloc (encode_matrix_size); |
||||||
|
tmp_tbls = (unsigned char *) malloc (encode_tbls_size); |
||||||
|
|
||||||
|
if (technique == 0) { |
||||||
|
/*
|
||||||
|
Commonly used method for choosing coefficients in erasure |
||||||
|
encoding but does not guarantee invertable for every sub |
||||||
|
matrix. For large k it is possible to find cases where the |
||||||
|
decode matrix chosen from sources and parity not in erasure |
||||||
|
are not invertable. Users may want to adjust for k > 5. |
||||||
|
-- Intel |
||||||
|
*/ |
||||||
|
gf_gen_rs_matrix (tmp_matrix, k + m, k); |
||||||
|
} else if (technique == 1) { |
||||||
|
gf_gen_cauchy1_matrix (tmp_matrix, k + m, k); |
||||||
|
} |
||||||
|
|
||||||
|
ec_init_tables(k, m, &tmp_matrix[k * k], tmp_tbls); |
||||||
|
|
||||||
|
*encode_matrix = tmp_matrix; |
||||||
|
*encode_tbls = tmp_tbls; |
||||||
|
} |
||||||
|
|
||||||
|
unsigned int calc_chunk_size (int k, unsigned int split_len) |
||||||
|
{ |
||||||
|
int alignment; |
||||||
|
int remainder; |
||||||
|
int padded_len; |
||||||
|
|
||||||
|
alignment = k * SIMD_ALIGN; |
||||||
|
remainder = split_len % alignment; |
||||||
|
|
||||||
|
padded_len = split_len; |
||||||
|
if (remainder) { |
||||||
|
padded_len = split_len + (alignment - remainder); |
||||||
|
} |
||||||
|
return padded_len / k; |
||||||
|
} |
||||||
|
/*
|
||||||
|
void minio_encode (int k, int m, ) |
||||||
|
{ |
||||||
|
*/ |
Loading…
Reference in new issue