From c4440ab8c7417a3bcaadf1cb150476d5ff6a1325 Mon Sep 17 00:00:00 2001 From: Xavier Hernandez Date: Thu, 18 Sep 2014 16:50:47 +0200 Subject: ec: Add config information in an xattr To simplify backward compatibility of the ec xlator when some parameter or the implementation itself is changed, a new xattr is added to each file with the configuration needed to recover it. The new attribute is called 'trusted.ec.config', and it's a 64-bit value containing the following information: 8 bits: version of the config information (currently always 0) 8 bits: algorithm used to encode the file (currently always 0) 8 bits: size of the galois field (currently always 8) 8 bits: number of bricks 8 bits: redundancy 24 bits: chunk size (currently 512) This new xattr could allow, in a future version, to have different configurations per file. This is a backport of http://review.gluster.org/8770/ Change-Id: I8c12d40ff546cc201fc66caa367484be3d48aeb4 BUG: 1140862 Signed-off-by: Xavier Hernandez Reviewed-on: http://review.gluster.org/8825 Reviewed-by: Dan Lambright Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/cluster/ec/src/ec-helpers.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'xlators/cluster/ec/src/ec-helpers.h') diff --git a/xlators/cluster/ec/src/ec-helpers.h b/xlators/cluster/ec/src/ec-helpers.h index 3010ea856de..044e6239e8b 100644 --- a/xlators/cluster/ec/src/ec-helpers.h +++ b/xlators/cluster/ec/src/ec-helpers.h @@ -36,6 +36,8 @@ size_t ec_iov_copy_to(void * dst, struct iovec * vector, int32_t count, int32_t ec_dict_set_number(dict_t * dict, char * key, uint64_t value); int32_t ec_dict_del_number(dict_t * dict, char * key, uint64_t * value); +int32_t ec_dict_set_config(dict_t * dict, char * key, ec_config_t * config); +int32_t ec_dict_del_config(dict_t * dict, char * key, ec_config_t * config); int32_t ec_loc_parent(xlator_t * xl, loc_t * loc, loc_t * parent, char ** name); @@ -56,4 +58,9 @@ ec_fd_t * ec_fd_get(fd_t * fd, xlator_t * xl); uint32_t ec_adjust_offset(ec_t * ec, off_t * offset, int32_t scale); uint64_t ec_adjust_size(ec_t * ec, uint64_t size, int32_t scale); +static inline int32_t ec_is_power_of_2(uint32_t value) +{ + return (value != 0) && ((value & (value - 1)) == 0); +} + #endif /* __EC_HELPERS_H__ */ -- cgit