diff options
author | Amar Tumballi <amar@gluster.com> | 2011-06-16 07:48:22 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-06-16 23:24:56 -0700 |
commit | 4e1ec35ef4f7bbf70c3e08e7c246946551f19e93 (patch) | |
tree | 0a932e17c9554a2c31be469c41190a16450b67fe /xlators/cluster/afr | |
parent | f04898973f15cfa13fcf39a903786983885352bc (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/cluster/afr')
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 72 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-dir-read.c | 12 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-dir-write.c | 84 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-inode-read.c | 12 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-inode-write.c | 17 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.h | 6 | ||||
-rw-r--r-- | xlators/cluster/afr/src/pump.c | 2 |
7 files changed, 0 insertions, 205 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index a08f34b87..3ddfa6dff 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 b2a001a19..16b44a685 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 30fcf92b6..88c3f728f 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 dd832ffe7..431b73475 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 a369da6de..019eecf41 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 aaf3dbcc8..3d21a2692 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 0d4929d89..24289b525 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, |