summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-self-heal-name.c
diff options
context:
space:
mode:
authorAnuradha <atalur@redhat.com>2014-09-03 19:04:02 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2014-09-03 10:30:26 -0700
commit6064c220844e8c4963e22ec48c8f7da9da57fc2f (patch)
tree9f5be98553d381783cab091650a739db8a100bb2 /xlators/cluster/afr/src/afr-self-heal-name.c
parentbb2d5f49b5684e6484af16a580870cfe104aecd2 (diff)
cluster/afr : Mark pending changelog xattrs for new creations
Based on type of file, set appropriate pending changelogs for new entries. Change-Id: Ifd124bf9bc54b996ce83ab9f39d03b3ccca7eb3c BUG: 1130892 Signed-off-by: Anuradha <atalur@redhat.com> Reviewed-on: http://review.gluster.org/8555 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-name.c')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-name.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-name.c b/xlators/cluster/afr/src/afr-self-heal-name.c
index f8b887e9a24..a3020f4e1a7 100644
--- a/xlators/cluster/afr/src/afr-self-heal-name.c
+++ b/xlators/cluster/afr/src/afr-self-heal-name.c
@@ -17,7 +17,6 @@
#include "afr.h"
#include "afr-self-heal.h"
-
int
__afr_selfheal_assign_gfid (xlator_t *this, inode_t *parent, uuid_t pargfid,
const char *bname, inode_t *inode,
@@ -105,17 +104,22 @@ out:
return ret;
}
-
int
-__afr_selfheal_name_impunge (xlator_t *this, inode_t *parent, uuid_t pargfid,
+__afr_selfheal_name_impunge (call_frame_t *frame, xlator_t *this,
+ inode_t *parent, uuid_t pargfid,
const char *bname, inode_t *inode,
struct afr_reply *replies, int gfid_idx)
{
int i = 0;
afr_private_t *priv = NULL;
- int ret = 0;
+ int ret = 0;
+ unsigned char *newentry = NULL;
+ unsigned char *sources = NULL;
- priv = this->private;
+ priv = this->private;
+
+ newentry = alloca0 (priv->child_count);
+ sources = alloca0 (priv->child_count);
uuid_copy (parent->gfid, pargfid);
@@ -124,13 +128,19 @@ __afr_selfheal_name_impunge (xlator_t *this, inode_t *parent, uuid_t pargfid,
continue;
if (uuid_compare (replies[i].poststat.ia_gfid,
- replies[gfid_idx].poststat.ia_gfid) == 0)
+ replies[gfid_idx].poststat.ia_gfid) == 0) {
+ sources[i] = 1;
continue;
+ }
ret |= afr_selfheal_recreate_entry (this, i, gfid_idx, parent,
- bname, inode, replies);
+ bname, inode, replies,
+ newentry);
}
+ if (AFR_COUNT (newentry, priv->child_count))
+ afr_selfheal_newentry_mark (frame, this, inode, gfid_idx, replies,
+ sources, newentry);
return ret;
}
@@ -381,8 +391,8 @@ out:
}
int
-__afr_selfheal_name_do (xlator_t *this, inode_t *parent, uuid_t pargfid,
- const char *bname, inode_t *inode,
+__afr_selfheal_name_do (call_frame_t *frame, xlator_t *this, inode_t *parent,
+ uuid_t pargfid, const char *bname, inode_t *inode,
unsigned char *sources, unsigned char *sinks,
unsigned char *healed_sinks, int source,
unsigned char *locked_on, struct afr_reply *replies,
@@ -438,7 +448,8 @@ __afr_selfheal_name_do (xlator_t *this, inode_t *parent, uuid_t pargfid,
return -1;
}
- return __afr_selfheal_name_impunge (this, parent, pargfid, bname, inode,
+ return __afr_selfheal_name_impunge (frame, this, parent, pargfid,
+ bname, inode,
replies, gfid_idx);
}
@@ -579,10 +590,10 @@ afr_selfheal_name_do (call_frame_t *frame, xlator_t *this, inode_t *parent,
goto unlock;
}
- ret = __afr_selfheal_name_do (this, parent, pargfid, bname,
- inode, sources, sinks, healed_sinks,
- source, locked_on, replies,
- gfid_req);
+ ret = __afr_selfheal_name_do (frame, this, parent, pargfid,
+ bname, inode, sources, sinks,
+ healed_sinks, source, locked_on,
+ replies, gfid_req);
}
unlock:
afr_selfheal_unentrylk (frame, this, parent, this->name, bname,