summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-08-09 05:43:01 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-11 22:24:38 -0700
commitb8779318dd2d99e44f54de741beee32f55553e75 (patch)
tree58d4d0dace2484b60c4b870c761d1182b529bfe7 /libglusterfs
parent0b501ac95edc0ef5945228eb47e6482cfc4efa41 (diff)
fuse resolve related changes
Now fuse is fully complaint with DVM, as even if there is a fop request on inode belonging to old graph, it will be resolved corresponding to new graph and operations will be performed wrt. new graph, which makes DVM truely spontaneous. Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1240 (DVM: after graph change, inodes should resolve to new inode-table) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1240
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/fd.c39
-rw-r--r--libglusterfs/src/fd.h11
2 files changed, 29 insertions, 21 deletions
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c
index 231b7c5b0..c9ac94734 100644
--- a/libglusterfs/src/fd.c
+++ b/libglusterfs/src/fd.c
@@ -419,9 +419,9 @@ fd_destroy (fd_t *fd)
tmp_pool = fd->inode->table->fd_mem_pool;
if (IA_ISDIR (fd->inode->ia_type)) {
- for (i = 0; i < fd->inode->table->xl->graph->xl_count; i++) {
+ for (i = 0; i < fd->xl_count; i++) {
if (fd->_ctx[i].key) {
- xl = (xlator_t *)(long)fd->_ctx[i].key;
+ xl = fd->_ctx[i].xl_key;
old_THIS = THIS;
THIS = xl;
if (xl->cbks->releasedir)
@@ -430,9 +430,9 @@ fd_destroy (fd_t *fd)
}
}
} else {
- for (i = 0; i < fd->inode->table->xl->graph->xl_count; i++) {
+ for (i = 0; i < fd->xl_count; i++) {
if (fd->_ctx[i].key) {
- xl = (xlator_t *)(long)fd->_ctx[i].key;
+ xl = fd->_ctx[i].xl_key;
old_THIS = THIS;
THIS = xl;
if (xl->cbks->release)
@@ -513,8 +513,9 @@ fd_create (inode_t *inode, pid_t pid)
if (!fd)
goto out;
- fd->_ctx = GF_CALLOC (1, (sizeof (struct _fd_ctx) *
- inode->table->xl->graph->xl_count),
+ fd->xl_count = inode->table->xl->graph->xl_count + 1;
+
+ fd->_ctx = GF_CALLOC (1, (sizeof (struct _fd_ctx) * fd->xl_count),
gf_common_mt_fd_ctx);
if (!fd->_ctx) {
GF_FREE (fd);
@@ -596,14 +597,14 @@ __fd_ctx_set (fd_t *fd, xlator_t *xlator, uint64_t value)
if (!fd || !xlator)
return -1;
- for (index = 0; index < xlator->graph->xl_count; index++) {
+ for (index = 0; index < fd->xl_count; index++) {
if (!fd->_ctx[index].key) {
if (set_idx == -1)
set_idx = index;
/* dont break, to check if key already exists
further on */
}
- if (fd->_ctx[index].key == (uint64_t)(long) xlator) {
+ if (fd->_ctx[index].xl_key == xlator) {
set_idx = index;
break;
}
@@ -614,8 +615,8 @@ __fd_ctx_set (fd_t *fd, xlator_t *xlator, uint64_t value)
goto out;
}
- fd->_ctx[set_idx].key = (uint64_t)(long) xlator;
- fd->_ctx[set_idx].value = value;
+ fd->_ctx[set_idx].xl_key = xlator;
+ fd->_ctx[set_idx].value1 = value;
out:
return ret;
@@ -649,18 +650,18 @@ __fd_ctx_get (fd_t *fd, xlator_t *xlator, uint64_t *value)
if (!fd || !xlator)
return -1;
- for (index = 0; index < xlator->graph->xl_count; index++) {
- if (fd->_ctx[index].key == (uint64_t)(long)xlator)
+ for (index = 0; index < fd->xl_count; index++) {
+ if (fd->_ctx[index].xl_key == xlator)
break;
}
- if (index == xlator->graph->xl_count) {
+ if (index == fd->xl_count) {
ret = -1;
goto out;
}
if (value)
- *value = fd->_ctx[index].value;
+ *value = fd->_ctx[index].value1;
out:
return ret;
@@ -694,21 +695,21 @@ __fd_ctx_del (fd_t *fd, xlator_t *xlator, uint64_t *value)
if (!fd || !xlator)
return -1;
- for (index = 0; index < xlator->graph->xl_count; index++) {
- if (fd->_ctx[index].key == (uint64_t)(long)xlator)
+ for (index = 0; index < fd->xl_count; index++) {
+ if (fd->_ctx[index].xl_key == xlator)
break;
}
- if (index == xlator->graph->xl_count) {
+ if (index == fd->xl_count) {
ret = -1;
goto out;
}
if (value)
- *value = fd->_ctx[index].value;
+ *value = fd->_ctx[index].value1;
fd->_ctx[index].key = 0;
- fd->_ctx[index].value = 0;
+ fd->_ctx[index].value1 = 0;
out:
return ret;
diff --git a/libglusterfs/src/fd.h b/libglusterfs/src/fd.h
index c2181d8af..e01ef753e 100644
--- a/libglusterfs/src/fd.h
+++ b/libglusterfs/src/fd.h
@@ -35,8 +35,14 @@ struct _inode;
struct _dict;
struct _fd_ctx {
- uint64_t key;
- uint64_t value;
+ union {
+ uint64_t key;
+ void *xl_key;
+ };
+ union {
+ uint64_t value1;
+ void *ptr1;
+ };
};
/* If this structure changes, please have mercy on the booster maintainer
@@ -53,6 +59,7 @@ struct _fd {
gf_lock_t lock; /* used ONLY for manipulating
'struct _fd_ctx' array (_ctx).*/
struct _fd_ctx *_ctx;
+ int xl_count; /* Number of xl referred in this fd */
};
typedef struct _fd fd_t;