From 5a06a9eef3f767c850e879ff87c72301e02fe137 Mon Sep 17 00:00:00 2001 From: vmallika Date: Wed, 18 Nov 2015 17:25:14 +0530 Subject: quota: fix backward compatibility of quota xattr version quota-version features is implemented for 3.7.6 please see below patch for more details: http://review.gluster.org/#/c/12386 Problem is when quota is already enabled, we suffix 0 to contri xattr key. for backward compatibility don't add suffix if quota-version is 0 Change-Id: Id7d713b18d989e4e86019969eb511617848127f2 BUG: 1283567 Signed-off-by: vmallika Reviewed-on: http://review.gluster.org/12660 Tested-by: Gluster Build System Tested-by: NetBSD Build System Reviewed-by: Raghavendra G --- xlators/features/marker/src/marker-quota.h | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'xlators/features/marker/src') diff --git a/xlators/features/marker/src/marker-quota.h b/xlators/features/marker/src/marker-quota.h index dc953704d11..319fafd9983 100644 --- a/xlators/features/marker/src/marker-quota.h +++ b/xlators/features/marker/src/marker-quota.h @@ -56,33 +56,33 @@ ret = 0; \ } while (0); -#define GET_CONTRI_KEY(_this, var, _gfid, _ret) \ +#define GET_QUOTA_KEY(_this, var, key, _ret) \ do { \ marker_conf_t *_priv = _this->private; \ + if (_priv->version > 0) \ + _ret = snprintf (var, QUOTA_KEY_MAX, "%s.%d", \ + key, _priv->version); \ + else \ + _ret = snprintf (var, QUOTA_KEY_MAX, "%s", key); \ + } while (0) + +#define GET_CONTRI_KEY(_this, var, _gfid, _ret) \ + do { \ + char _tmp_var[QUOTA_KEY_MAX] = {0, }; \ if (_gfid != NULL) { \ char _gfid_unparsed[40]; \ gf_uuid_unparse (_gfid, _gfid_unparsed); \ - _ret = snprintf (var, QUOTA_KEY_MAX, \ + _ret = snprintf (_tmp_var, QUOTA_KEY_MAX, \ QUOTA_XATTR_PREFIX \ - ".%s.%s." CONTRIBUTION ".%d", \ - "quota", _gfid_unparsed, \ - _priv->version); \ + ".%s.%s." CONTRIBUTION, \ + "quota", _gfid_unparsed); \ } else { \ - _ret = snprintf (var, QUOTA_KEY_MAX, \ + _ret = snprintf (_tmp_var, QUOTA_KEY_MAX, \ QUOTA_XATTR_PREFIX \ - ".%s.." CONTRIBUTION ".%d", \ - "quota", _priv->version); \ + ".%s.." CONTRIBUTION, \ + "quota"); \ } \ - } while (0) - -#define GET_QUOTA_KEY(_this, var, key, _ret) \ - do { \ - marker_conf_t *_priv = _this->private; \ - if (_priv->version > 0) \ - _ret = snprintf (var, QUOTA_KEY_MAX, "%s.%d", \ - key, _priv->version); \ - else \ - _ret = snprintf (var, QUOTA_KEY_MAX, "%s", key); \ + GET_QUOTA_KEY (_this, var, _tmp_var, _ret); \ } while (0) #define GET_SIZE_KEY(_this, var, _ret) \ -- cgit