diff options
author | Anuradha <atalur@redhat.com> | 2014-09-03 19:04:02 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-09-18 11:05:47 -0700 |
commit | acc0b3f93e74e914ee345e9e89619c8411596bdf (patch) | |
tree | 14a35cd56cae70fbe433cb5b4e073dce5065d0eb /xlators/cluster/afr/src/afr-common.c | |
parent | 8f4c223c5f7a7a06c3b73dbb94e85d271bd84fb5 (diff) |
cluster/afr : Mark pending changelog xattrs for new creations
Backport of: http://review.gluster.org/8555
Based on type of file, set appropriate pending changelogs
for new entries.
Change-Id: Icf9af866fe9a9e511210e8ad097e968e2307d8ee
BUG: 1141787
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>
Signed-off-by: Anuradha <atalur@redhat.com>
Reviewed-on: http://review.gluster.org/8748
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-common.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 35 |
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 e8e6e929c60..0b2285afb68 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -3795,3 +3795,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; +} |