summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-11-12 08:44:15 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-11-13 02:13:39 -0800
commit4717e5279e169a36a870a267039e788cf22602a8 (patch)
treed1749e453e0c47386ff049ad340e427b6829e641 /xlators/cluster/afr
parentb526009f2f5ad813ec88602a3d4fd2ff322809a0 (diff)
cluster/afr: Refactored inode context bitmasks.
Defined symbolic constants for the bit masks and made 'split-brain' a single bit field in the ctx. Signed-off-by: Vikas Gorur <vikas@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 249 (Self heal of a file that does not exist on the first subvolume) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=249
Diffstat (limited to 'xlators/cluster/afr')
-rw-r--r--xlators/cluster/afr/src/afr.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index 9f8ce884e..c56ce314a 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -56,6 +56,10 @@
#include "afr-self-heal.h"
+#define AFR_ICTX_SPLIT_BRAIN_MASK 0x0000000100000000ULL
+#define AFR_ICTX_READ_CHILD_MASK 0x00000000FFFFFFFFULL
+
+
uint64_t
afr_is_split_brain (xlator_t *this, inode_t *inode)
{
@@ -73,7 +77,7 @@ afr_is_split_brain (xlator_t *this, inode_t *inode)
if (ret < 0)
goto unlock;
- split_brain = ctx & 0xFFFFFFFF00000000ULL;
+ split_brain = ctx & AFR_ICTX_SPLIT_BRAIN_MASK;
}
unlock:
UNLOCK (&inode->lock);
@@ -99,8 +103,8 @@ afr_set_split_brain (xlator_t *this, inode_t *inode, int32_t split_brain)
ctx = 0;
}
- ctx = (0x00000000FFFFFFFFULL & ctx)
- | (split_brain & 0xFFFFFFFF00000000ULL);
+ ctx = (~AFR_ICTX_SPLIT_BRAIN_MASK & ctx)
+ | (split_brain & AFR_ICTX_SPLIT_BRAIN_MASK);
__inode_ctx_put (inode, this, ctx);
}
@@ -127,7 +131,7 @@ afr_read_child (xlator_t *this, inode_t *inode)
if (ret < 0)
goto unlock;
- read_child = ctx & 0x00000000FFFFFFFFULL;
+ read_child = ctx & AFR_ICTX_READ_CHILD_MASK;
}
unlock:
UNLOCK (&inode->lock);
@@ -153,8 +157,8 @@ afr_set_read_child (xlator_t *this, inode_t *inode, int32_t read_child)
ctx = 0;
}
- ctx = (0xFFFFFFFF00000000ULL & ctx)
- | (0x00000000FFFFFFFFULL & read_child);
+ ctx = (~AFR_ICTX_READ_CHILD_MASK & ctx)
+ | (AFR_ICTX_READ_CHILD_MASK & read_child);
__inode_ctx_put (inode, this, ctx);
}