summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-dir-write.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-dir-write.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-dir-write.c')
-rw-r--r--xlators/cluster/afr/src/afr-dir-write.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c
index a9f272126ae..f5c385c34a4 100644
--- a/xlators/cluster/afr/src/afr-dir-write.c
+++ b/xlators/cluster/afr/src/afr-dir-write.c
@@ -278,8 +278,6 @@ afr_mark_new_entry_changelog (call_frame_t *frame, xlator_t *this)
dict_t *xattr = NULL;
int32_t **changelog = NULL;
int i = 0;
- int idx = -1;
- int m_idx = 0;
int op_errno = ENOMEM;
unsigned char *pending = NULL;
int call_count = 0;
@@ -295,22 +293,10 @@ afr_mark_new_entry_changelog (call_frame_t *frame, xlator_t *this)
if (!new_local)
goto out;
- changelog = afr_matrix_create (priv->child_count, AFR_NUM_CHANGE_LOGS);
- if (!changelog)
- goto out;
-
- new_local->pending = changelog;
xattr = dict_new ();
if (!xattr)
goto out;
- if (IA_ISREG (local->cont.dir_fop.buf.ia_type)) {
- idx = afr_index_for_transaction_type (AFR_DATA_TRANSACTION);
- } else if (IA_ISDIR (local->cont.dir_fop.buf.ia_type)) {
- idx = afr_index_for_transaction_type (AFR_ENTRY_TRANSACTION);
- }
- m_idx = afr_index_for_transaction_type (AFR_METADATA_TRANSACTION);
-
pending = alloca0 (priv->child_count);
for (i = 0; i < priv->child_count; i++) {
@@ -319,19 +305,19 @@ afr_mark_new_entry_changelog (call_frame_t *frame, xlator_t *this)
call_count ++;
continue;
}
-
- changelog[i][m_idx] = hton32(1);
- if (idx != -1)
- changelog[i][idx] = hton32(1);
pending[i] = 1;
}
+ changelog = afr_mark_pending_changelog (priv, pending, xattr,
+ local->cont.dir_fop.buf.ia_type);
+ if (!changelog)
+ goto out;
+
+ new_local->pending = changelog;
+ changelog = NULL;
uuid_copy (new_local->loc.gfid, local->cont.dir_fop.buf.ia_gfid);
new_local->loc.inode = inode_ref (local->inode);
-
- afr_set_pending_dict (priv, xattr, changelog);
-
new_local->call_count = call_count;
for (i = 0; i < priv->child_count; i++) {
@@ -349,6 +335,8 @@ afr_mark_new_entry_changelog (call_frame_t *frame, xlator_t *this)
new_frame = NULL;
out:
+ if (changelog)
+ afr_matrix_cleanup (changelog, priv->child_count);
if (new_frame)
AFR_STACK_DESTROY (new_frame);
if (xattr)