summaryrefslogtreecommitdiffstats
path: root/xlators/features/marker/src/marker-quota.h
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2015-11-18 17:25:14 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-11-23 22:04:24 -0800
commit5a06a9eef3f767c850e879ff87c72301e02fe137 (patch)
treee1ad1351f0af25a126983a437fcf64ecc87dde4e /xlators/features/marker/src/marker-quota.h
parent31f0fd1d401f1a4c007fd44854f99f15aff2346b (diff)
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 <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/12660 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/features/marker/src/marker-quota.h')
-rw-r--r--xlators/features/marker/src/marker-quota.h36
1 files changed, 18 insertions, 18 deletions
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) \