diff options
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-common.c | 20 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-common.h | 2 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-data.c | 5 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-entry.c | 5 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-metadata.c | 5 |
5 files changed, 27 insertions, 10 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index 518907ac7..eba1099b3 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -466,12 +466,16 @@ out: void -afr_sh_pending_to_delta (int32_t *pending_matrix[], int32_t *delta_matrix[], - int success[], int child_count) +afr_sh_pending_to_delta (dict_t **xattr, char *key, + int32_t *delta_matrix[], int success[], + int child_count) { int i = 0; int j = 0; + int32_t * pending = NULL; + int ret = 0; + /* start clean */ for (i = 0; i < child_count; i++) { for (j = 0; j < child_count; j++) { @@ -480,10 +484,20 @@ afr_sh_pending_to_delta (int32_t *pending_matrix[], int32_t *delta_matrix[], } for (i = 0; i < child_count; i++) { + pending = NULL; + + ret = dict_get_ptr (xattr[i], (char *) key, + VOID (&pending)); + for (j = 0; j < child_count; j++) { if (!success[j]) continue; - delta_matrix[i][j] = -pending_matrix[i][j]; + + if (pending) { + delta_matrix[i][j] = -(ntoh32 (pending[j])); + } else { + delta_matrix[i][j] = 0; + } } } } diff --git a/xlators/cluster/afr/src/afr-self-heal-common.h b/xlators/cluster/afr/src/afr-self-heal-common.h index f3beff71f..df786e999 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.h +++ b/xlators/cluster/afr/src/afr-self-heal-common.h @@ -48,7 +48,7 @@ afr_sh_build_pending_matrix (int32_t *pending_matrix[], dict_t *xattr[], int child_count, const char *key); void -afr_sh_pending_to_delta (int32_t *pending_matrix[], int32_t *delta_matrix[], +afr_sh_pending_to_delta (dict_t **xattr, char *key, int32_t *delta_matrix[], int32_t success[], int child_count); int diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index bc13a43ab..8dad39257 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -302,8 +302,9 @@ afr_sh_data_erase_pending (call_frame_t *frame, xlator_t *this) priv = this->private; - afr_sh_pending_to_delta (sh->pending_matrix, sh->delta_matrix, - sh->success, priv->child_count); + afr_sh_pending_to_delta (sh->xattr, AFR_DATA_PENDING, + sh->delta_matrix, sh->success, + priv->child_count); erase_xattr = CALLOC (sizeof (*erase_xattr), priv->child_count); diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c index e7431249f..665dfb936 100644 --- a/xlators/cluster/afr/src/afr-self-heal-entry.c +++ b/xlators/cluster/afr/src/afr-self-heal-entry.c @@ -218,8 +218,9 @@ afr_sh_entry_erase_pending (call_frame_t *frame, xlator_t *this) priv = this->private; - afr_sh_pending_to_delta (sh->pending_matrix, sh->delta_matrix, - sh->success, priv->child_count); + afr_sh_pending_to_delta (sh->xattr, AFR_ENTRY_PENDING, + sh->delta_matrix, sh->success, + priv->child_count); erase_xattr = CALLOC (sizeof (*erase_xattr), priv->child_count); diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c index 4e58c5440..9ce42691a 100644 --- a/xlators/cluster/afr/src/afr-self-heal-metadata.c +++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c @@ -214,8 +214,9 @@ afr_sh_metadata_erase_pending (call_frame_t *frame, xlator_t *this) priv = this->private; - afr_sh_pending_to_delta (sh->pending_matrix, sh->delta_matrix, - sh->success, priv->child_count); + afr_sh_pending_to_delta (sh->xattr, AFR_METADATA_PENDING, + sh->delta_matrix, sh->success, + priv->child_count); erase_xattr = CALLOC (sizeof (*erase_xattr), priv->child_count); |