summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-common.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-common.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-common.c')
-rw-r--r--xlators/cluster/afr/src/afr-common.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 2a6b0c957fb..e9a05de2546 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -3684,3 +3684,38 @@ afr_handle_open_fd_count (call_frame_t *frame, xlator_t *this)
fd_ctx->open_fd_count = local->open_fd_count;
}
+
+int**
+afr_mark_pending_changelog (afr_private_t *priv, unsigned char *pending,
+ dict_t *xattr, ia_type_t iat)
+{
+ int i = 0;
+ int **changelog = NULL;
+ int idx = -1;
+ int m_idx = 0;
+ int ret = 0;
+
+ m_idx = afr_index_for_transaction_type (AFR_METADATA_TRANSACTION);
+
+ idx = afr_index_from_ia_type (iat);
+
+ changelog = afr_matrix_create (priv->child_count, AFR_NUM_CHANGE_LOGS);
+ if (!changelog)
+ goto out;
+
+ for (i = 0; i < priv->child_count; i++) {
+ if (!pending[i])
+ continue;
+
+ changelog[i][m_idx] = hton32(1);
+ if (idx != -1)
+ changelog[i][idx] = hton32(1);
+ }
+ ret = afr_set_pending_dict (priv, xattr, changelog);
+ if (ret < 0) {
+ afr_matrix_cleanup (changelog, priv->child_count);
+ return NULL;
+ }
+out:
+ return changelog;
+}