diff options
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/afr/src/afr.c | 26 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.h | 32 |
2 files changed, 29 insertions, 29 deletions
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index b65a4dc466d..befc182b6ab 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -330,32 +330,6 @@ afr_frame_return (call_frame_t *frame) return call_count; } -/** - * first_up_child - return the index of the first child that is up - */ - -int -afr_first_up_child (afr_private_t *priv) -{ - xlator_t ** children = NULL; - int ret = -1; - int i = 0; - - LOCK (&priv->lock); - { - children = priv->children; - for (i = 0; i < priv->child_count; i++) { - if (priv->child_up[i]) { - ret = i; - break; - } - } - } - UNLOCK (&priv->lock); - - return ret; -} - /** * up_children_count - return the number of children that are up diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 37dc139599e..a708f7d0a35 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -514,9 +514,6 @@ afr_up_children_count (int child_count, unsigned char *child_up); int afr_locked_nodes_count (unsigned char *locked_nodes, int child_count); -int -afr_first_up_child (afr_private_t *priv); - ino64_t afr_itransform (ino64_t ino, int child_count, int child_index); @@ -592,11 +589,40 @@ AFR_LOCAL_INIT (afr_local_t *local, afr_private_t *priv) } +/** + * first_up_child - return the index of the first child that is up + */ + +static inline int +afr_first_up_child (afr_private_t *priv) +{ + xlator_t ** children = NULL; + int ret = -1; + int i = 0; + + LOCK (&priv->lock); + { + children = priv->children; + for (i = 0; i < priv->child_count; i++) { + if (priv->child_up[i]) { + ret = i; + break; + } + } + } + UNLOCK (&priv->lock); + + return ret; +} + + static inline int afr_transaction_local_init (afr_local_t *local, afr_private_t *priv) { int i; + local->first_up_child = afr_first_up_child (priv); + local->child_errno = CALLOC (sizeof (*local->child_errno), priv->child_count); if (!local->child_errno) { |