summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-06-16 07:48:22 +0000
committerAnand Avati <avati@gluster.com>2011-06-16 23:24:56 -0700
commit4e1ec35ef4f7bbf70c3e08e7c246946551f19e93 (patch)
tree0a932e17c9554a2c31be469c41190a16450b67fe /xlators
parentf04898973f15cfa13fcf39a903786983885352bc (diff)
core: fill 'ia_ino' from 'ia_gfid' in 'storage/posix' to preserve same ino number
take the least significant 64bit from gfid and assign it to 'ia_ino', hence for a given file (or directory), the 'ia_ino' number is always same, and we need not worry about the 'itransform' in 'cluster/*' translators. Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 3042 (inode number should be constant on storage) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3042
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/afr/src/afr-common.c72
-rw-r--r--xlators/cluster/afr/src/afr-dir-read.c12
-rw-r--r--xlators/cluster/afr/src/afr-dir-write.c84
-rw-r--r--xlators/cluster/afr/src/afr-inode-read.c12
-rw-r--r--xlators/cluster/afr/src/afr-inode-write.c17
-rw-r--r--xlators/cluster/afr/src/afr.h6
-rw-r--r--xlators/cluster/afr/src/pump.c2
-rw-r--r--xlators/cluster/dht/src/dht-common.c128
-rw-r--r--xlators/cluster/dht/src/dht-helper.c3
-rw-r--r--xlators/cluster/dht/src/dht-rename.c16
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c3
-rw-r--r--xlators/cluster/dht/src/nufa.c5
-rw-r--r--xlators/cluster/dht/src/switch.c4
-rw-r--r--xlators/storage/posix/src/posix.c24
14 files changed, 25 insertions, 363 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index a08f34b8757..3ddfa6dff7b 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -521,40 +521,6 @@ afr_update_loc_gfids (loc_t *loc, struct iatt *buf, struct iatt *postparent)
uuid_copy (loc->pargfid, postparent->ia_gfid);
}
-ino64_t
-afr_itransform (ino64_t ino, int child_count, int child_index)
-{
- ino64_t scaled_ino = -1;
-
- if (ino == ((uint64_t) -1)) {
- scaled_ino = ((uint64_t) -1);
- goto out;
- }
-
- scaled_ino = (ino * child_count) + child_index;
-
-out:
- return scaled_ino;
-}
-
-
-int
-afr_deitransform_orig (ino64_t ino, int child_count)
-{
- int index = -1;
-
- index = ino % child_count;
-
- return index;
-}
-
-
-int
-afr_deitransform (ino64_t ino, int child_count)
-{
- return 0;
-}
-
int
afr_self_heal_lookup_unwind (call_frame_t *frame, xlator_t *this)
@@ -672,20 +638,6 @@ afr_lookup_done (call_frame_t *frame, xlator_t *this, struct iatt *lookup_buf)
priv = this->private;
local = frame->local;
- local->cont.lookup.postparent.ia_ino = local->cont.lookup.parent_ino;
-
- if (local->cont.lookup.ino) {
- local->cont.lookup.buf.ia_ino = local->cont.lookup.ino;
- }
-
- if (local->op_ret == 0) {
- /* KLUDGE: assuming DHT will not itransform in
- revalidate */
- if (local->cont.lookup.inode->ino) {
- local->cont.lookup.buf.ia_ino =
- local->cont.lookup.inode->ino;
- }
- }
up_count = afr_up_children_count (priv->child_count, priv->child_up);
if (up_count == 1) {
gf_log (this->name, GF_LOG_DEBUG,
@@ -838,13 +790,6 @@ afr_fresh_lookup_cbk (call_frame_t *frame, void *cookie,
first_up_child = afr_first_up_child (priv);
- if (child_index == first_up_child) {
- local->cont.lookup.ino =
- afr_itransform (buf->ia_ino,
- priv->child_count,
- first_up_child);
- }
-
if (local->success_count == 0) {
if (local->op_errno != ESTALE)
local->op_ret = op_ret;
@@ -867,9 +812,6 @@ afr_fresh_lookup_cbk (call_frame_t *frame, void *cookie,
uuid_copy (local->loc.pargfid,
postparent->ia_gfid);
- lookup_buf->ia_ino = afr_itransform (buf->ia_ino,
- priv->child_count,
- child_index);
if (priv->read_child >= 0) {
afr_set_read_child (this,
local->cont.lookup.inode,
@@ -959,13 +901,6 @@ afr_revalidate_lookup_cbk (call_frame_t *frame, void *cookie,
first_up_child = afr_first_up_child (priv);
- if (child_index == first_up_child) {
- local->cont.lookup.ino =
- afr_itransform (buf->ia_ino,
- priv->child_count,
- first_up_child);
- }
-
/* in case of revalidate, we need to send stat of the
* child whose stat was sent during the first lookup.
* (so that time stamp does not vary with revalidate.
@@ -985,10 +920,6 @@ afr_revalidate_lookup_cbk (call_frame_t *frame, void *cookie,
*lookup_buf = *buf;
- lookup_buf->ia_ino = afr_itransform (buf->ia_ino,
- priv->child_count,
- child_index);
-
if (priv->read_child >= 0) {
afr_set_read_child (this,
local->cont.lookup.inode,
@@ -1527,9 +1458,6 @@ afr_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
call_count = afr_frame_return (frame);
if (call_count == 0) {
- local->cont.fsync.prebuf.ia_ino = local->cont.fsync.ino;
- local->cont.fsync.postbuf.ia_ino = local->cont.fsync.ino;
-
AFR_STACK_UNWIND (fsync, frame, local->op_ret, local->op_errno,
&local->cont.fsync.prebuf,
&local->cont.fsync.postbuf);
diff --git a/xlators/cluster/afr/src/afr-dir-read.c b/xlators/cluster/afr/src/afr-dir-read.c
index b2a001a198a..16b44a6856b 100644
--- a/xlators/cluster/afr/src/afr-dir-read.c
+++ b/xlators/cluster/afr/src/afr-dir-read.c
@@ -495,10 +495,6 @@ afr_readdir_cbk (call_frame_t *frame, void *cookie,
goto out;
list_for_each_entry_safe (entry, tmp, &entries->list, list) {
- entry->d_ino = afr_itransform (entry->d_ino,
- priv->child_count,
- child_index);
-
if ((local->fd->inode == local->fd->inode->table->root)
&& !strcmp (entry->d_name, GF_REPLICATE_TRASH_DIR)) {
list_del_init (&entry->list);
@@ -520,7 +516,6 @@ afr_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
xlator_t ** children = NULL;
- ino_t inum = 0;
int call_child = 0;
int ret = 0;
gf_dirent_t * entry = NULL;
@@ -575,13 +570,6 @@ afr_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret != -1) {
list_for_each_entry_safe (entry, tmp, &entries->list, list) {
- inum = afr_itransform (entry->d_ino, priv->child_count,
- child_index);
- entry->d_ino = inum;
- inum = afr_itransform (entry->d_stat.ia_ino,
- priv->child_count, child_index);
- entry->d_stat.ia_ino = inum;
-
if ((local->fd->inode == local->fd->inode->table->root)
&& !strcmp (entry->d_name, GF_REPLICATE_TRASH_DIR)) {
list_del_init (&entry->list);
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c
index 30fcf92b60a..88c3f728f49 100644
--- a/xlators/cluster/afr/src/afr-dir-write.c
+++ b/xlators/cluster/afr/src/afr-dir-write.c
@@ -101,11 +101,6 @@ afr_create_unwind (call_frame_t *frame, xlator_t *this)
unwind_buf = &local->cont.create.buf;
}
- unwind_buf->ia_ino = local->cont.create.ino;
-
- local->cont.create.preparent.ia_ino = local->cont.create.parent_ino;
- local->cont.create.postparent.ia_ino = local->cont.create.parent_ino;
-
AFR_STACK_UNWIND (create, main_frame,
local->op_ret, local->op_errno,
local->cont.create.fd,
@@ -174,11 +169,6 @@ afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (local->success_count == 0) {
local->cont.create.buf = *buf;
- local->cont.create.ino =
- afr_itransform (buf->ia_ino,
- priv->child_count,
- child_index);
-
if (priv->read_child >= 0) {
afr_set_read_child (this, inode,
priv->read_child);
@@ -188,13 +178,6 @@ afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
}
- if (child_index == local->first_up_child) {
- local->cont.create.ino =
- afr_itransform (buf->ia_ino,
- priv->child_count,
- local->first_up_child);
- }
-
if (child_index == local->read_child_index) {
local->cont.create.read_child_buf = *buf;
local->cont.create.preparent = *preparent;
@@ -382,11 +365,6 @@ afr_mknod_unwind (call_frame_t *frame, xlator_t *this)
unwind_buf = &local->cont.mknod.buf;
}
- unwind_buf->ia_ino = local->cont.mknod.ino;
-
- local->cont.mknod.preparent.ia_ino = local->cont.mknod.parent_ino;
- local->cont.mknod.postparent.ia_ino = local->cont.mknod.parent_ino;
-
AFR_STACK_UNWIND (mknod, main_frame,
local->op_ret, local->op_errno,
local->cont.mknod.inode,
@@ -424,10 +402,6 @@ afr_mknod_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (local->success_count == 0){
local->cont.mknod.buf = *buf;
- local->cont.mknod.ino =
- afr_itransform (buf->ia_ino,
- priv->child_count,
- child_index);
if (priv->read_child >= 0) {
afr_set_read_child (this, inode,
@@ -438,13 +412,6 @@ afr_mknod_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
}
- if (child_index == local->first_up_child) {
- local->cont.mknod.ino =
- afr_itransform (buf->ia_ino,
- priv->child_count,
- local->first_up_child);
- }
-
if (child_index == local->read_child_index) {
local->cont.mknod.read_child_buf = *buf;
local->cont.mknod.preparent = *preparent;
@@ -625,11 +592,6 @@ afr_mkdir_unwind (call_frame_t *frame, xlator_t *this)
unwind_buf = &local->cont.mkdir.buf;
}
- unwind_buf->ia_ino = local->cont.mkdir.ino;
-
- local->cont.mkdir.preparent.ia_ino = local->cont.mkdir.parent_ino;
- local->cont.mkdir.postparent.ia_ino = local->cont.mkdir.parent_ino;
-
AFR_STACK_UNWIND (mkdir, main_frame,
local->op_ret, local->op_errno,
local->cont.mkdir.inode,
@@ -668,11 +630,6 @@ afr_mkdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (local->success_count == 0) {
local->cont.mkdir.buf = *buf;
- local->cont.mkdir.ino =
- afr_itransform (buf->ia_ino,
- priv->child_count,
- child_index);
-
if (priv->read_child >= 0) {
afr_set_read_child (this, inode,
priv->read_child);
@@ -682,13 +639,6 @@ afr_mkdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
}
- if (child_index == local->first_up_child) {
- local->cont.mkdir.ino =
- afr_itransform (buf->ia_ino,
- priv->child_count,
- local->first_up_child);
- }
-
if (child_index == local->read_child_index) {
local->cont.mkdir.read_child_buf = *buf;
local->cont.mkdir.preparent = *preparent;
@@ -870,11 +820,6 @@ afr_link_unwind (call_frame_t *frame, xlator_t *this)
unwind_buf = &local->cont.link.buf;
}
- unwind_buf->ia_ino = local->cont.link.ino;
-
- local->cont.link.preparent.ia_ino = local->cont.link.parent_ino;
- local->cont.link.postparent.ia_ino = local->cont.link.parent_ino;
-
AFR_STACK_UNWIND (link, main_frame,
local->op_ret, local->op_errno,
local->cont.link.inode,
@@ -1100,11 +1045,6 @@ afr_symlink_unwind (call_frame_t *frame, xlator_t *this)
unwind_buf = &local->cont.symlink.buf;
}
- unwind_buf->ia_ino = local->cont.symlink.ino;
-
- local->cont.symlink.preparent.ia_ino = local->cont.symlink.parent_ino;
- local->cont.symlink.postparent.ia_ino = local->cont.symlink.parent_ino;
-
AFR_STACK_UNWIND (symlink, main_frame,
local->op_ret, local->op_errno,
local->cont.symlink.inode,
@@ -1142,10 +1082,6 @@ afr_symlink_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (local->success_count == 0) {
local->cont.symlink.buf = *buf;
- local->cont.symlink.ino =
- afr_itransform (buf->ia_ino, priv->child_count,
- child_index);
-
if (priv->read_child >= 0) {
afr_set_read_child (this, inode,
priv->read_child);
@@ -1155,13 +1091,6 @@ afr_symlink_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
}
- if (child_index == local->first_up_child) {
- local->cont.symlink.ino =
- afr_itransform (buf->ia_ino,
- priv->child_count,
- local->first_up_child);
- }
-
if (child_index == local->read_child_index) {
local->cont.symlink.read_child_buf = *buf;
local->cont.symlink.preparent = *preparent;
@@ -1342,13 +1271,6 @@ afr_rename_unwind (call_frame_t *frame, xlator_t *this)
unwind_buf = &local->cont.rename.buf;
}
- unwind_buf->ia_ino = local->cont.rename.ino;
-
- local->cont.rename.preoldparent.ia_ino = local->cont.rename.oldparent_ino;
- local->cont.rename.postoldparent.ia_ino = local->cont.rename.oldparent_ino;
- local->cont.rename.prenewparent.ia_ino = local->cont.rename.newparent_ino;
- local->cont.rename.postnewparent.ia_ino = local->cont.rename.newparent_ino;
-
AFR_STACK_UNWIND (rename, main_frame,
local->op_ret, local->op_errno,
unwind_buf,
@@ -1559,9 +1481,6 @@ afr_unlink_unwind (call_frame_t *frame, xlator_t *this)
UNLOCK (&frame->lock);
if (main_frame) {
- local->cont.unlink.preparent.ia_ino = local->cont.unlink.parent_ino;
- local->cont.unlink.postparent.ia_ino = local->cont.unlink.parent_ino;
-
AFR_STACK_UNWIND (unlink, main_frame,
local->op_ret, local->op_errno,
&local->cont.unlink.preparent,
@@ -1759,9 +1678,6 @@ afr_rmdir_unwind (call_frame_t *frame, xlator_t *this)
UNLOCK (&frame->lock);
if (main_frame) {
- local->cont.rmdir.preparent.ia_ino = local->cont.rmdir.parent_ino;
- local->cont.rmdir.postparent.ia_ino = local->cont.rmdir.parent_ino;
-
AFR_STACK_UNWIND (rmdir, main_frame,
local->op_ret, local->op_errno,
&local->cont.rmdir.preparent,
diff --git a/xlators/cluster/afr/src/afr-inode-read.c b/xlators/cluster/afr/src/afr-inode-read.c
index dd832ffe7dc..431b734753c 100644
--- a/xlators/cluster/afr/src/afr-inode-read.c
+++ b/xlators/cluster/afr/src/afr-inode-read.c
@@ -221,9 +221,6 @@ afr_stat_cbk (call_frame_t *frame, void *cookie,
out:
if (unwind) {
- if (buf)
- buf->ia_ino = local->cont.stat.ino;
-
AFR_STACK_UNWIND (stat, frame, op_ret, op_errno, buf);
}
@@ -343,9 +340,6 @@ afr_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
out:
if (unwind) {
- if (buf)
- buf->ia_ino = local->cont.fstat.ino;
-
AFR_STACK_UNWIND (fstat, frame, op_ret, op_errno, buf);
}
@@ -468,9 +462,6 @@ afr_readlink_cbk (call_frame_t *frame, void *cookie,
out:
if (unwind) {
- if (sbuf)
- sbuf->ia_ino = local->cont.readlink.ino;
-
AFR_STACK_UNWIND (readlink, frame, op_ret, op_errno, buf, sbuf);
}
@@ -875,9 +866,6 @@ afr_readv_cbk (call_frame_t *frame, void *cookie,
out:
if (unwind) {
- if (buf && local)
- buf->ia_ino = local->cont.readv.ino;
-
AFR_STACK_UNWIND (readv, frame, op_ret, op_errno,
vector, count, buf, iobref);
}
diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c
index a369da6de1c..019eecf4101 100644
--- a/xlators/cluster/afr/src/afr-inode-write.c
+++ b/xlators/cluster/afr/src/afr-inode-write.c
@@ -66,9 +66,6 @@ afr_writev_unwind (call_frame_t *frame, xlator_t *this)
UNLOCK (&frame->lock);
if (main_frame) {
- local->cont.writev.prebuf.ia_ino = local->cont.writev.ino;
- local->cont.writev.postbuf.ia_ino = local->cont.writev.ino;
-
AFR_STACK_UNWIND (writev, main_frame,
local->op_ret, local->op_errno,
&local->cont.writev.prebuf,
@@ -321,9 +318,6 @@ afr_truncate_unwind (call_frame_t *frame, xlator_t *this)
UNLOCK (&frame->lock);
if (main_frame) {
- local->cont.truncate.prebuf.ia_ino = local->cont.truncate.ino;
- local->cont.truncate.postbuf.ia_ino = local->cont.truncate.ino;
-
AFR_STACK_UNWIND (truncate, main_frame, local->op_ret,
local->op_errno,
&local->cont.truncate.prebuf,
@@ -532,9 +526,6 @@ afr_ftruncate_unwind (call_frame_t *frame, xlator_t *this)
UNLOCK (&frame->lock);
if (main_frame) {
- local->cont.ftruncate.prebuf.ia_ino = local->cont.ftruncate.ino;
- local->cont.ftruncate.postbuf.ia_ino = local->cont.ftruncate.ino;
-
AFR_STACK_UNWIND (ftruncate, main_frame, local->op_ret,
local->op_errno,
&local->cont.ftruncate.prebuf,
@@ -781,9 +772,6 @@ afr_setattr_unwind (call_frame_t *frame, xlator_t *this)
UNLOCK (&frame->lock);
if (main_frame) {
- local->cont.setattr.preop_buf.ia_ino = local->cont.setattr.ino;
- local->cont.setattr.postop_buf.ia_ino = local->cont.setattr.ino;
-
AFR_STACK_UNWIND (setattr, main_frame, local->op_ret,
local->op_errno,
&local->cont.setattr.preop_buf,
@@ -991,11 +979,6 @@ afr_fsetattr_unwind (call_frame_t *frame, xlator_t *this)
UNLOCK (&frame->lock);
if (main_frame) {
- local->cont.fsetattr.preop_buf.ia_ino =
- local->cont.fsetattr.ino;
- local->cont.fsetattr.postop_buf.ia_ino =
- local->cont.fsetattr.ino;
-
AFR_STACK_UNWIND (fsetattr, main_frame, local->op_ret,
local->op_errno,
&local->cont.fsetattr.preop_buf,
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index aaf3dbcc89d..3d21a26923d 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -741,12 +741,6 @@ afr_update_loc_gfids (loc_t *loc, struct iatt *buf, struct iatt *postparent);
int
afr_locked_nodes_count (unsigned char *locked_nodes, int child_count);
-ino64_t
-afr_itransform (ino64_t ino, int child_count, int child_index);
-
-int
-afr_deitransform (ino64_t ino, int child_count);
-
void
afr_local_cleanup (afr_local_t *local, xlator_t *this);
diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c
index 0d4929d8926..24289b52505 100644
--- a/xlators/cluster/afr/src/pump.c
+++ b/xlators/cluster/afr/src/pump.c
@@ -471,8 +471,6 @@ gf_pump_traverse_directory (loc_t *loc)
ret = syncop_lookup (this, &entry_loc, NULL,
&iatt, &xattr_rsp, &parent);
- entry_loc.ino = iatt.ia_ino;
- entry_loc.inode->ino = iatt.ia_ino;
memcpy (entry_loc.inode->gfid, iatt.ia_gfid, 16);
gf_log (this->name, GF_LOG_DEBUG,
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index e921d9c3196..6bdc9d30139 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -132,17 +132,6 @@ dht_lookup_selfheal_cbk (call_frame_t *frame, void *cookie,
if (ret == 0) {
layout = local->selfheal.layout;
ret = dht_layout_set (this, local->inode, layout);
-
- if (local->ia_ino) {
- local->stbuf.ia_ino = local->ia_ino;
- } else {
- gf_log (this->name, GF_LOG_DEBUG,
- "could not find hashed subvolume for %s",
- local->loc.path);
- }
-
- if (local->loc.parent)
- local->postparent.ia_ino = local->loc.parent->ino;
}
WIPE (&local->postparent);
@@ -234,12 +223,6 @@ dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dht_iatt_merge (this, &local->stbuf, stbuf, prev->this);
dht_iatt_merge (this, &local->postparent, postparent,
prev->this);
-
- if (!local->ia_ino &&
- (prev->this == dht_first_up_subvol (this))) {
- local->ia_ino = local->stbuf.ia_ino;
- }
-
}
unlock:
UNLOCK (&frame->lock);
@@ -265,18 +248,6 @@ unlock:
}
dht_layout_set (this, local->inode, layout);
-
- if (local->ia_ino) {
- local->stbuf.ia_ino = local->ia_ino;
- } else {
- gf_log (this->name, GF_LOG_DEBUG,
- "could not find hashed subvol for %s",
- local->loc.path);
- }
-
- if (local->loc.parent)
- local->postparent.ia_ino =
- local->loc.parent->ino;
}
DHT_STACK_UNWIND (lookup, frame, local->op_ret, local->op_errno,
@@ -389,10 +360,6 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
prev->this);
local->op_ret = 0;
- local->stbuf.ia_ino = local->ia_ino;
-
- if (local->loc.parent)
- local->postparent.ia_ino = local->loc.parent->ino;
if (!local->xattr) {
local->xattr = dict_ref (xattr);
@@ -476,9 +443,6 @@ dht_lookup_linkfile_create_cbk (call_frame_t *frame, void *cookie,
local->stbuf.ia_prot.sticky = 1;
}
- if (local->loc.parent)
- local->postparent.ia_ino = local->loc.parent->ino;
-
unwind:
WIPE (&local->postparent);
@@ -545,10 +509,6 @@ dht_lookup_everywhere_done (call_frame_t *frame, xlator_t *this)
local->op_errno = EINVAL;
}
- if (local->loc.parent)
- local->postparent.ia_ino =
- local->loc.parent->ino;
-
WIPE (&local->postparent);
DHT_STACK_UNWIND (lookup, frame, local->op_ret,
@@ -800,9 +760,6 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie,
&& (conf && conf->unhashed_sticky_bit)) {
stbuf->ia_prot.sticky = 1;
}
- dht_itransform (this, prev->this, stbuf->ia_ino, &stbuf->ia_ino);
- if (local->loc.parent)
- postparent->ia_ino = local->loc.parent->ino;
ret = dht_layout_preset (this, prev->this, inode);
if (ret < 0) {
@@ -958,11 +915,6 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (!is_linkfile) {
/* non-directory and not a linkfile */
- dht_itransform (this, prev->this, stbuf->ia_ino,
- &stbuf->ia_ino);
- if (loc->parent)
- postparent->ia_ino = loc->parent->ino;
-
ret = dht_layout_preset (this, prev->this, inode);
if (ret < 0) {
gf_log (this->name, GF_LOG_INFO,
@@ -1074,8 +1026,6 @@ dht_lookup (call_frame_t *frame, xlator_t *this,
goto err;
}
- local->ia_ino = loc->inode->ino;
-
if (layout->gen && (layout->gen < conf->gen)) {
gf_log (this->name, GF_LOG_TRACE,
"incomplete layout failure for path=%s",
@@ -1185,11 +1135,6 @@ dht_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dht_iatt_merge (this, &local->prebuf, prebuf, prev->this);
dht_iatt_merge (this, &local->stbuf, postbuf, prev->this);
- if (local->inode) {
- local->stbuf.ia_ino = local->inode->ino;
- local->prebuf.ia_ino = local->inode->ino;
- }
-
local->op_ret = 0;
}
unlock:
@@ -1233,8 +1178,6 @@ dht_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dht_iatt_merge (this, &local->stbuf, stbuf, prev->this);
- if (local->inode)
- local->stbuf.ia_ino = local->inode->ino;
local->op_ret = 0;
}
unlock:
@@ -1463,8 +1406,6 @@ dht_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto unlock;
}
- preparent->ia_ino = local->loc.parent->ino;
- postparent->ia_ino = local->loc.parent->ino;
local->op_ret = 0;
local->postparent = *postparent;
@@ -1563,11 +1504,6 @@ dht_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
unlock:
UNLOCK (&frame->lock);
- if (local && (op_ret == 0)) {
- prebuf->ia_ino = local->ia_ino;
- postbuf->ia_ino = local->ia_ino;
- }
-
this_call_cnt = dht_frame_return (frame);
if (is_last_call (this_call_cnt))
DHT_STACK_UNWIND (fsync, frame, local->op_ret, local->op_errno,
@@ -1669,9 +1605,7 @@ dht_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret == -1)
goto err;
- if (local) {
- sbuf->ia_ino = local->ia_ino;
- } else {
+ if (!local) {
op_ret = -1;
op_errno = EINVAL;
}
@@ -1711,8 +1645,6 @@ dht_readlink (call_frame_t *frame, xlator_t *this,
goto err;
}
- local->ia_ino = loc->inode->ino;
-
STACK_WIND (frame, dht_readlink_cbk,
subvol, subvol->fops->readlink,
loc, size);
@@ -2411,8 +2343,6 @@ dht_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto out;
}
- if (op_ret != -1)
- stbuf->ia_ino = local->ia_ino;
out:
DHT_STACK_UNWIND (readv, frame, op_ret, op_errno, vector, count, stbuf,
iobref);
@@ -2447,7 +2377,6 @@ dht_readv (call_frame_t *frame, xlator_t *this,
goto err;
}
- local->ia_ino = fd->inode->ino;
STACK_WIND (frame, dht_readv_cbk,
subvol, subvol->fops->readv,
fd, size, off);
@@ -2480,9 +2409,6 @@ dht_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto out;
}
- prebuf->ia_ino = local->ia_ino;
- postbuf->ia_ino = local->ia_ino;
-
out:
DHT_STACK_UNWIND (writev, frame, op_ret, op_errno, prebuf, postbuf);
@@ -2518,8 +2444,6 @@ dht_writev (call_frame_t *frame, xlator_t *this,
goto err;
}
- local->ia_ino = fd->inode->ino;
-
STACK_WIND (frame, dht_writev_cbk,
subvol, subvol->fops->writev,
fd, vector, count, off, iobref);
@@ -2606,8 +2530,6 @@ dht_fsync (call_frame_t *frame, xlator_t *this,
}
local->call_cnt = 1;
- local->ia_ino = fd->inode->ino;
-
STACK_WIND (frame, dht_fsync_cbk,
subvol, subvol->fops->fsync,
fd, datasync);
@@ -2905,14 +2827,12 @@ dht_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
layout->search_unhashed++;
}
}
- entry->d_stat = orig_entry->d_stat;
- dht_itransform (this, prev->this, orig_entry->d_ino,
- &entry->d_ino);
dht_itransform (this, prev->this, orig_entry->d_off,
&entry->d_off);
- entry->d_stat.ia_ino = entry->d_ino;
+ entry->d_stat = orig_entry->d_stat;
+ entry->d_ino = orig_entry->d_ino;
entry->d_type = orig_entry->d_type;
entry->d_len = orig_entry->d_len;
@@ -3006,11 +2926,10 @@ dht_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto unwind;
}
- dht_itransform (this, prev->this, orig_entry->d_ino,
- &entry->d_ino);
dht_itransform (this, prev->this, orig_entry->d_off,
&entry->d_off);
+ entry->d_ino = orig_entry->d_ino;
entry->d_type = orig_entry->d_type;
entry->d_len = orig_entry->d_len;
@@ -3240,11 +3159,7 @@ dht_newfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
prev = cookie;
- dht_itransform (this, prev->this, stbuf->ia_ino, &stbuf->ia_ino);
if (local->loc.parent) {
- preparent->ia_ino = local->loc.parent->ino;
- postparent->ia_ino = local->loc.parent->ino;
-
WIPE (preparent);
WIPE (postparent);
}
@@ -3537,11 +3452,6 @@ dht_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto out;
}
- stbuf->ia_ino = local->loc.inode->ino;
-
- preparent->ia_ino = local->loc2.parent->ino;
- postparent->ia_ino = local->loc2.parent->ino;
-
WIPE (preparent);
WIPE (postparent);
@@ -3679,11 +3589,7 @@ dht_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
prev = cookie;
- dht_itransform (this, prev->this, stbuf->ia_ino, &stbuf->ia_ino);
if (local->loc.parent) {
- preparent->ia_ino = local->loc.parent->ino;
- postparent->ia_ino = local->loc.parent->ino;
-
WIPE (preparent);
WIPE (postparent);
}
@@ -3843,11 +3749,7 @@ dht_mkdir_selfheal_cbk (call_frame_t *frame, void *cookie,
if (op_ret == 0) {
dht_layout_set (this, local->inode, layout);
- local->stbuf.ia_ino = local->ia_ino;
if (local->loc.parent) {
- local->preparent.ia_ino = local->loc.parent->ino;
- local->postparent.ia_ino = local->loc.parent->ino;
-
WIPE (&local->preparent);
WIPE (&local->postparent);
}
@@ -3898,11 +3800,6 @@ dht_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dht_iatt_merge (this, &local->preparent, preparent, prev->this);
dht_iatt_merge (this, &local->postparent, postparent,
prev->this);
-
- if (prev->this == dht_first_up_subvol (this)) {
- local->ia_ino = local->stbuf.ia_ino;
- }
-
}
unlock:
UNLOCK (&frame->lock);
@@ -3958,8 +3855,6 @@ dht_mkdir_hashed_cbk (call_frame_t *frame, void *cookie,
dht_iatt_merge (this, &local->preparent, preparent, prev->this);
dht_iatt_merge (this, &local->postparent, postparent, prev->this);
- local->ia_ino = local->stbuf.ia_ino;
-
local->call_cnt = conf->subvolume_cnt - 1;
if (local->call_cnt == 0) {
@@ -4063,11 +3958,6 @@ dht_rmdir_selfheal_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local = frame->local;
- if (local->loc.parent) {
- local->preparent.ia_ino = local->loc.parent->ino;
- local->postparent.ia_ino = local->loc.parent->ino;
- }
-
DHT_STACK_UNWIND (rmdir, frame, local->op_ret, local->op_errno,
&local->preparent, &local->postparent);
@@ -4125,11 +4015,6 @@ unlock:
&local->loc, local->layout);
} else {
if (local->loc.parent) {
- local->preparent.ia_ino =
- local->loc.parent->ino;
- local->postparent.ia_ino =
- local->loc.parent->ino;
-
WIPE (&local->preparent);
WIPE (&local->postparent);
}
@@ -4821,11 +4706,6 @@ dht_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dht_iatt_merge (this, &local->prebuf, statpre, prev->this);
dht_iatt_merge (this, &local->stbuf, statpost, prev->this);
- if (local->inode) {
- local->prebuf.ia_ino = local->inode->ino;
- local->stbuf.ia_ino = local->inode->ino;
- }
-
local->op_ret = 0;
}
unlock:
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c
index 42c6d025fc5..bb7ae047610 100644
--- a/xlators/cluster/dht/src/dht-helper.c
+++ b/xlators/cluster/dht/src/dht-helper.c
@@ -445,8 +445,7 @@ dht_iatt_merge (xlator_t *this, struct iatt *to,
uuid_copy (to->ia_gfid, from->ia_gfid);
- dht_itransform (this, subvol, from->ia_ino, &to->ia_ino);
-
+ to->ia_ino = from->ia_ino;
to->ia_prot = from->ia_prot;
to->ia_type = from->ia_type;
to->ia_nlink = from->ia_nlink;
diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c
index cef4a7b6fbc..2db707cb57b 100644
--- a/xlators/cluster/dht/src/dht-rename.c
+++ b/xlators/cluster/dht/src/dht-rename.c
@@ -75,14 +75,6 @@ dht_rename_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
unwind:
this_call_cnt = dht_frame_return (frame);
if (is_last_call (this_call_cnt)) {
- local->stbuf.ia_ino = local->loc.inode->ino;
-
- local->preoldparent.ia_ino = local->loc.parent->ino;
- local->postoldparent.ia_ino = local->loc.parent->ino;
-
- local->preparent.ia_ino = local->loc2.parent->ino;
- local->postparent.ia_ino = local->loc2.parent->ino;
-
WIPE (&local->preoldparent);
WIPE (&local->postoldparent);
WIPE (&local->preparent);
@@ -399,14 +391,6 @@ dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dht_iatt_merge (this, &local->preparent, prenewparent, prev->this);
dht_iatt_merge (this, &local->postparent, postnewparent, prev->this);
- local->stbuf.ia_ino = local->loc.inode->ino;
-
- local->preoldparent.ia_ino = local->loc.parent->ino;
- local->postoldparent.ia_ino = local->loc.parent->ino;
-
- local->preparent.ia_ino = local->loc2.parent->ino;
- local->postparent.ia_ino = local->loc2.parent->ino;
-
/* NOTE: rename_subvol is the same subvolume from which dht_rename_cbk
* is called. since rename has already happened on rename_subvol,
* unlink should not be sent for oldpath (either linkfile or cached-file)
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index ddd043dc8a4..e05894a5c2d 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -289,9 +289,6 @@ dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
dht_iatt_merge (this, &local->stbuf, stbuf, prev->this);
- if (prev->this == local->hashed_subvol)
- local->ia_ino = local->stbuf.ia_ino;
-
dht_iatt_merge (this, &local->preparent, preparent, prev->this);
dht_iatt_merge (this, &local->postparent, postparent, prev->this);
diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c
index f83edd26abf..45fea55ae3b 100644
--- a/xlators/cluster/dht/src/nufa.c
+++ b/xlators/cluster/dht/src/nufa.c
@@ -67,10 +67,6 @@ nufa_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (!is_dir && !is_linkfile) {
/* non-directory and not a linkfile */
-
- dht_itransform (this, prev->this, stbuf->ia_ino,
- &stbuf->ia_ino);
-
ret = dht_layout_preset (this, prev->this, inode);
if (ret < 0) {
gf_log (this->name, GF_LOG_DEBUG,
@@ -220,7 +216,6 @@ nufa_lookup (call_frame_t *frame, xlator_t *this,
}
local->inode = inode_ref (loc->inode);
- local->ia_ino = loc->inode->ino;
local->call_cnt = layout->cnt;
call_cnt = local->call_cnt;
diff --git a/xlators/cluster/dht/src/switch.c b/xlators/cluster/dht/src/switch.c
index 06d93cba150..e4bed0dd96e 100644
--- a/xlators/cluster/dht/src/switch.c
+++ b/xlators/cluster/dht/src/switch.c
@@ -142,9 +142,6 @@ switch_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (!is_dir && !is_linkfile) {
/* non-directory and not a linkfile */
- dht_itransform (this, prev->this, stbuf->ia_ino,
- &stbuf->ia_ino);
-
ret = dht_layout_preset (this, prev->this, inode);
if (ret < 0) {
gf_log (this->name, GF_LOG_DEBUG,
@@ -296,7 +293,6 @@ switch_lookup (call_frame_t *frame, xlator_t *this,
}
local->inode = inode_ref (loc->inode);
- local->ia_ino = loc->inode->ino;
local->call_cnt = layout->cnt;
call_cnt = local->call_cnt;
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 1ef88df1047..524b700f0ca 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -243,6 +243,21 @@ posix_fill_gfid_fd (xlator_t *this, int fd, struct iatt *iatt)
return ret;
}
+void
+posix_fill_ino_from_gfid (xlator_t *this, struct iatt *buf)
+{
+ uint64_t temp_ino = 0;
+ int j = 0;
+ int i = 0;
+
+ /* consider least significant 8 bytes of value out of gfid */
+ for (i = 15; i > (15 - 8); i--) {
+ temp_ino += buf->ia_gfid[i] << j;
+ j += 8;
+ }
+
+ buf->ia_ino = temp_ino;
+}
int
posix_lstat_with_gfid (xlator_t *this, const char *path, struct iatt *stbuf_p)
@@ -264,6 +279,8 @@ posix_lstat_with_gfid (xlator_t *this, const char *path, struct iatt *stbuf_p)
if (ret)
gf_log_callingfn (this->name, GF_LOG_DEBUG, "failed to get gfid");
+ posix_fill_ino_from_gfid (this, &stbuf);
+
if (stbuf_p)
*stbuf_p = stbuf;
out:
@@ -291,6 +308,8 @@ posix_fstat_with_gfid (xlator_t *this, int fd, struct iatt *stbuf_p)
if (ret)
gf_log_callingfn (this->name, GF_LOG_DEBUG, "failed to get gfid");
+ posix_fill_ino_from_gfid (this, &stbuf);
+
if (stbuf_p)
*stbuf_p = stbuf;
@@ -4116,10 +4135,6 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this,
break;
}
- stbuf.ia_ino = entry->d_ino;
-
- entry->d_ino = stbuf.ia_ino;
-
this_entry = gf_dirent_for_name (entry->d_name);
if (!this_entry) {
@@ -4142,6 +4157,7 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this,
strcpy (entry_path + real_path_len + 1,
tmp_entry->d_name);
posix_lstat_with_gfid (this, entry_path, &stbuf);
+ tmp_entry->d_ino = stbuf.ia_ino;
tmp_entry->d_stat = stbuf;
}
}