summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-inode-read.c
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2011-01-27 05:23:30 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-01-27 03:16:51 -0800
commit73bce15b61755509de23d32646135254d369a2f6 (patch)
tree921b92f6d3e549b1e6dd68bc886cc727caec5429 /xlators/cluster/afr/src/afr-inode-read.c
parent11dd59b788334fe2de1653ae85395986ba531606 (diff)
adding libxlator, to ensure proper client side aggregation of marks by clustering translators
Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2310 (georeplication) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2310
Diffstat (limited to 'xlators/cluster/afr/src/afr-inode-read.c')
-rw-r--r--xlators/cluster/afr/src/afr-inode-read.c74
1 files changed, 71 insertions, 3 deletions
diff --git a/xlators/cluster/afr/src/afr-inode-read.c b/xlators/cluster/afr/src/afr-inode-read.c
index 3998607672a..ce6a6a363ed 100644
--- a/xlators/cluster/afr/src/afr-inode-read.c
+++ b/xlators/cluster/afr/src/afr-inode-read.c
@@ -657,6 +657,15 @@ out:
}
int32_t
+afr_getxattr_unwind (void *arg, call_frame_t *frame,
+ int op_ret, int op_errno, dict_t *dict)
+
+{
+ AFR_STACK_UNWIND (getxattr, frame, op_ret, op_errno, dict);
+ return 0;
+}
+
+int32_t
afr_getxattr (call_frame_t *frame, xlator_t *this,
loc_t *loc, const char *name)
{
@@ -664,8 +673,11 @@ afr_getxattr (call_frame_t *frame, xlator_t *this,
xlator_t ** children = NULL;
int call_child = 0;
afr_local_t * local = NULL;
+ xlator_list_t * trav = NULL;
+ xlator_t ** sub_volumes= NULL;
int read_child = -1;
+ int i = 0;
int32_t op_ret = -1;
int32_t op_errno = 0;
@@ -683,6 +695,11 @@ afr_getxattr (call_frame_t *frame, xlator_t *this,
ALLOC_OR_GOTO (local, afr_local_t, out);
frame->local = local;
+ loc_copy (&local->loc, loc);
+ if (name)
+ local->cont.getxattr.name = gf_strdup (name);
+
+
if (name) {
if (!strncmp (name, AFR_XATTR_PREFIX,
strlen (AFR_XATTR_PREFIX))) {
@@ -690,6 +707,60 @@ afr_getxattr (call_frame_t *frame, xlator_t *this,
op_errno = ENODATA;
goto out;
}
+ if ((strcmp (GF_XATTR_MARKER_KEY, name) == 0)
+ && (-1 == frame->root->pid)) {
+
+ local->marker.call_count = priv->child_count;
+
+ sub_volumes = alloca ( priv->child_count * sizeof (xlator_t *));
+ for (i = 0, trav = this->children; trav ;
+ trav = trav->next, i++) {
+
+ *(sub_volumes + i) = trav->xlator;
+ }
+
+ if (cluster_getmarkerattr (frame, this, loc, name,
+ local, afr_getxattr_unwind,
+ sub_volumes,
+ priv->child_count,
+ MARKER_UUID_TYPE,
+ priv->vol_uuid)) {
+
+ op_errno = EINVAL;
+ goto out;
+ }
+
+ return 0;
+ }
+
+ if (*priv->vol_uuid) {
+ if ((match_uuid_local (name, priv->vol_uuid) == 0)
+ && (-1 == frame->root->pid)) {
+
+ local->marker.call_count = priv->child_count;
+
+ sub_volumes = alloca ( priv->child_count * sizeof (xlator_t *));
+ for (i = 0, trav = this->children; trav ;
+ trav = trav->next, i++) {
+
+ *(sub_volumes + i) = trav->xlator;
+
+ }
+
+ if (cluster_getmarkerattr (frame, this, loc,
+ name, local,
+ afr_getxattr_unwind,
+ sub_volumes,
+ priv->child_count,
+ MARKER_XTIME_TYPE,
+ priv->vol_uuid)) {
+ op_errno = EINVAL;
+ goto out;
+ }
+
+ return 0;
+ }
+ }
}
@@ -712,9 +783,6 @@ afr_getxattr (call_frame_t *frame, xlator_t *this,
local->cont.getxattr.last_tried = call_child;
}
- loc_copy (&local->loc, loc);
- if (name)
- local->cont.getxattr.name = gf_strdup (name);
STACK_WIND_COOKIE (frame, afr_getxattr_cbk,
(void *) (long) call_child,