summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-04-09 03:53:26 -0700
committerAnand V. Avati <avati@amp.gluster.com>2009-04-09 18:57:01 +0530
commitec35b79f746d8a9451d7a3b9894025fdad7382f4 (patch)
tree9396c57dfee291eee6539dd602a34ef2b59d04bc
parent445b57bf7207107a9ef078697b7d03bb9349747a (diff)
Erase xattr during self-heal based on original dict.
Decrement xattr during self-heal based on the original dict instead of pending_matrix, as the pending_matrix might have been altered later. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.c20
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.h2
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-data.c5
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-entry.c5
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-metadata.c5
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);