summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorXavier Hernandez <xhernandez@datalab.es>2014-10-24 15:03:12 +0200
committerVijay Bellur <vbellur@redhat.com>2014-10-28 01:39:18 -0700
commit42150856c117bd53427f297664106d8db771a33e (patch)
tree17639479bf16beea501b350a52a88ad133e1f85b /xlators
parent1fa3e87db77bb379173723a5e75b361a8e192f09 (diff)
ec: Correctly handle xtime extended attribute
Change-Id: I2bd34f063d6bf1835d5ae57a8e9aa03f3ec3deb3 BUG: 1156404 Signed-off-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-on: http://review.gluster.org/8972 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/ec/src/ec-combine.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/xlators/cluster/ec/src/ec-combine.c b/xlators/cluster/ec/src/ec-combine.c
index 93593fb8b6a..5468777f432 100644
--- a/xlators/cluster/ec/src/ec-combine.c
+++ b/xlators/cluster/ec/src/ec-combine.c
@@ -141,6 +141,7 @@ int32_t ec_dict_data_compare(dict_t * dict, char * key, data_t * value,
(strcmp(key, GF_XATTR_CLRLK_CMD) == 0) ||
(strcmp(key, GLUSTERFS_OPEN_FD_COUNT) == 0) ||
(fnmatch(GF_XATTR_STIME_PATTERN, key, 0) == 0) ||
+ (fnmatch(MARKER_XATTR_PREFIX ".*." XTIME, key, 0) == 0) ||
(XATTR_IS_NODE_UUID(key)))
{
return 0;
@@ -461,7 +462,7 @@ int32_t ec_dict_data_uuid(ec_cbk_data_t * cbk, int32_t which, char * key)
return 0;
}
-int32_t ec_dict_data_max(ec_cbk_data_t * cbk, int32_t which, char * key)
+int32_t ec_dict_data_max32(ec_cbk_data_t *cbk, int32_t which, char *key)
{
data_t * data[cbk->count];
dict_t * dict;
@@ -498,6 +499,38 @@ int32_t ec_dict_data_max(ec_cbk_data_t * cbk, int32_t which, char * key)
return 0;
}
+int32_t ec_dict_data_max64(ec_cbk_data_t *cbk, int32_t which, char *key)
+{
+ data_t *data[cbk->count];
+ dict_t *dict;
+ int32_t i, num;
+ uint64_t max, tmp;
+
+ num = cbk->count;
+ if (!ec_dict_list(data, &num, cbk, which, key)) {
+ return -1;
+ }
+
+ if (num <= 1) {
+ return 0;
+ }
+
+ max = data_to_uint64(data[0]);
+ for (i = 1; i < num; i++) {
+ tmp = data_to_uint64(data[i]);
+ if (max < tmp) {
+ max = tmp;
+ }
+ }
+
+ dict = (which == EC_COMBINE_XDATA) ? cbk->xdata : cbk->dict;
+ if (dict_set_uint64(dict, key, max) != 0) {
+ return -1;
+ }
+
+ return 0;
+}
+
int32_t ec_dict_data_stime(ec_cbk_data_t * cbk, int32_t which, char * key)
{
data_t * data[cbk->count];
@@ -550,7 +583,7 @@ int32_t ec_dict_data_combine(dict_t * dict, char * key, data_t * value,
if (strcmp(key, GLUSTERFS_OPEN_FD_COUNT) == 0)
{
- return ec_dict_data_max(data->cbk, data->which, key);
+ return ec_dict_data_max32(data->cbk, data->which, key);
}
if (XATTR_IS_NODE_UUID(key))
@@ -563,6 +596,10 @@ int32_t ec_dict_data_combine(dict_t * dict, char * key, data_t * value,
return ec_dict_data_stime(data->cbk, data->which, key);
}
+ if (fnmatch(MARKER_XATTR_PREFIX ".*." XTIME, key, FNM_NOESCAPE) == 0) {
+ return ec_dict_data_max64(data->cbk, data->which, key);
+ }
+
return 0;
}