From ab99355f55ce8a55d5c9b339ced830723be5f213 Mon Sep 17 00:00:00 2001 From: Vikas Gorur Date: Tue, 1 Dec 2009 06:11:04 +0000 Subject: cluster/afr: Set the self-heal "source" as read subvolume even when not doing self-heal. This patch sets the read-subvolume equal to the self-heal "source" even if we're not doing self-heal (because some one else is already doing it). Signed-off-by: Vikas Gorur Signed-off-by: Anand V. Avati BUG: 320 (Improve self-heal performance) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=320 --- xlators/cluster/afr/src/afr-self-heal-data.c | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'xlators/cluster/afr/src/afr-self-heal-data.c') diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index 66a4249022e..eb0ee9b20b0 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -741,6 +741,38 @@ afr_sh_data_fix (call_frame_t *frame, xlator_t *this) } +int +afr_self_heal_get_source (xlator_t *this, afr_local_t *local, dict_t **xattr) +{ + afr_self_heal_t *sh = NULL; + afr_private_t *priv = NULL; + + int nsources = 0; + int source = 0; + int i = 0; + + sh = &local->self_heal; + priv = this->private; + + sh->pending_matrix = CALLOC (sizeof (int32_t *), priv->child_count); + for (i = 0; i < priv->child_count; i++) { + sh->pending_matrix[i] = CALLOC (sizeof (int32_t), + priv->child_count); + } + sh->sources = CALLOC (priv->child_count, sizeof (*sh->sources)); + + afr_sh_build_pending_matrix (priv, sh->pending_matrix, xattr, + priv->child_count, AFR_DATA_TRANSACTION); + + nsources = afr_sh_mark_sources (sh, priv->child_count, + AFR_SELF_HEAL_DATA); + + source = afr_sh_select_source (sh->sources, priv->child_count); + + return source; +} + + int afr_sh_data_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, -- cgit