diff options
author | Tushar Gohad <tushar.gohad@intel.com> | 2014-09-30 06:35:03 -0700 |
---|---|---|
committer | Tushar Gohad <tushar.gohad@intel.com> | 2014-09-30 07:15:16 -0700 |
commit | 032b57d9b1c7aadc547fccbacf88af786c9067e7 (patch) | |
tree | f007a6716585434a77de352601a6525428939c7b /src/erasurecode_helpers.c | |
parent | 6c8d66e68beee67f81812a21cc69d73ff7b2b0b5 (diff) | |
download | liberasurecode-backend_metadata_adder.tar.gz |
Add support for custom backend metadatabackend_metadata_adder
A backend may have the need to add custom metadata to the
encoded data/parity fragments, in addition to the
liberasurecode "fragment metadata headers". This patch
gives the ability to a EC backend writer to specify a
"metadata adder" that is taken into account when allocating
output data/parity fragment buffers.
Signed-off-by: Tushar Gohad <tushar.gohad@intel.com>
Diffstat (limited to 'src/erasurecode_helpers.c')
-rw-r--r-- | src/erasurecode_helpers.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/erasurecode_helpers.c b/src/erasurecode_helpers.c index 6e4c882..42877eb 100644 --- a/src/erasurecode_helpers.c +++ b/src/erasurecode_helpers.c @@ -103,14 +103,20 @@ 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 backend metadata in the fragment size */ + size += instance->common.metadata_adder; + } + + /* liberasurecode metadata */ size += sizeof(fragment_header_t); - buf = get_aligned_buffer16(size); + buf = get_aligned_buffer16(size); if (buf) { header = (fragment_header_t *) buf; header->magic = LIBERASURECODE_FRAG_HEADER_MAGIC; |