diff options
Diffstat (limited to 'src/erasurecode_helpers.c')
-rw-r--r-- | src/erasurecode_helpers.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/erasurecode_helpers.c b/src/erasurecode_helpers.c index 54e711b..f0f3fe0 100644 --- a/src/erasurecode_helpers.c +++ b/src/erasurecode_helpers.c @@ -116,11 +116,16 @@ void * check_and_free_buffer(void * buf) return NULL; } -char *alloc_fragment_buffer(int size) +char *alloc_fragment_buffer(ec_backend_t instance, int size) { char *buf; fragment_header_t *header = NULL; + if (NULL != instance){ + /* Account for any custom metadata the backend wants to add in data_len */ + size += instance->common.metadata_adder; + } + size += sizeof(fragment_header_t); buf = get_aligned_buffer16(size); @@ -188,9 +193,6 @@ int get_aligned_data_size(ec_backend_t instance, int data_len) int alignment_multiple; int aligned_size = 0; - /* Account for any custom metadata the backend wants to add in data_len */ - data_len += instance->common.metadata_adder; - /* * For Cauchy reed-solomon align to k*word_size*packet_size * For Vandermonde reed-solomon and flat-XOR, align to k*word_size |