summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-inode-read.c
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-04-03 05:34:10 -0700
committerAnand V. Avati <avati@amp.gluster.com>2009-04-03 18:13:05 +0530
commitd3d7245970189629937f6330a6d946f5fbb454af (patch)
treeee1f9ccdc619761caa99ce29934ee46b2671f03e /xlators/cluster/afr/src/afr-inode-read.c
parent75c70231fe7e13a68239dac889568d243a79a75e (diff)
Made afr inode context a 64-bit packed value instead of a structure.
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-inode-read.c')
-rw-r--r--xlators/cluster/afr/src/afr-inode-read.c122
1 files changed, 26 insertions, 96 deletions
diff --git a/xlators/cluster/afr/src/afr-inode-read.c b/xlators/cluster/afr/src/afr-inode-read.c
index 97b429049..c7a7e9987 100644
--- a/xlators/cluster/afr/src/afr-inode-read.c
+++ b/xlators/cluster/afr/src/afr-inode-read.c
@@ -119,9 +119,8 @@ afr_access (call_frame_t *frame, xlator_t *this,
int call_child = 0;
afr_local_t *local = NULL;
- afr_inode_ctx_t * inode_ctx = NULL;
- uint64_t ctx;
- int ret = 0;
+ int32_t read_child = -1;
+
int32_t op_ret = -1;
int32_t op_errno = 0;
@@ -137,19 +136,10 @@ afr_access (call_frame_t *frame, xlator_t *this,
ALLOC_OR_GOTO (local, afr_local_t, out);
- ret = inode_ctx_get (loc->inode, this,
- &ctx);
- if (ret < 0) {
- op_errno = EINVAL;
- gf_log (this->name, GF_LOG_ERROR,
- "inode ctx not set!");
- goto out;
- }
-
- inode_ctx = (afr_inode_ctx_t *)(long) ctx;
-
- if (inode_ctx->read_child >= 0) {
- call_child = inode_ctx->read_child;
+ read_child = afr_read_child (this, loc->inode);
+
+ if (read_child >= 0) {
+ call_child = read_child;
local->cont.access.last_tried = -1;
@@ -249,10 +239,7 @@ afr_stat (call_frame_t *frame, xlator_t *this,
afr_local_t * local = NULL;
xlator_t ** children = NULL;
- afr_inode_ctx_t * inode_ctx = NULL;
- uint64_t ctx;
- int ret = 0;
-
+ int32_t read_child = -1;
int call_child = 0;
int32_t op_ret = -1;
@@ -271,19 +258,10 @@ afr_stat (call_frame_t *frame, xlator_t *this,
frame->local = local;
- ret = inode_ctx_get (loc->inode, this,
- &ctx);
- if (ret < 0) {
- op_errno = EINVAL;
- gf_log (this->name, GF_LOG_ERROR,
- "inode ctx not set!");
- goto out;
- }
-
- inode_ctx = (afr_inode_ctx_t *)(long) ctx;
+ read_child = afr_read_child (this, loc->inode);
- if (inode_ctx->read_child >= 0) {
- call_child = inode_ctx->read_child;
+ if (read_child >= 0) {
+ call_child = read_child;
local->cont.stat.last_tried = -1;
@@ -386,10 +364,7 @@ afr_fstat (call_frame_t *frame, xlator_t *this,
xlator_t ** children = NULL;
int call_child = 0;
-
- afr_inode_ctx_t * inode_ctx = NULL;
- uint64_t ctx;
- int ret = 0;
+ int32_t read_child = -1;
int32_t op_ret = -1;
int32_t op_errno = 0;
@@ -410,20 +385,10 @@ afr_fstat (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (fd->inode, out);
- ret = inode_ctx_get (fd->inode, this,
- &ctx);
-
- if (ret < 0) {
- op_errno = EINVAL;
- gf_log (this->name, GF_LOG_ERROR,
- "inode ctx not set!");
- goto out;
- }
-
- inode_ctx = (afr_inode_ctx_t *)(long) ctx;
+ read_child = afr_read_child (this, fd->inode);
- if (inode_ctx->read_child >= 0) {
- call_child = inode_ctx->read_child;
+ if (read_child >= 0) {
+ call_child = read_child;
local->cont.fstat.last_tried = -1;
} else {
@@ -521,9 +486,7 @@ afr_readlink (call_frame_t *frame, xlator_t *this,
int call_child = 0;
afr_local_t *local = NULL;
- afr_inode_ctx_t * inode_ctx = NULL;
- uint64_t ctx;
- int ret = 0;
+ int32_t read_child = -1;
int32_t op_ret = -1;
int32_t op_errno = 0;
@@ -541,19 +504,10 @@ afr_readlink (call_frame_t *frame, xlator_t *this,
frame->local = local;
- ret = inode_ctx_get (loc->inode, this,
- &ctx);
- if (ret < 0) {
- op_errno = EINVAL;
- gf_log (this->name, GF_LOG_ERROR,
- "inode ctx not set!");
- goto out;
- }
-
- inode_ctx = (afr_inode_ctx_t *)(long) ctx;
+ read_child = afr_read_child (this, loc->inode);
- if (inode_ctx->read_child >= 0) {
- call_child = inode_ctx->read_child;
+ if (read_child >= 0) {
+ call_child = read_child;
local->cont.readlink.last_tried = -1;
@@ -652,9 +606,7 @@ afr_getxattr (call_frame_t *frame, xlator_t *this,
int call_child = 0;
afr_local_t * local = NULL;
- afr_inode_ctx_t * inode_ctx = NULL;
- uint64_t ctx;
- int ret = 0;
+ int read_child = -1;
int32_t op_ret = -1;
int32_t op_errno = 0;
@@ -671,19 +623,10 @@ afr_getxattr (call_frame_t *frame, xlator_t *this,
ALLOC_OR_GOTO (local, afr_local_t, out);
frame->local = local;
- ret = inode_ctx_get (loc->inode, this, &ctx);
-
- if (ret < 0) {
- op_errno = EINVAL;
- gf_log (this->name, GF_LOG_ERROR,
- "inode ctx not set!");
- goto out;
- }
-
- inode_ctx = (afr_inode_ctx_t *)(long) ctx;
+ read_child = afr_read_child (this, loc->inode);
- if (inode_ctx->read_child >= 0) {
- call_child = inode_ctx->read_child;
+ if (read_child >= 0) {
+ call_child = read_child;
local->cont.getxattr.last_tried = -1;
} else {
@@ -804,10 +747,7 @@ afr_readv (call_frame_t *frame, xlator_t *this,
afr_local_t * local = NULL;
xlator_t ** children = NULL;
- afr_inode_ctx_t * inode_ctx = NULL;
- uint64_t ctx;
- int ret = 0;
-
+ int32_t read_child = -1;
int call_child = 0;
int32_t op_ret = -1;
@@ -825,20 +765,10 @@ afr_readv (call_frame_t *frame, xlator_t *this,
frame->local = local;
- ret = inode_ctx_get (fd->inode, this,
- &ctx);
-
- if (ret < 0) {
- op_errno = EINVAL;
- gf_log (this->name, GF_LOG_ERROR,
- "inode ctx not set!");
- goto out;
- }
-
- inode_ctx = (afr_inode_ctx_t *)(long) ctx;
+ read_child = afr_read_child (this, fd->inode);
- if (inode_ctx->read_child >= 0) {
- call_child = inode_ctx->read_child;
+ if (read_child >= 0) {
+ call_child = read_child;
/*
if read fails from the read child, we try