diff options
author | Anand V. Avati <avati@blackhole.gluster.com> | 2010-03-16 09:46:33 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-03-16 08:31:32 -0700 |
commit | 283ec9608e6cbc9393941d5fae901e558360d2bd (patch) | |
tree | 5d90ea94d5df8fd542b30d6e88f44b940133d9b2 /xlators/cluster | |
parent | cc7515fc3db005383ffa575236ec29c212ed1e48 (diff) |
iatt: changes across the codebase
- libglusterfs
-- call-stub
-- inode
-- protocol
- libglusterfsclient
- cluster/replicate
- cluster/{dht,nufa,switch}
- cluster/unify
- cluster/HA
- cluster/map
- cluster/stripe
- debug/error-gen
- debug/trace
- debug/io-stats
- encryption/rot-13
- features/filter
- features/locks
- features/path-converter
- features/quota
- features/trash
- mount/fuse
- performance/io-threads
- performance/io-cache
- performance/quick-read
- performance/read-ahead
- performance/stat-prefetch
- performance/symlink-cache
- performance/write-behind
- protocol/client
- protocol/server
- storage-posix
Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 361 (GlusterFS 3.0 should work on Mac OS/X)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=361
Diffstat (limited to 'xlators/cluster')
32 files changed, 1015 insertions, 1028 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-read.c b/xlators/cluster/afr/src/afr-dir-read.c index 98cda1e80..065221e1d 100644 --- a/xlators/cluster/afr/src/afr-dir-read.c +++ b/xlators/cluster/afr/src/afr-dir-read.c @@ -153,7 +153,7 @@ out: sh->need_entry_self_heal = _gf_true; sh->forced_merge = _gf_true; - sh->mode = local->fd->inode->st_mode; + sh->type = local->fd->inode->ia_type; sh->background = _gf_false; sh->unwind = afr_examine_dir_sh_unwind; @@ -560,9 +560,9 @@ afr_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, inum = afr_itransform (entry->d_ino, priv->child_count, child_index); entry->d_ino = inum; - inum = afr_itransform (entry->d_stat.st_ino, + inum = afr_itransform (entry->d_stat.ia_ino, priv->child_count, child_index); - entry->d_stat.st_ino = inum; + entry->d_stat.ia_ino = inum; if ((local->fd->inode == local->fd->inode->table->root) && !strcmp (entry->d_name, GF_REPLICATE_TRASH_DIR)) { diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c index 8a6529bfb..14d3e28c4 100644 --- a/xlators/cluster/afr/src/afr-dir-write.c +++ b/xlators/cluster/afr/src/afr-dir-write.c @@ -79,7 +79,7 @@ afr_create_unwind (call_frame_t *frame, xlator_t *this) call_frame_t *main_frame = NULL; afr_private_t * priv = NULL; afr_local_t *local = NULL; - struct stat *unwind_buf = NULL; + struct iatt *unwind_buf = NULL; priv = this->private; local = frame->local; @@ -94,17 +94,17 @@ afr_create_unwind (call_frame_t *frame, xlator_t *this) UNLOCK (&frame->lock); if (main_frame) { - if (local->cont.create.read_child_buf.st_ino) { + if (local->cont.create.read_child_buf.ia_ino) { unwind_buf = &local->cont.create.read_child_buf; } else { unwind_buf = &local->cont.create.buf; } - unwind_buf->st_ino = local->cont.create.ino; - unwind_buf->st_dev = local->cont.create.gen; + unwind_buf->ia_ino = local->cont.create.ino; + unwind_buf->ia_gen = local->cont.create.gen; - local->cont.create.preparent.st_ino = local->cont.create.parent_ino; - local->cont.create.postparent.st_ino = local->cont.create.parent_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, @@ -121,8 +121,8 @@ afr_create_unwind (call_frame_t *frame, xlator_t *this) int afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - fd_t *fd, inode_t *inode, struct stat *buf, - struct stat *preparent, struct stat *postparent) + fd_t *fd, inode_t *inode, struct iatt *buf, + struct iatt *preparent, struct iatt *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -176,10 +176,10 @@ afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->cont.create.buf = *buf; local->cont.create.ino = - afr_itransform (buf->st_ino, + afr_itransform (buf->ia_ino, priv->child_count, child_index); - local->cont.create.gen = buf->st_dev; + local->cont.create.gen = buf->ia_gen; if (priv->read_child >= 0) { afr_set_read_child (this, inode, @@ -192,10 +192,10 @@ 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->st_ino, + afr_itransform (buf->ia_ino, priv->child_count, local->first_up_child); - local->cont.create.gen = buf->st_dev; + local->cont.create.gen = buf->ia_gen; } if (child_index == local->read_child_index) { @@ -365,7 +365,7 @@ afr_mknod_unwind (call_frame_t *frame, xlator_t *this) call_frame_t *main_frame = NULL; afr_local_t *local = NULL; - struct stat *unwind_buf = NULL; + struct iatt *unwind_buf = NULL; local = frame->local; @@ -379,17 +379,17 @@ afr_mknod_unwind (call_frame_t *frame, xlator_t *this) UNLOCK (&frame->lock); if (main_frame) { - if (local->cont.mknod.read_child_buf.st_ino) { + if (local->cont.mknod.read_child_buf.ia_ino) { unwind_buf = &local->cont.mknod.read_child_buf; } else { unwind_buf = &local->cont.mknod.buf; } - unwind_buf->st_ino = local->cont.mknod.ino; - unwind_buf->st_dev = local->cont.mknod.gen; + unwind_buf->ia_ino = local->cont.mknod.ino; + unwind_buf->ia_gen = local->cont.mknod.gen; - local->cont.mknod.preparent.st_ino = local->cont.mknod.parent_ino; - local->cont.mknod.postparent.st_ino = local->cont.mknod.parent_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, @@ -405,8 +405,8 @@ afr_mknod_unwind (call_frame_t *frame, xlator_t *this) int afr_mknod_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, struct stat *preparent, - struct stat *postparent) + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -430,10 +430,10 @@ 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->st_ino, + afr_itransform (buf->ia_ino, priv->child_count, child_index); - local->cont.mknod.gen = buf->st_dev; + local->cont.mknod.gen = buf->ia_gen; if (priv->read_child >= 0) { afr_set_read_child (this, inode, @@ -446,10 +446,10 @@ 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->st_ino, + afr_itransform (buf->ia_ino, priv->child_count, local->first_up_child); - local->cont.mknod.gen = buf->st_dev; + local->cont.mknod.gen = buf->ia_gen; } if (child_index == local->read_child_index) { @@ -615,7 +615,7 @@ afr_mkdir_unwind (call_frame_t *frame, xlator_t *this) call_frame_t *main_frame = NULL; afr_local_t *local = NULL; - struct stat *unwind_buf = NULL; + struct iatt *unwind_buf = NULL; local = frame->local; @@ -629,17 +629,17 @@ afr_mkdir_unwind (call_frame_t *frame, xlator_t *this) UNLOCK (&frame->lock); if (main_frame) { - if (local->cont.mkdir.read_child_buf.st_ino) { + if (local->cont.mkdir.read_child_buf.ia_ino) { unwind_buf = &local->cont.mkdir.read_child_buf; } else { unwind_buf = &local->cont.mkdir.buf; } - unwind_buf->st_ino = local->cont.mkdir.ino; - unwind_buf->st_dev = local->cont.mkdir.gen; + unwind_buf->ia_ino = local->cont.mkdir.ino; + unwind_buf->ia_gen = local->cont.mkdir.gen; - local->cont.mkdir.preparent.st_ino = local->cont.mkdir.parent_ino; - local->cont.mkdir.postparent.st_ino = local->cont.mkdir.parent_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, @@ -655,8 +655,8 @@ afr_mkdir_unwind (call_frame_t *frame, xlator_t *this) int afr_mkdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, struct stat *preparent, - struct stat *postparent) + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -681,10 +681,10 @@ afr_mkdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->cont.mkdir.buf = *buf; local->cont.mkdir.ino = - afr_itransform (buf->st_ino, + afr_itransform (buf->ia_ino, priv->child_count, child_index); - local->cont.mkdir.gen = buf->st_dev; + local->cont.mkdir.gen = buf->ia_gen; if (priv->read_child >= 0) { afr_set_read_child (this, inode, @@ -697,10 +697,10 @@ 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->st_ino, + afr_itransform (buf->ia_ino, priv->child_count, local->first_up_child); - local->cont.mkdir.gen = buf->st_dev; + local->cont.mkdir.gen = buf->ia_gen; } if (child_index == local->read_child_index) { @@ -867,7 +867,7 @@ afr_link_unwind (call_frame_t *frame, xlator_t *this) call_frame_t *main_frame = NULL; afr_local_t *local = NULL; - struct stat *unwind_buf = NULL; + struct iatt *unwind_buf = NULL; local = frame->local; @@ -881,16 +881,16 @@ afr_link_unwind (call_frame_t *frame, xlator_t *this) UNLOCK (&frame->lock); if (main_frame) { - if (local->cont.link.read_child_buf.st_ino) { + if (local->cont.link.read_child_buf.ia_ino) { unwind_buf = &local->cont.link.read_child_buf; } else { unwind_buf = &local->cont.link.buf; } - unwind_buf->st_ino = local->cont.link.ino; + unwind_buf->ia_ino = local->cont.link.ino; - local->cont.link.preparent.st_ino = local->cont.link.parent_ino; - local->cont.link.postparent.st_ino = local->cont.link.parent_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, @@ -906,8 +906,8 @@ afr_link_unwind (call_frame_t *frame, xlator_t *this) int afr_link_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, struct stat *preparent, - struct stat *postparent) + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -1104,7 +1104,7 @@ afr_symlink_unwind (call_frame_t *frame, xlator_t *this) call_frame_t *main_frame = NULL; afr_local_t *local = NULL; - struct stat *unwind_buf = NULL; + struct iatt *unwind_buf = NULL; local = frame->local; @@ -1118,17 +1118,17 @@ afr_symlink_unwind (call_frame_t *frame, xlator_t *this) UNLOCK (&frame->lock); if (main_frame) { - if (local->cont.symlink.read_child_buf.st_ino) { + if (local->cont.symlink.read_child_buf.ia_ino) { unwind_buf = &local->cont.symlink.read_child_buf; } else { unwind_buf = &local->cont.symlink.buf; } - unwind_buf->st_ino = local->cont.symlink.ino; - unwind_buf->st_dev = local->cont.symlink.gen; + unwind_buf->ia_ino = local->cont.symlink.ino; + unwind_buf->ia_gen = local->cont.symlink.gen; - local->cont.symlink.preparent.st_ino = local->cont.symlink.parent_ino; - local->cont.symlink.postparent.st_ino = local->cont.symlink.parent_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, @@ -1144,8 +1144,8 @@ afr_symlink_unwind (call_frame_t *frame, xlator_t *this) int afr_symlink_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, struct stat *preparent, - struct stat *postparent) + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -1169,9 +1169,9 @@ 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->st_ino, priv->child_count, + afr_itransform (buf->ia_ino, priv->child_count, child_index); - local->cont.symlink.gen = buf->st_dev; + local->cont.symlink.gen = buf->ia_gen; if (priv->read_child >= 0) { afr_set_read_child (this, inode, @@ -1184,10 +1184,10 @@ 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->st_ino, + afr_itransform (buf->ia_ino, priv->child_count, local->first_up_child); - local->cont.symlink.gen = buf->st_dev; + local->cont.symlink.gen = buf->ia_gen; } if (child_index == local->read_child_index) { @@ -1353,7 +1353,7 @@ afr_rename_unwind (call_frame_t *frame, xlator_t *this) call_frame_t *main_frame = NULL; afr_local_t *local = NULL; - struct stat *unwind_buf = NULL; + struct iatt *unwind_buf = NULL; local = frame->local; @@ -1367,18 +1367,18 @@ afr_rename_unwind (call_frame_t *frame, xlator_t *this) UNLOCK (&frame->lock); if (main_frame) { - if (local->cont.rename.read_child_buf.st_ino) { + if (local->cont.rename.read_child_buf.ia_ino) { unwind_buf = &local->cont.rename.read_child_buf; } else { unwind_buf = &local->cont.rename.buf; } - unwind_buf->st_ino = local->cont.rename.ino; + unwind_buf->ia_ino = local->cont.rename.ino; - local->cont.rename.preoldparent.st_ino = local->cont.rename.oldparent_ino; - local->cont.rename.postoldparent.st_ino = local->cont.rename.oldparent_ino; - local->cont.rename.prenewparent.st_ino = local->cont.rename.newparent_ino; - local->cont.rename.postnewparent.st_ino = local->cont.rename.newparent_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, @@ -1395,9 +1395,9 @@ afr_rename_unwind (call_frame_t *frame, xlator_t *this) int afr_rename_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf, - struct stat *preoldparent, struct stat *postoldparent, - struct stat *prenewparent, struct stat *postnewparent) + int32_t op_ret, int32_t op_errno, struct iatt *buf, + struct iatt *preoldparent, struct iatt *postoldparent, + struct iatt *prenewparent, struct iatt *postnewparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -1599,8 +1599,8 @@ afr_unlink_unwind (call_frame_t *frame, xlator_t *this) UNLOCK (&frame->lock); if (main_frame) { - local->cont.unlink.preparent.st_ino = local->cont.unlink.parent_ino; - local->cont.unlink.postparent.st_ino = local->cont.unlink.parent_ino; + 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, @@ -1614,8 +1614,8 @@ afr_unlink_unwind (call_frame_t *frame, xlator_t *this) int afr_unlink_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *preparent, - struct stat *postparent) + int32_t op_ret, int32_t op_errno, struct iatt *preparent, + struct iatt *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -1814,8 +1814,8 @@ afr_rmdir_unwind (call_frame_t *frame, xlator_t *this) UNLOCK (&frame->lock); if (main_frame) { - local->cont.rmdir.preparent.st_ino = local->cont.rmdir.parent_ino; - local->cont.rmdir.postparent.st_ino = local->cont.rmdir.parent_ino; + 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, @@ -1829,8 +1829,8 @@ afr_rmdir_unwind (call_frame_t *frame, xlator_t *this) int afr_rmdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *preparent, - struct stat *postparent) + int32_t op_ret, int32_t op_errno, struct iatt *preparent, + struct iatt *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; diff --git a/xlators/cluster/afr/src/afr-inode-read.c b/xlators/cluster/afr/src/afr-inode-read.c index 3b89da9ab..9ce103675 100644 --- a/xlators/cluster/afr/src/afr-inode-read.c +++ b/xlators/cluster/afr/src/afr-inode-read.c @@ -179,7 +179,7 @@ out: int32_t afr_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct iatt *buf) { afr_private_t * priv = NULL; afr_local_t * local = NULL; @@ -222,7 +222,7 @@ afr_stat_cbk (call_frame_t *frame, void *cookie, out: if (unwind) { if (buf) - buf->st_ino = local->cont.stat.ino; + buf->ia_ino = local->cont.stat.ino; AFR_STACK_UNWIND (stat, frame, op_ret, op_errno, buf); } @@ -303,7 +303,7 @@ out: int32_t afr_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct iatt *buf) { afr_private_t * priv = NULL; afr_local_t * local = NULL; @@ -346,7 +346,7 @@ afr_fstat_cbk (call_frame_t *frame, void *cookie, out: if (unwind) { if (buf) - buf->st_ino = local->cont.fstat.ino; + buf->ia_ino = local->cont.fstat.ino; AFR_STACK_UNWIND (fstat, frame, op_ret, op_errno, buf); } @@ -428,7 +428,7 @@ out: int32_t afr_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *buf, struct stat *sbuf) + const char *buf, struct iatt *sbuf) { afr_private_t * priv = NULL; afr_local_t * local = NULL; @@ -471,7 +471,7 @@ afr_readlink_cbk (call_frame_t *frame, void *cookie, out: if (unwind) { if (sbuf) - sbuf->st_ino = local->cont.readlink.ino; + sbuf->ia_ino = local->cont.readlink.ino; AFR_STACK_UNWIND (readlink, frame, op_ret, op_errno, buf, sbuf); } @@ -748,7 +748,7 @@ out: int32_t afr_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct iovec *vector, int32_t count, struct stat *buf, + struct iovec *vector, int32_t count, struct iatt *buf, struct iobref *iobref) { afr_private_t * priv = NULL; @@ -803,7 +803,7 @@ afr_readv_cbk (call_frame_t *frame, void *cookie, out: if (unwind) { if (buf) - buf->st_ino = local->cont.readv.ino; + 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 32e93e6e2..7b7408bbc 100644 --- a/xlators/cluster/afr/src/afr-inode-write.c +++ b/xlators/cluster/afr/src/afr-inode-write.c @@ -69,8 +69,8 @@ afr_writev_unwind (call_frame_t *frame, xlator_t *this) UNLOCK (&frame->lock); if (main_frame) { - local->cont.writev.prebuf.st_ino = local->cont.writev.ino; - local->cont.writev.postbuf.st_ino = local->cont.writev.ino; + 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, @@ -83,8 +83,8 @@ afr_writev_unwind (call_frame_t *frame, xlator_t *this) int afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *prebuf, - struct stat *postbuf) + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -350,8 +350,8 @@ afr_truncate_unwind (call_frame_t *frame, xlator_t *this) UNLOCK (&frame->lock); if (main_frame) { - local->cont.truncate.prebuf.st_ino = local->cont.truncate.ino; - local->cont.truncate.postbuf.st_ino = local->cont.truncate.ino; + 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, @@ -365,8 +365,8 @@ afr_truncate_unwind (call_frame_t *frame, xlator_t *this) int afr_truncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *prebuf, - struct stat *postbuf) + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -569,8 +569,8 @@ afr_ftruncate_unwind (call_frame_t *frame, xlator_t *this) UNLOCK (&frame->lock); if (main_frame) { - local->cont.ftruncate.prebuf.st_ino = local->cont.ftruncate.ino; - local->cont.ftruncate.postbuf.st_ino = local->cont.ftruncate.ino; + 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, @@ -583,8 +583,8 @@ afr_ftruncate_unwind (call_frame_t *frame, xlator_t *this) int afr_ftruncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *prebuf, - struct stat *postbuf) + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -828,8 +828,8 @@ afr_setattr_unwind (call_frame_t *frame, xlator_t *this) UNLOCK (&frame->lock); if (main_frame) { - local->cont.setattr.preop_buf.st_ino = local->cont.setattr.ino; - local->cont.setattr.postop_buf.st_ino = local->cont.setattr.ino; + 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, @@ -844,7 +844,7 @@ afr_setattr_unwind (call_frame_t *frame, xlator_t *this) int afr_setattr_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preop, struct stat *postop) + struct iatt *preop, struct iatt *postop) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -961,7 +961,7 @@ afr_setattr_done (call_frame_t *frame, xlator_t *this) int afr_setattr (call_frame_t *frame, xlator_t *this, - loc_t *loc, struct stat *buf, int32_t valid) + loc_t *loc, struct iatt *buf, int32_t valid) { afr_private_t * priv = NULL; afr_local_t * local = NULL; @@ -1046,9 +1046,9 @@ afr_fsetattr_unwind (call_frame_t *frame, xlator_t *this) UNLOCK (&frame->lock); if (main_frame) { - local->cont.fsetattr.preop_buf.st_ino = + local->cont.fsetattr.preop_buf.ia_ino = local->cont.fsetattr.ino; - local->cont.fsetattr.postop_buf.st_ino = + local->cont.fsetattr.postop_buf.ia_ino = local->cont.fsetattr.ino; AFR_STACK_UNWIND (fsetattr, main_frame, local->op_ret, @@ -1064,7 +1064,7 @@ afr_fsetattr_unwind (call_frame_t *frame, xlator_t *this) int afr_fsetattr_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preop, struct stat *postop) + struct iatt *preop, struct iatt *postop) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -1181,7 +1181,7 @@ afr_fsetattr_done (call_frame_t *frame, xlator_t *this) int afr_fsetattr (call_frame_t *frame, xlator_t *this, - fd_t *fd, struct stat *buf, int32_t valid) + fd_t *fd, struct iatt *buf, int32_t valid) { afr_private_t * priv = NULL; afr_local_t * local = NULL; diff --git a/xlators/cluster/afr/src/afr-inode-write.h b/xlators/cluster/afr/src/afr-inode-write.h index 66da777b6..f0c2fbe00 100644 --- a/xlators/cluster/afr/src/afr-inode-write.h +++ b/xlators/cluster/afr/src/afr-inode-write.h @@ -55,11 +55,11 @@ afr_utimens (call_frame_t *frame, xlator_t *this, int afr_setattr (call_frame_t *frame, xlator_t *this, - loc_t *loc, struct stat *buf, int32_t valid); + loc_t *loc, struct iatt *buf, int32_t valid); int afr_fsetattr (call_frame_t *frame, xlator_t *this, - fd_t *fd, struct stat *buf, int32_t valid); + fd_t *fd, struct iatt *buf, int32_t valid); int32_t afr_setxattr (call_frame_t *frame, xlator_t *this, diff --git a/xlators/cluster/afr/src/afr-open.c b/xlators/cluster/afr/src/afr-open.c index ae58eef06..1bfeb9cdf 100644 --- a/xlators/cluster/afr/src/afr-open.c +++ b/xlators/cluster/afr/src/afr-open.c @@ -58,8 +58,8 @@ int afr_open_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *prebuf, - struct stat *postbuf) + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf) { afr_local_t * local = frame->local; @@ -370,7 +370,7 @@ afr_up_down_flush_post_post_op (call_frame_t *frame, xlator_t *this) sh->data_lock_held = _gf_true; sh->need_data_self_heal = _gf_true; - sh->mode = local->fd->inode->st_mode; + sh->type = local->fd->inode->ia_type; sh->background = _gf_false; sh->unwind = afr_up_down_flush_sh_unwind; diff --git a/xlators/cluster/afr/src/afr-self-heal-algorithm.c b/xlators/cluster/afr/src/afr-self-heal-algorithm.c index eefd1ff7b..f840c1bbe 100644 --- a/xlators/cluster/afr/src/afr-self-heal-algorithm.c +++ b/xlators/cluster/afr/src/afr-self-heal-algorithm.c @@ -114,8 +114,8 @@ sh_full_loop_return (call_frame_t *rw_frame, xlator_t *this, off_t offset) static int sh_full_write_cbk (call_frame_t *rw_frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *prebuf, - struct stat *postbuf) + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf) { afr_private_t * priv = NULL; afr_local_t * rw_local = NULL; @@ -169,7 +169,7 @@ sh_full_write_cbk (call_frame_t *rw_frame, void *cookie, xlator_t *this, static int sh_full_read_cbk (call_frame_t *rw_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct iovec *vector, int32_t count, struct stat *buf, + struct iovec *vector, int32_t count, struct iatt *buf, struct iobref *iobref) { afr_private_t * priv = NULL; @@ -538,8 +538,8 @@ sh_diff_loop_return (call_frame_t *rw_frame, xlator_t *this, static int sh_diff_write_cbk (call_frame_t *rw_frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf, - struct stat *postbuf) + int32_t op_ret, int32_t op_errno, struct iatt *buf, + struct iatt *postbuf) { afr_private_t * priv = NULL; afr_local_t * rw_local = NULL; @@ -601,7 +601,7 @@ sh_diff_write_cbk (call_frame_t *rw_frame, void *cookie, xlator_t *this, static int sh_diff_read_cbk (call_frame_t *rw_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct iovec *vector, int32_t count, struct stat *buf, + struct iovec *vector, int32_t count, struct iatt *buf, struct iobref *iobref) { afr_private_t * priv = NULL; diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index fbd13e47a..dead7a323 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -441,7 +441,7 @@ afr_sh_mark_biggest_as_source (afr_self_heal_t *sh, int child_count) static int -afr_sh_mark_lowest_uid_as_source (afr_self_heal_t *sh, int child_count) +afr_sh_mark_loweia_uid_as_source (afr_self_heal_t *sh, int child_count) { uid_t smallest = 0; int i; @@ -450,7 +450,7 @@ afr_sh_mark_lowest_uid_as_source (afr_self_heal_t *sh, int child_count) if (!sh->buf) break; - if (sh->buf[i].st_uid < sh->buf[smallest].st_uid) { + if (sh->buf[i].ia_uid < sh->buf[smallest].ia_uid) { smallest = i; } } @@ -513,7 +513,7 @@ afr_sh_mark_sources (afr_self_heal_t *sh, int child_count, if ((type == AFR_SELF_HEAL_METADATA) && afr_sh_all_nodes_innocent (characters, child_count)) { - nsources = afr_sh_mark_lowest_uid_as_source (sh, child_count); + nsources = afr_sh_mark_loweia_uid_as_source (sh, child_count); goto out; } @@ -864,7 +864,7 @@ sh_missing_entries_finish (call_frame_t *frame, xlator_t *this) static int sh_destroy_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int op_errno, - struct stat *preop, struct stat *postop) + struct iatt *preop, struct iatt *postop) { afr_local_t *local = NULL; @@ -899,9 +899,9 @@ static int sh_missing_entries_newentry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, - struct stat *preparent, - struct stat *postparent) + inode_t *inode, struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { afr_local_t *local = NULL; afr_self_heal_t *sh = NULL; @@ -912,7 +912,7 @@ sh_missing_entries_newentry_cbk (call_frame_t *frame, void *cookie, loc_t *parent_loc = NULL; - struct stat stbuf; + struct iatt stbuf; int32_t valid; local = frame->local; @@ -921,20 +921,13 @@ sh_missing_entries_newentry_cbk (call_frame_t *frame, void *cookie, child_index = (long) cookie; -#ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC - stbuf.st_atim = sh->buf[sh->source].st_atim; - stbuf.st_mtim = sh->buf[sh->source].st_mtim; - -#elif HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC - stbuf.st_atimespec = sh->buf[sh->source].st_atimespec; - stbuf.st_mtimespec = sh->buf[sh->source].st_mtimespec; -#else - stbuf.st_atime = sh->buf[sh->source].st_atime; - stbuf.st_mtime = sh->buf[sh->source].st_mtime; -#endif - - stbuf.st_uid = sh->buf[sh->source].st_uid; - stbuf.st_gid = sh->buf[sh->source].st_gid; + stbuf.ia_atime = sh->buf[sh->source].ia_atime; + stbuf.ia_atime_nsec = sh->buf[sh->source].ia_atime_nsec; + stbuf.ia_mtime = sh->buf[sh->source].ia_mtime; + stbuf.ia_mtime_nsec = sh->buf[sh->source].ia_mtime_nsec; + + stbuf.ia_uid = sh->buf[sh->source].ia_uid; + stbuf.ia_gid = sh->buf[sh->source].ia_gid; valid = GF_SET_ATTR_UID | GF_SET_ATTR_GID | GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME; @@ -987,7 +980,7 @@ sh_missing_entries_mknod (call_frame_t *frame, xlator_t *this) int enoent_count = 0; int call_count = 0; mode_t st_mode = 0; - dev_t st_dev = 0; + dev_t ia_gen = 0; local = frame->local; @@ -1001,8 +994,9 @@ sh_missing_entries_mknod (call_frame_t *frame, xlator_t *this) call_count = enoent_count; local->call_count = call_count; - st_mode = sh->buf[sh->source].st_mode; - st_dev = sh->buf[sh->source].st_dev; + st_mode = st_mode_from_ia (sh->buf[sh->source].ia_prot, + sh->buf[sh->source].ia_type); + ia_gen = sh->buf[sh->source].ia_gen; gf_log (this->name, GF_LOG_TRACE, "mknod %s mode 0%o on %d subvolumes", @@ -1015,7 +1009,7 @@ sh_missing_entries_mknod (call_frame_t *frame, xlator_t *this) (void *) (long) i, priv->children[i], priv->children[i]->fops->mknod, - &local->loc, st_mode, st_dev); + &local->loc, st_mode, ia_gen); if (!--call_count) break; } @@ -1048,7 +1042,8 @@ sh_missing_entries_mkdir (call_frame_t *frame, xlator_t *this) call_count = enoent_count; local->call_count = call_count; - st_mode = sh->buf[sh->source].st_mode; + st_mode = st_mode_from_ia (sh->buf[sh->source].ia_prot, + sh->buf[sh->source].ia_type); gf_log (this->name, GF_LOG_TRACE, "mkdir %s mode 0%o on %d subvolumes", @@ -1127,7 +1122,7 @@ static int sh_missing_entries_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *link, struct stat *sbuf) + const char *link, struct iatt *sbuf) { if (op_ret > 0) sh_missing_entries_symlink (frame, this, link); @@ -1181,7 +1176,7 @@ sh_missing_entries_create (call_frame_t *frame, xlator_t *this) enoent_count++; } else { if (type) { - if (type != (sh->buf[i].st_mode & S_IFMT)) { + if (type != sh->buf[i].ia_type) { gf_log (this->name, GF_LOG_TRACE, "file %s is govinda!", local->loc.path); @@ -1190,7 +1185,7 @@ sh_missing_entries_create (call_frame_t *frame, xlator_t *this) } } else { sh->source = i; - type = sh->buf[i].st_mode & S_IFMT; + type = sh->buf[i].ia_type; } } } @@ -1252,8 +1247,8 @@ static int sh_missing_entries_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr, - struct stat *postparent) + inode_t *inode, struct iatt *buf, dict_t *xattr, + struct iatt *postparent) { int child_index = 0; afr_local_t *local = NULL; @@ -1275,7 +1270,7 @@ sh_missing_entries_lookup_cbk (call_frame_t *frame, void *cookie, "path %s on subvolume %s is of mode 0%o", local->loc.path, priv->children[child_index]->name, - buf->st_mode); + buf->ia_type); local->self_heal.buf[child_index] = *buf; local->self_heal.parentbuf = *postparent; @@ -1472,7 +1467,7 @@ afr_local_t *afr_local_copy (afr_local_t *l, xlator_t *this) else shc->healing_fd = sh->healing_fd; shc->background = sh->background; - shc->mode = sh->mode; + shc->type = sh->type; if (l->loc.path) loc_copy (&lc->loc, &l->loc); diff --git a/xlators/cluster/afr/src/afr-self-heal-common.h b/xlators/cluster/afr/src/afr-self-heal-common.h index be556a3c7..298ac022a 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.h +++ b/xlators/cluster/afr/src/afr-self-heal-common.h @@ -20,7 +20,7 @@ #ifndef __AFR_SELF_HEAL_COMMON_H__ #define __AFR_SELF_HEAL_COMMON_H__ -#define FILE_HAS_HOLES(buf) (((buf)->st_size) > ((buf)->st_blocks * 512)) +#define FILE_HAS_HOLES(buf) (((buf)->ia_size) > ((buf)->ia_blocks * 512)) typedef enum { AFR_SELF_HEAL_ENTRY, diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index 75090ad79..5711c89cf 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -124,7 +124,7 @@ afr_sh_data_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int afr_sh_data_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *statpre, struct stat *statpost) + int32_t op_ret, int32_t op_errno, struct iatt *statpre, struct iatt *statpost) { afr_sh_data_flush_cbk (frame, cookie, this, op_ret, op_errno); @@ -145,7 +145,7 @@ afr_sh_data_close (call_frame_t *frame, xlator_t *this) int active_sinks = 0; int32_t valid = 0; - struct stat stbuf = {0,}; + struct iatt stbuf = {0,}; local = frame->local; sh = &local->self_heal; @@ -156,17 +156,10 @@ afr_sh_data_close (call_frame_t *frame, xlator_t *this) valid |= (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME); -#ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC - stbuf.st_atim = sh->buf[source].st_atim; - stbuf.st_mtim = sh->buf[source].st_mtim; - -#elif HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC - stbuf.st_atimespec = sh->buf[source].st_atimespec; - stbuf.st_mtimespec = sh->buf[source].st_mtimespec; -#else - stbuf.st_atime = sh->buf[source].st_atime; - stbuf.st_mtime = sh->buf[source].st_mtime; -#endif + stbuf.ia_atime = sh->buf[source].ia_atime; + stbuf.ia_atime_nsec = sh->buf[source].ia_atime_nsec; + stbuf.ia_mtime = sh->buf[source].ia_mtime; + stbuf.ia_mtime_nsec = sh->buf[source].ia_mtime_nsec; if (sh->healing_fd_opened) { /* not our job to close the fd */ @@ -440,8 +433,8 @@ afr_sh_data_erase_pending (call_frame_t *frame, xlator_t *this) int afr_sh_data_trim_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *prebuf, - struct stat *postbuf) + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf) { afr_private_t * priv = NULL; afr_local_t * local = NULL; @@ -543,7 +536,7 @@ sh_zero_byte_files_exist (afr_self_heal_t *sh, int child_count) int ret = 0; for (i = 0; i < child_count; i++) { - if (sh->buf[i].st_size == 0) { + if (sh->buf[i].ia_size == 0) { ret = 1; break; } @@ -722,13 +715,13 @@ afr_sh_data_fix (call_frame_t *frame, xlator_t *this) sh->source = source; sh->block_size = 65536; - sh->file_size = sh->buf[source].st_size; + sh->file_size = sh->buf[source].ia_size; if (FILE_HAS_HOLES (&sh->buf[source])) sh->file_has_holes = 1; orig_local = sh->orig_frame->local; - orig_local->cont.lookup.buf.st_size = sh->buf[source].st_size; + orig_local->cont.lookup.buf.ia_size = sh->buf[source].ia_size; /* detect changes not visible through pending flags -- JIC */ for (i = 0; i < priv->child_count; i++) { @@ -788,7 +781,7 @@ afr_self_heal_get_source (xlator_t *this, afr_local_t *local, dict_t **xattr) int afr_sh_data_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct iatt *buf) { afr_private_t *priv = NULL; afr_local_t *local = NULL; diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c index 17c82d565..ef8de1987 100644 --- a/xlators/cluster/afr/src/afr-self-heal-entry.c +++ b/xlators/cluster/afr/src/afr-self-heal-entry.c @@ -448,7 +448,7 @@ int afr_sh_entry_expunge_parent_setattr_cbk (call_frame_t *expunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preop, struct stat *postop) + struct iatt *preop, struct iatt *postop) { afr_private_t *priv = NULL; afr_local_t *expunge_local = NULL; @@ -480,11 +480,11 @@ int afr_sh_entry_expunge_rename_cbk (call_frame_t *expunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf, - struct stat *preoldparent, - struct stat *postoldparent, - struct stat *prenewparent, - struct stat *postnewparent) + struct iatt *buf, + struct iatt *preoldparent, + struct iatt *postoldparent, + struct iatt *prenewparent, + struct iatt *postnewparent) { afr_private_t *priv = NULL; afr_local_t *expunge_local = NULL; @@ -596,8 +596,8 @@ afr_sh_entry_expunge_rename (call_frame_t *expunge_frame, xlator_t *this, int afr_sh_entry_expunge_mkdir_cbk (call_frame_t *expunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, struct stat *preparent, - struct stat *postparent) + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent) { afr_private_t *priv = NULL; afr_local_t *expunge_local = NULL; @@ -640,8 +640,8 @@ int afr_sh_entry_expunge_lookup_trash_cbk (call_frame_t *expunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, - dict_t *xattr, struct stat *postparent) + inode_t *inode, struct iatt *buf, + dict_t *xattr, struct iatt *postparent) { afr_private_t *priv = NULL; afr_local_t *expunge_local = NULL; @@ -745,7 +745,7 @@ afr_sh_entry_expunge_lookup_trash (call_frame_t *expunge_frame, xlator_t *this, int afr_sh_entry_expunge_remove (call_frame_t *expunge_frame, xlator_t *this, - int active_src, struct stat *buf) + int active_src, struct iatt *buf) { afr_private_t *priv = NULL; afr_local_t *expunge_local = NULL; @@ -760,7 +760,7 @@ afr_sh_entry_expunge_remove (call_frame_t *expunge_frame, xlator_t *this, frame = expunge_sh->sh_frame; source = expunge_sh->source; - type = (buf->st_mode & S_IFMT); + type = buf->ia_type; switch (type) { case S_IFSOCK: @@ -794,8 +794,8 @@ int afr_sh_entry_expunge_lookup_cbk (call_frame_t *expunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *x, - struct stat *postparent) + inode_t *inode, struct iatt *buf, dict_t *x, + struct iatt *postparent) { afr_private_t *priv = NULL; afr_local_t *expunge_local = NULL; @@ -857,8 +857,8 @@ int afr_sh_entry_expunge_entry_cbk (call_frame_t *expunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *x, - struct stat *postparent) + inode_t *inode, struct iatt *buf, dict_t *x, + struct iatt *postparent) { afr_private_t *priv = NULL; afr_local_t *expunge_local = NULL; @@ -1148,7 +1148,7 @@ int afr_sh_entry_impunge_setattr_cbk (call_frame_t *impunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preop, struct stat *postop) + struct iatt *preop, struct iatt *postop) { int call_count = 0; afr_private_t *priv = NULL; @@ -1209,7 +1209,7 @@ afr_sh_entry_impunge_xattrop_cbk (call_frame_t *impunge_frame, void *cookie, call_frame_t *frame = NULL; int child_index = 0; - struct stat stbuf; + struct iatt stbuf; int32_t valid = 0; priv = this->private; @@ -1223,23 +1223,16 @@ afr_sh_entry_impunge_xattrop_cbk (call_frame_t *impunge_frame, void *cookie, "setting ownership of %s on %s to %d/%d", impunge_local->loc.path, priv->children[child_index]->name, - impunge_local->cont.lookup.buf.st_uid, - impunge_local->cont.lookup.buf.st_gid); - -#ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC - stbuf.st_atim = impunge_local->cont.lookup.buf.st_atim; - stbuf.st_mtim = impunge_local->cont.lookup.buf.st_mtim; - -#elif HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC - stbuf.st_atimespec = impunge_local->cont.lookup.buf.st_atimespec; - stbuf.st_mtimespec = impunge_local->cont.lookup.buf.st_mtimespec; -#else - stbuf.st_atime = impunge_local->cont.lookup.buf.st_atime; - stbuf.st_mtime = impunge_local->cont.lookup.buf.st_mtime; -#endif + impunge_local->cont.lookup.buf.ia_uid, + impunge_local->cont.lookup.buf.ia_gid); + + stbuf.ia_atime = impunge_local->cont.lookup.buf.ia_atime; + stbuf.ia_atime_nsec = impunge_local->cont.lookup.buf.ia_atime_nsec; + stbuf.ia_mtime = impunge_local->cont.lookup.buf.ia_mtime; + stbuf.ia_mtime_nsec = impunge_local->cont.lookup.buf.ia_mtime_nsec; - stbuf.st_uid = impunge_local->cont.lookup.buf.st_uid; - stbuf.st_gid = impunge_local->cont.lookup.buf.st_gid; + stbuf.ia_uid = impunge_local->cont.lookup.buf.ia_uid; + stbuf.ia_gid = impunge_local->cont.lookup.buf.ia_gid; valid = GF_SET_ATTR_UID | GF_SET_ATTR_GID | GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME; @@ -1258,7 +1251,7 @@ int afr_sh_entry_impunge_parent_setattr_cbk (call_frame_t *setattr_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preop, struct stat *postop) + struct iatt *preop, struct iatt *postop) { loc_t *parent_loc = cookie; @@ -1281,9 +1274,9 @@ int afr_sh_entry_impunge_newfile_cbk (call_frame_t *impunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf, - struct stat *preparent, - struct stat *postparent) + inode_t *inode, struct iatt *stbuf, + struct iatt *preparent, + struct iatt *postparent) { int call_count = 0; afr_private_t *priv = NULL; @@ -1302,7 +1295,7 @@ afr_sh_entry_impunge_newfile_cbk (call_frame_t *impunge_frame, void *cookie, call_frame_t *setattr_frame = NULL; int32_t valid = 0; loc_t *parent_loc = NULL; - struct stat parentbuf; + struct iatt parentbuf; priv = this->private; impunge_local = impunge_frame->local; @@ -1323,14 +1316,14 @@ afr_sh_entry_impunge_newfile_cbk (call_frame_t *impunge_frame, void *cookie, goto out; } - inode->st_mode = stbuf->st_mode; + inode->ia_type = stbuf->ia_type; xattr = get_new_dict (); dict_ref (xattr); idx = afr_index_for_transaction_type (AFR_METADATA_TRANSACTION); pending_array[idx] = hton32 (1); - if (S_ISDIR (stbuf->st_mode)) + if (IA_ISDIR (stbuf->ia_type)) idx = afr_index_for_transaction_type (AFR_ENTRY_TRANSACTION); else idx = afr_index_for_transaction_type (AFR_DATA_TRANSACTION); @@ -1380,7 +1373,7 @@ out: int afr_sh_entry_impunge_mknod (call_frame_t *impunge_frame, xlator_t *this, - int child_index, struct stat *stbuf) + int child_index, struct iatt *stbuf) { afr_private_t *priv = NULL; afr_local_t *impunge_local = NULL; @@ -1401,7 +1394,8 @@ afr_sh_entry_impunge_mknod (call_frame_t *impunge_frame, xlator_t *this, priv->children[child_index], priv->children[child_index]->fops->mknod, &impunge_local->loc, - stbuf->st_mode, stbuf->st_rdev); + st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type), + stbuf->ia_rdev); return 0; } @@ -1410,7 +1404,7 @@ afr_sh_entry_impunge_mknod (call_frame_t *impunge_frame, xlator_t *this, int afr_sh_entry_impunge_mkdir (call_frame_t *impunge_frame, xlator_t *this, - int child_index, struct stat *stbuf) + int child_index, struct iatt *stbuf) { afr_private_t *priv = NULL; afr_local_t *impunge_local = NULL; @@ -1430,7 +1424,8 @@ afr_sh_entry_impunge_mkdir (call_frame_t *impunge_frame, xlator_t *this, (void *) (long) child_index, priv->children[child_index], priv->children[child_index]->fops->mkdir, - &impunge_local->loc, stbuf->st_mode); + &impunge_local->loc, + st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type)); return 0; } @@ -1468,8 +1463,8 @@ int afr_sh_entry_impunge_symlink_unlink_cbk (call_frame_t *impunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preparent, - struct stat *postparent) + struct iatt *preparent, + struct iatt *postparent) { afr_private_t *priv = NULL; afr_local_t *impunge_local = NULL; @@ -1547,7 +1542,7 @@ int afr_sh_entry_impunge_readlink_sink_cbk (call_frame_t *impunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *linkname, struct stat *sbuf) + const char *linkname, struct iatt *sbuf) { afr_private_t *priv = NULL; afr_local_t *impunge_local = NULL; @@ -1646,7 +1641,7 @@ int afr_sh_entry_impunge_readlink_cbk (call_frame_t *impunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *linkname, struct stat *sbuf) + const char *linkname, struct iatt *sbuf) { afr_private_t *priv = NULL; afr_local_t *impunge_local = NULL; @@ -1697,7 +1692,7 @@ out: int afr_sh_entry_impunge_readlink (call_frame_t *impunge_frame, xlator_t *this, - int child_index, struct stat *stbuf) + int child_index, struct iatt *stbuf) { afr_private_t *priv = NULL; afr_local_t *impunge_local = NULL; @@ -1723,8 +1718,8 @@ int afr_sh_entry_impunge_recreate_lookup_cbk (call_frame_t *impunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, - dict_t *xattr,struct stat *postparent) + inode_t *inode, struct iatt *buf, + dict_t *xattr,struct iatt *postparent) { afr_private_t *priv = NULL; afr_local_t *impunge_local = NULL; @@ -1757,7 +1752,7 @@ afr_sh_entry_impunge_recreate_lookup_cbk (call_frame_t *impunge_frame, impunge_sh->parentbuf = *postparent; impunge_local->cont.lookup.buf = *buf; - type = (buf->st_mode & S_IFMT); + type = buf->ia_type; switch (type) { case S_IFSOCK: @@ -1834,8 +1829,8 @@ int afr_sh_entry_impunge_entry_cbk (call_frame_t *impunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *x, - struct stat *postparent) + inode_t *inode, struct iatt *buf, dict_t *x, + struct iatt *postparent) { afr_private_t *priv = NULL; afr_local_t *impunge_local = NULL; @@ -1953,7 +1948,8 @@ afr_sh_entry_impunge_entry (call_frame_t *frame, xlator_t *this, impunge_sh->sh_frame = frame; impunge_sh->active_source = active_src; - impunge_sh->impunging_entry_mode = entry->d_stat.st_mode; + impunge_sh->impunging_entry_mode = + st_mode_from_ia (entry->d_stat.ia_prot, entry->d_stat.ia_type); ret = build_child_loc (this, &impunge_local->loc, &local->loc, entry->d_name); if (ret != 0) { @@ -2357,8 +2353,8 @@ heal: int afr_sh_entry_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr, - struct stat *postparent) + inode_t *inode, struct iatt *buf, dict_t *xattr, + struct iatt *postparent) { afr_private_t *priv = NULL; afr_local_t *local = NULL; diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c index bddccf682..57408cfa6 100644 --- a/xlators/cluster/afr/src/afr-self-heal-metadata.c +++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c @@ -81,7 +81,7 @@ afr_sh_metadata_done (call_frame_t *frame, xlator_t *this) local->loc.path); sh->completion_cbk (frame, this); } else { - if (S_ISREG (sh->mode)) { + if (IA_ISREG (sh->type)) { gf_log (this->name, GF_LOG_TRACE, "proceeding to data check on %s", local->loc.path); @@ -89,7 +89,7 @@ afr_sh_metadata_done (call_frame_t *frame, xlator_t *this) return 0; } - if (S_ISDIR (sh->mode)) { + if (IA_ISDIR (sh->type)) { gf_log (this->name, GF_LOG_TRACE, "proceeding to entry check on %s", local->loc.path); @@ -321,7 +321,7 @@ afr_sh_metadata_sync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int afr_sh_metadata_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preop, struct stat *postop) + struct iatt *preop, struct iatt *postop) { afr_sh_metadata_sync_cbk (frame, cookie, this, op_ret, op_errno); @@ -350,7 +350,7 @@ afr_sh_metadata_sync (call_frame_t *frame, xlator_t *this, dict_t *xattr) int call_count = 0; int i = 0; - struct stat stbuf; + struct iatt stbuf; int32_t valid = 0; local = frame->local; @@ -370,22 +370,16 @@ afr_sh_metadata_sync (call_frame_t *frame, xlator_t *this, dict_t *xattr) local->call_count = call_count; -#ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC - stbuf.st_atim = sh->buf[source].st_atim; - stbuf.st_mtim = sh->buf[source].st_mtim; - -#elif HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC - stbuf.st_atimespec = sh->buf[source].st_atimespec; - stbuf.st_mtimespec = sh->buf[source].st_mtimespec; -#else - stbuf.st_atime = sh->buf[source].st_atime; - stbuf.st_mtime = sh->buf[source].st_mtime; -#endif + stbuf.ia_atime = sh->buf[source].ia_atime; + stbuf.ia_atime_nsec = sh->buf[source].ia_atime_nsec; + stbuf.ia_mtime = sh->buf[source].ia_mtime; + stbuf.ia_mtime_nsec = sh->buf[source].ia_mtime_nsec; - stbuf.st_uid = sh->buf[source].st_uid; - stbuf.st_gid = sh->buf[source].st_gid; + stbuf.ia_uid = sh->buf[source].ia_uid; + stbuf.ia_gid = sh->buf[source].ia_gid; - stbuf.st_mode = sh->buf[source].st_mode; + stbuf.ia_type = sh->buf[source].ia_type; + stbuf.ia_prot = sh->buf[source].ia_prot; valid = GF_SET_ATTR_MODE | GF_SET_ATTR_UID | GF_SET_ATTR_GID | @@ -604,8 +598,8 @@ afr_sh_metadata_fix (call_frame_t *frame, xlator_t *this) int afr_sh_metadata_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr, - struct stat *postparent) + inode_t *inode, struct iatt *buf, dict_t *xattr, + struct iatt *postparent) { afr_local_t *local = NULL; afr_self_heal_t *sh = NULL; @@ -627,7 +621,7 @@ afr_sh_metadata_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "path %s on subvolume %s is of mode 0%o", local->loc.path, priv->children[child_index]->name, - buf->st_mode); + buf->ia_type); sh->buf[child_index] = *buf; if (xattr) diff --git a/xlators/cluster/afr/src/afr-self-heal.h b/xlators/cluster/afr/src/afr-self-heal.h index 1c2743a48..c43473a43 100644 --- a/xlators/cluster/afr/src/afr-self-heal.h +++ b/xlators/cluster/afr/src/afr-self-heal.h @@ -22,12 +22,12 @@ #include <sys/stat.h> -#define FILETYPE_DIFFERS(buf1,buf2) ((S_IFMT & ((struct stat *)buf1)->st_mode) != (S_IFMT & ((struct stat *)buf2)->st_mode)) -#define PERMISSION_DIFFERS(buf1,buf2) ((((struct stat *)buf1)->st_mode) != (((struct stat *)buf2)->st_mode)) -#define OWNERSHIP_DIFFERS(buf1,buf2) ((((struct stat *)buf1)->st_uid) != (((struct stat *)buf2)->st_uid) || (((struct stat *)buf1)->st_gid != (((struct stat *)buf2)->st_gid))) -#define SIZE_DIFFERS(buf1,buf2) ((((struct stat *)buf1)->st_size) != (((struct stat *)buf2)->st_size)) +#define FILETYPE_DIFFERS(buf1,buf2) ((buf1)->ia_type != (buf2)->ia_type) +#define PERMISSION_DIFFERS(buf1,buf2) (st_mode_from_ia ((buf1)->ia_prot, (buf1)->ia_type) != st_mode_from_ia ((buf2)->ia_prot, (buf2)->ia_type)) +#define OWNERSHIP_DIFFERS(buf1,buf2) (((buf1)->ia_uid != (buf2)->ia_uid) || ((buf1)->ia_gid != (buf2)->ia_gid)) +#define SIZE_DIFFERS(buf1,buf2) ((buf1)->ia_size != (buf2)->ia_size) -#define SIZE_GREATER(buf1,buf2) ((((struct stat *)buf1)->st_size > (((struct stat *)buf2)->st_size))) +#define SIZE_GREATER(buf1,buf2) ((buf1)->ia_size > (buf2)->ia_size) int afr_sh_has_metadata_pending (dict_t *xattr, int child_count, xlator_t *this); diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index f4917929c..b7fbbd09c 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -551,8 +551,8 @@ afr_lookup_collect_xattr (afr_local_t *local, xlator_t *this, static void -afr_lookup_self_heal_check (afr_local_t *local, struct stat *buf, - struct stat *lookup_buf) +afr_lookup_self_heal_check (afr_local_t *local, struct iatt *buf, + struct iatt *lookup_buf) { if (FILETYPE_DIFFERS (buf, lookup_buf)) { /* mismatching filetypes with same name @@ -576,7 +576,7 @@ afr_lookup_self_heal_check (afr_local_t *local, struct stat *buf, } if (SIZE_DIFFERS (buf, lookup_buf) - && S_ISREG (buf->st_mode)) { + && IA_ISREG (buf->ia_type)) { local->self_heal.need_data_self_heal = _gf_true; } @@ -584,7 +584,7 @@ afr_lookup_self_heal_check (afr_local_t *local, struct stat *buf, static void -afr_lookup_done (call_frame_t *frame, xlator_t *this, struct stat *lookup_buf) +afr_lookup_done (call_frame_t *frame, xlator_t *this, struct iatt *lookup_buf) { int unwind = 1; int source = -1; @@ -593,20 +593,20 @@ afr_lookup_done (call_frame_t *frame, xlator_t *this, struct stat *lookup_buf) local = frame->local; - local->cont.lookup.postparent.st_ino = local->cont.lookup.parent_ino; + local->cont.lookup.postparent.ia_ino = local->cont.lookup.parent_ino; if (local->cont.lookup.ino) { - local->cont.lookup.buf.st_ino = local->cont.lookup.ino; - local->cont.lookup.buf.st_dev = local->cont.lookup.gen; + local->cont.lookup.buf.ia_ino = local->cont.lookup.ino; + local->cont.lookup.buf.ia_gen = local->cont.lookup.gen; } if (local->op_ret == 0) { /* KLUDGE: assuming DHT will not itransform in revalidate */ if (local->cont.lookup.inode->ino) { - local->cont.lookup.buf.st_ino = + local->cont.lookup.buf.ia_ino = local->cont.lookup.inode->ino; - local->cont.lookup.buf.st_dev = + local->cont.lookup.buf.ia_gen = local->cont.lookup.inode->generation; } } @@ -638,7 +638,7 @@ afr_lookup_done (call_frame_t *frame, xlator_t *this, struct stat *lookup_buf) So just make a best effort to set the read-subvolume and return */ - if (S_ISREG (local->cont.lookup.inode->st_mode)) { + if (IA_ISREG (local->cont.lookup.inode->ia_type)) { source = afr_self_heal_get_source (this, local, local->cont.lookup.xattrs); if (source >= 0) { @@ -648,14 +648,14 @@ afr_lookup_done (call_frame_t *frame, xlator_t *this, struct stat *lookup_buf) } } } else { - if (!local->cont.lookup.inode->st_mode) { + if (!local->cont.lookup.inode->ia_type) { /* fix for RT #602 */ - local->cont.lookup.inode->st_mode = - lookup_buf->st_mode; + local->cont.lookup.inode->ia_type = + lookup_buf->ia_type; } local->self_heal.background = _gf_true; - local->self_heal.mode = local->cont.lookup.buf.st_mode; + local->self_heal.type = local->cont.lookup.buf.ia_type; local->self_heal.unwind = afr_self_heal_lookup_unwind; unwind = 0; @@ -704,12 +704,12 @@ __error_more_important (int32_t old_errno, int32_t new_errno) int afr_fresh_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr, - struct stat *postparent) + inode_t *inode, struct iatt *buf, dict_t *xattr, + struct iatt *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; - struct stat * lookup_buf = NULL; + struct iatt * lookup_buf = NULL; int call_count = -1; int child_index = -1; @@ -744,10 +744,10 @@ afr_fresh_lookup_cbk (call_frame_t *frame, void *cookie, if (child_index == first_up_child) { local->cont.lookup.ino = - afr_itransform (buf->st_ino, + afr_itransform (buf->ia_ino, priv->child_count, first_up_child); - local->cont.lookup.gen = buf->st_dev; + local->cont.lookup.gen = buf->ia_gen; } if (local->success_count == 0) { @@ -761,7 +761,7 @@ afr_fresh_lookup_cbk (call_frame_t *frame, void *cookie, *lookup_buf = *buf; - lookup_buf->st_ino = afr_itransform (buf->st_ino, + lookup_buf->ia_ino = afr_itransform (buf->ia_ino, priv->child_count, child_index); if (priv->read_child >= 0) { @@ -824,12 +824,12 @@ unlock: int afr_revalidate_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr, - struct stat *postparent) + inode_t *inode, struct iatt *buf, dict_t *xattr, + struct iatt *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; - struct stat * lookup_buf = NULL; + struct iatt * lookup_buf = NULL; int call_count = -1; int child_index = -1; @@ -864,10 +864,10 @@ afr_revalidate_lookup_cbk (call_frame_t *frame, void *cookie, if (child_index == first_up_child) { local->cont.lookup.ino = - afr_itransform (buf->st_ino, + afr_itransform (buf->ia_ino, priv->child_count, first_up_child); - local->cont.lookup.gen = buf->st_dev; + local->cont.lookup.gen = buf->ia_gen; } /* in case of revalidate, we need to send stat of the @@ -889,7 +889,7 @@ afr_revalidate_lookup_cbk (call_frame_t *frame, void *cookie, *lookup_buf = *buf; - lookup_buf->st_ino = afr_itransform (buf->st_ino, + lookup_buf->ia_ino = afr_itransform (buf->ia_ino, priv->child_count, child_index); @@ -1460,8 +1460,8 @@ out: int afr_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *prebuf, - struct stat *postbuf) + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf) { afr_local_t *local = NULL; @@ -1503,8 +1503,8 @@ 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.st_ino = local->cont.fsync.ino; - local->cont.fsync.postbuf.st_ino = local->cont.fsync.ino; + 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, diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index a5c75add7..589d5dffc 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -97,7 +97,7 @@ typedef struct { gf_boolean_t background; /* do self-heal in background if possible */ - mode_t mode; /* st_mode of the entry we're doing + ia_type_t type; /* st_mode of the entry we're doing self-heal on */ /* Function to call to unwind. If self-heal is being done in the @@ -109,8 +109,8 @@ typedef struct { /* array of stat's, one for each child */ - struct stat *buf; - struct stat parentbuf; + struct iatt *buf; + struct iatt parentbuf; /* array of xattr's, one for each child */ dict_t **xattr; @@ -251,9 +251,9 @@ typedef struct _afr_local { struct { inode_t *inode; - struct stat buf; - struct stat read_child_buf; - struct stat postparent; + struct iatt buf; + struct iatt read_child_buf; + struct iatt postparent; ino_t ino; uint64_t gen; ino_t parent_ino; @@ -348,8 +348,8 @@ typedef struct _afr_local { struct { ino_t ino; - struct stat prebuf; - struct stat postbuf; + struct iatt prebuf; + struct iatt postbuf; int32_t op_ret; @@ -361,38 +361,38 @@ typedef struct _afr_local { struct { ino_t ino; - struct stat prebuf; - struct stat postbuf; + struct iatt prebuf; + struct iatt postbuf; } fsync; struct { ino_t ino; off_t offset; - struct stat prebuf; - struct stat postbuf; + struct iatt prebuf; + struct iatt postbuf; } truncate; struct { ino_t ino; off_t offset; - struct stat prebuf; - struct stat postbuf; + struct iatt prebuf; + struct iatt postbuf; } ftruncate; struct { ino_t ino; - struct stat in_buf; + struct iatt in_buf; int32_t valid; - struct stat preop_buf; - struct stat postop_buf; + struct iatt preop_buf; + struct iatt postop_buf; } setattr; struct { ino_t ino; - struct stat in_buf; + struct iatt in_buf; int32_t valid; - struct stat preop_buf; - struct stat postop_buf; + struct iatt preop_buf; + struct iatt postop_buf; } fsetattr; struct { @@ -414,10 +414,10 @@ typedef struct _afr_local { int32_t flags; mode_t mode; inode_t *inode; - struct stat buf; - struct stat preparent; - struct stat postparent; - struct stat read_child_buf; + struct iatt buf; + struct iatt preparent; + struct iatt postparent; + struct iatt read_child_buf; } create; struct { @@ -427,10 +427,10 @@ typedef struct _afr_local { dev_t dev; mode_t mode; inode_t *inode; - struct stat buf; - struct stat preparent; - struct stat postparent; - struct stat read_child_buf; + struct iatt buf; + struct iatt preparent; + struct iatt postparent; + struct iatt read_child_buf; } mknod; struct { @@ -439,38 +439,38 @@ typedef struct _afr_local { ino_t parent_ino; int32_t mode; inode_t *inode; - struct stat buf; - struct stat read_child_buf; - struct stat preparent; - struct stat postparent; + struct iatt buf; + struct iatt read_child_buf; + struct iatt preparent; + struct iatt postparent; } mkdir; struct { ino_t parent_ino; int32_t op_ret; int32_t op_errno; - struct stat preparent; - struct stat postparent; + struct iatt preparent; + struct iatt postparent; } unlink; struct { ino_t parent_ino; int32_t op_ret; int32_t op_errno; - struct stat preparent; - struct stat postparent; + struct iatt preparent; + struct iatt postparent; } rmdir; struct { ino_t oldparent_ino; ino_t newparent_ino; ino_t ino; - struct stat buf; - struct stat read_child_buf; - struct stat preoldparent; - struct stat prenewparent; - struct stat postoldparent; - struct stat postnewparent; + struct iatt buf; + struct iatt read_child_buf; + struct iatt preoldparent; + struct iatt prenewparent; + struct iatt postoldparent; + struct iatt postnewparent; } rename; struct { @@ -478,10 +478,10 @@ typedef struct _afr_local { uint64_t gen; ino_t parent_ino; inode_t *inode; - struct stat buf; - struct stat read_child_buf; - struct stat preparent; - struct stat postparent; + struct iatt buf; + struct iatt read_child_buf; + struct iatt preparent; + struct iatt postparent; } link; struct { @@ -489,11 +489,11 @@ typedef struct _afr_local { uint64_t gen; ino_t parent_ino; inode_t *inode; - struct stat buf; - struct stat read_child_buf; + struct iatt buf; + struct iatt read_child_buf; char *linkpath; - struct stat preparent; - struct stat postparent; + struct iatt preparent; + struct iatt postparent; } symlink; struct { diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 6f0ab4ae5..1ee723d9c 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -59,8 +59,8 @@ dht_lookup_selfheal_cbk (call_frame_t *frame, void *cookie, layout = local->selfheal.layout; ret = dht_layout_set (this, local->inode, layout); - if (local->st_ino) { - local->stbuf.st_ino = local->st_ino; + 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", @@ -68,7 +68,7 @@ dht_lookup_selfheal_cbk (call_frame_t *frame, void *cookie, } if (local->loc.parent) - local->postparent.st_ino = local->loc.parent->ino; + local->postparent.ia_ino = local->loc.parent->ino; } WIPE (&local->postparent); @@ -83,8 +83,8 @@ dht_lookup_selfheal_cbk (call_frame_t *frame, void *cookie, int dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, dict_t *xattr, - struct stat *postparent) + inode_t *inode, struct iatt *stbuf, dict_t *xattr, + struct iatt *postparent) { dht_conf_t *conf = NULL; dht_local_t *local = NULL; @@ -125,7 +125,7 @@ dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_log (this->name, GF_LOG_DEBUG, "lookup of %s on %s returned non dir 0%o", local->loc.path, prev->this->name, - stbuf->st_mode); + stbuf->ia_type); local->need_selfheal = 1; goto unlock; } @@ -136,13 +136,13 @@ dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (local->inode == NULL) local->inode = inode_ref (inode); - dht_stat_merge (this, &local->stbuf, stbuf, prev->this); - dht_stat_merge (this, &local->postparent, postparent, + dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); + dht_iatt_merge (this, &local->postparent, postparent, prev->this); if (prev->this == dht_first_up_subvol (this)) { - local->st_ino = local->stbuf.st_ino; - local->st_dev = local->stbuf.st_dev; + local->ia_ino = local->stbuf.ia_ino; + local->ia_gen = local->stbuf.ia_gen; } } @@ -171,9 +171,9 @@ unlock: dht_layout_set (this, local->inode, layout); - if (local->st_ino) { - local->stbuf.st_ino = local->st_ino; - local->stbuf.st_dev = local->st_dev; + if (local->ia_ino) { + local->stbuf.ia_ino = local->ia_ino; + local->stbuf.ia_gen = local->ia_gen; } else { gf_log (this->name, GF_LOG_DEBUG, "could not find hashed subvol for %s", @@ -181,7 +181,7 @@ unlock: } if (local->loc.parent) - local->postparent.st_ino = + local->postparent.ia_ino = local->loc.parent->ino; } @@ -203,8 +203,8 @@ selfheal: int dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, dict_t *xattr, - struct stat *postparent) + inode_t *inode, struct iatt *stbuf, dict_t *xattr, + struct iatt *postparent) { dht_local_t *local = NULL; int this_call_cnt = 0; @@ -242,11 +242,10 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto unlock; } - if (S_IFMT & (stbuf->st_mode ^ local->inode->st_mode)) { + if (stbuf->ia_type != local->inode->ia_type) { gf_log (this->name, GF_LOG_DEBUG, "mismatching filetypes 0%o v/s 0%o for %s", - (stbuf->st_mode & S_IFMT), - (local->inode->st_mode & S_IFMT), + (stbuf->ia_type), (local->inode->ia_type), local->loc.path); local->op_ret = -1; @@ -284,16 +283,16 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } } - dht_stat_merge (this, &local->stbuf, stbuf, prev->this); - dht_stat_merge (this, &local->postparent, postparent, + dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); + dht_iatt_merge (this, &local->postparent, postparent, prev->this); local->op_ret = 0; - local->stbuf.st_ino = local->st_ino; - local->stbuf.st_dev = local->loc.inode->generation; + local->stbuf.ia_ino = local->ia_ino; + local->stbuf.ia_gen = local->loc.inode->generation; if (local->loc.parent) - local->postparent.st_ino = local->loc.parent->ino; + local->postparent.ia_ino = local->loc.parent->ino; if (!local->xattr) local->xattr = dict_ref (xattr); @@ -304,11 +303,11 @@ unlock: this_call_cnt = dht_frame_return (frame); if (is_last_call (this_call_cnt)) { - if (!S_ISDIR (local->stbuf.st_mode) + if (!IA_ISDIR (local->stbuf.ia_type) && (local->hashed_subvol != local->cached_subvol) - && (local->stbuf.st_nlink == 1) + && (local->stbuf.ia_nlink == 1) && (conf->unhashed_sticky_bit)) { - local->stbuf.st_mode |= S_ISVTX; + local->stbuf.ia_prot.sticky = 1; } if (local->layout_mismatch) { @@ -331,8 +330,8 @@ int dht_lookup_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf, - struct stat *preparent, struct stat *postparent) + inode_t *inode, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent) { dht_local_t *local = NULL; xlator_t *cached_subvol = NULL; @@ -354,13 +353,13 @@ dht_lookup_linkfile_create_cbk (call_frame_t *frame, void *cookie, } local->op_ret = 0; - if ((local->stbuf.st_nlink == 1) + if ((local->stbuf.ia_nlink == 1) && (conf->unhashed_sticky_bit)) { - local->stbuf.st_mode |= S_ISVTX; + local->stbuf.ia_prot.sticky = 1; } if (local->loc.parent) - local->postparent.st_ino = local->loc.parent->ino; + local->postparent.ia_ino = local->loc.parent->ino; unwind: WIPE (&local->postparent); @@ -375,8 +374,8 @@ unwind: int dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr, - struct stat *postparent) + inode_t *inode, struct iatt *buf, dict_t *xattr, + struct iatt *postparent) { dht_conf_t *conf = NULL; dht_local_t *local = NULL; @@ -431,7 +430,7 @@ dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (!local->cached_subvol) { /* found one file */ - dht_stat_merge (this, &local->stbuf, buf, + dht_iatt_merge (this, &local->stbuf, buf, subvol); local->xattr = dict_ref (xattr); local->cached_subvol = subvol; @@ -439,7 +438,7 @@ dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "found on %s file %s", subvol->name, loc->path); - dht_stat_merge (this, &local->postparent, + dht_iatt_merge (this, &local->postparent, postparent, subvol); } else { gf_log (this->name, GF_LOG_DEBUG, @@ -507,7 +506,7 @@ unlock: } if (local->loc.parent) - local->postparent.st_ino = + local->postparent.ia_ino = local->loc.parent->ino; WIPE (&local->postparent); @@ -564,8 +563,8 @@ dht_lookup_everywhere (call_frame_t *frame, xlator_t *this, loc_t *loc) int dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, dict_t *xattr, - struct stat *postparent) + inode_t *inode, struct iatt *stbuf, dict_t *xattr, + struct iatt *postparent) { call_frame_t *prev = NULL; dht_local_t *local = NULL; @@ -601,13 +600,13 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie, goto err; } - if ((stbuf->st_nlink == 1) + if ((stbuf->ia_nlink == 1) && (conf->unhashed_sticky_bit)) { - stbuf->st_mode |= S_ISVTX; + stbuf->ia_prot.sticky = 1; } - dht_itransform (this, prev->this, stbuf->st_ino, &stbuf->st_ino); + dht_itransform (this, prev->this, stbuf->ia_ino, &stbuf->ia_ino); if (local->loc.parent) - postparent->st_ino = local->loc.parent->ino; + postparent->ia_ino = local->loc.parent->ino; ret = dht_layout_preset (this, prev->this, inode); if (ret < 0) { @@ -669,8 +668,8 @@ dht_lookup_directory (call_frame_t *frame, xlator_t *this, loc_t *loc) int dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, dict_t *xattr, - struct stat *postparent) + inode_t *inode, struct iatt *stbuf, dict_t *xattr, + struct iatt *postparent) { char is_linkfile = 0; char is_dir = 0; @@ -729,10 +728,10 @@ dht_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->st_ino, - &stbuf->st_ino); + dht_itransform (this, prev->this, stbuf->ia_ino, + &stbuf->ia_ino); if (loc->parent) - postparent->st_ino = loc->parent->ino; + postparent->ia_ino = loc->parent->ino; ret = dht_layout_preset (this, prev->this, inode); if (ret < 0) { @@ -766,10 +765,10 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, out: /* - * FIXME: postparent->st_size and postparent->st_blocks do not have + * FIXME: postparent->ia_size and postparent->st_blocks do not have * correct values. since, postparent corresponds to a directory these * two members should have values equal to sum of corresponding values - * from each of the subvolume. See dht_stat_merge for reference. + * from each of the subvolume. See dht_iatt_merge for reference. */ WIPE (postparent); @@ -855,7 +854,7 @@ dht_lookup (call_frame_t *frame, xlator_t *this, } local->inode = inode_ref (loc->inode); - local->st_ino = loc->inode->ino; + local->ia_ino = loc->inode->ino; local->call_cnt = layout->cnt; call_cnt = local->call_cnt; @@ -927,8 +926,8 @@ err: int dht_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct stat *prebuf, - struct stat *postbuf) + int op_ret, int op_errno, struct iatt *prebuf, + struct iatt *postbuf) { dht_local_t *local = NULL; int this_call_cnt = 0; @@ -948,12 +947,12 @@ dht_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto unlock; } - dht_stat_merge (this, &local->prebuf, prebuf, prev->this); - dht_stat_merge (this, &local->stbuf, postbuf, prev->this); + dht_iatt_merge (this, &local->prebuf, prebuf, prev->this); + dht_iatt_merge (this, &local->stbuf, postbuf, prev->this); if (local->inode) { - local->stbuf.st_ino = local->inode->ino; - local->prebuf.st_ino = local->inode->ino; + local->stbuf.ia_ino = local->inode->ino; + local->prebuf.ia_ino = local->inode->ino; } local->op_ret = 0; @@ -973,7 +972,7 @@ unlock: int dht_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct stat *stbuf) + int op_ret, int op_errno, struct iatt *stbuf) { dht_local_t *local = NULL; int this_call_cnt = 0; @@ -993,10 +992,10 @@ dht_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto unlock; } - dht_stat_merge (this, &local->stbuf, stbuf, prev->this); + dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); if (local->inode) - local->stbuf.st_ino = local->inode->ino; + local->stbuf.ia_ino = local->inode->ino; local->op_ret = 0; } unlock: @@ -1213,8 +1212,8 @@ err: int dht_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct stat *preparent, - struct stat *postparent) + int op_ret, int op_errno, struct iatt *preparent, + struct iatt *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -1233,8 +1232,8 @@ dht_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto unlock; } - preparent->st_ino = local->loc.parent->ino; - postparent->st_ino = local->loc.parent->ino; + preparent->ia_ino = local->loc.parent->ino; + postparent->ia_ino = local->loc.parent->ino; local->op_ret = 0; local->postparent = *postparent; @@ -1255,8 +1254,8 @@ unlock: int dht_unlink_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct stat *preparent, - struct stat *postparent) + int op_ret, int op_errno, struct iatt *preparent, + struct iatt *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -1308,7 +1307,7 @@ err: int dht_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, - int op_errno, struct stat *prebuf, struct stat *postbuf) + int op_errno, struct iatt *prebuf, struct iatt *postbuf) { dht_local_t *local = NULL; int this_call_cnt = 0; @@ -1334,8 +1333,8 @@ unlock: UNLOCK (&frame->lock); if (local && (op_ret == 0)) { - prebuf->st_ino = local->st_ino; - postbuf->st_ino = local->st_ino; + prebuf->ia_ino = local->ia_ino; + postbuf->ia_ino = local->ia_ino; } this_call_cnt = dht_frame_return (frame); @@ -1433,7 +1432,7 @@ err: int dht_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, const char *path, struct stat *sbuf) + int op_ret, int op_errno, const char *path, struct iatt *sbuf) { dht_local_t *local = NULL; @@ -1442,7 +1441,7 @@ dht_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto err; if (local) { - sbuf->st_ino = local->st_ino; + sbuf->ia_ino = local->ia_ino; } else { op_ret = -1; op_errno = EINVAL; @@ -1485,7 +1484,7 @@ dht_readlink (call_frame_t *frame, xlator_t *this, goto err; } - local->st_ino = loc->inode->ino; + local->ia_ino = loc->inode->ino; STACK_WIND (frame, dht_readlink_cbk, subvol, subvol->fops->readlink, @@ -1735,7 +1734,7 @@ err: int dht_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - struct iovec *vector, int count, struct stat *stbuf, + struct iovec *vector, int count, struct iatt *stbuf, struct iobref *iobref) { dht_local_t *local = frame->local; @@ -1745,7 +1744,7 @@ dht_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_errno = EINVAL; goto out; } - stbuf->st_ino = local->st_ino; + stbuf->ia_ino = local->ia_ino; out: DHT_STACK_UNWIND (readv, frame, op_ret, op_errno, vector, count, stbuf, iobref); @@ -1781,7 +1780,7 @@ dht_readv (call_frame_t *frame, xlator_t *this, goto err; } - local->st_ino = fd->inode->ino; + local->ia_ino = fd->inode->ino; STACK_WIND (frame, dht_readv_cbk, subvol, subvol->fops->readv, fd, size, off); @@ -1798,8 +1797,8 @@ err: int dht_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct stat *prebuf, - struct stat *postbuf) + int op_ret, int op_errno, struct iatt *prebuf, + struct iatt *postbuf) { dht_local_t *local = NULL; @@ -1814,8 +1813,8 @@ dht_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto out; } - prebuf->st_ino = local->st_ino; - postbuf->st_ino = local->st_ino; + prebuf->ia_ino = local->ia_ino; + postbuf->ia_ino = local->ia_ino; out: DHT_STACK_UNWIND (writev, frame, op_ret, op_errno, prebuf, postbuf); @@ -1853,7 +1852,7 @@ dht_writev (call_frame_t *frame, xlator_t *this, goto err; } - local->st_ino = fd->inode->ino; + local->ia_ino = fd->inode->ino; STACK_WIND (frame, dht_writev_cbk, subvol, subvol->fops->writev, @@ -1943,7 +1942,7 @@ dht_fsync (call_frame_t *frame, xlator_t *this, } local->call_cnt = 1; - local->st_ino = fd->inode->ino; + local->ia_ino = fd->inode->ino; STACK_WIND (frame, dht_fsync_cbk, subvol, subvol->fops->fsync, @@ -2199,7 +2198,7 @@ dht_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, dht_itransform (this, prev->this, orig_entry->d_off, &entry->d_off); - entry->d_stat.st_ino = entry->d_ino; + entry->d_stat.ia_ino = entry->d_ino; entry->d_type = orig_entry->d_type; entry->d_len = orig_entry->d_len; @@ -2489,8 +2488,8 @@ err: int dht_newfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, struct stat *preparent, - struct stat *postparent) + inode_t *inode, struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent) { call_frame_t *prev = NULL; int ret = -1; @@ -2509,10 +2508,10 @@ dht_newfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, prev = cookie; - dht_itransform (this, prev->this, stbuf->st_ino, &stbuf->st_ino); + dht_itransform (this, prev->this, stbuf->ia_ino, &stbuf->ia_ino); if (local->loc.parent) { - preparent->st_ino = local->loc.parent->ino; - postparent->st_ino = local->loc.parent->ino; + preparent->ia_ino = local->loc.parent->ino; + postparent->ia_ino = local->loc.parent->ino; WIPE (preparent); WIPE (postparent); @@ -2529,11 +2528,11 @@ dht_newfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } out: /* - * FIXME: st_size and st_blocks of preparent and postparent do not have + * FIXME: ia_size and st_blocks of preparent and postparent do not have * correct values. since, preparent and postparent buffers correspond * to a directory these two members should have values equal to sum of * corresponding values from each of the subvolume. - * See dht_stat_merge for reference. + * See dht_iatt_merge for reference. */ DHT_STACK_UNWIND (mknod, frame, op_ret, op_errno, inode, stbuf, preparent, @@ -2545,8 +2544,8 @@ int dht_mknod_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf, - struct stat *preparent, struct stat *postparent) + inode_t *inode, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent) { dht_local_t *local = NULL; xlator_t *cached_subvol = NULL; @@ -2775,8 +2774,8 @@ err: int dht_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, struct stat *preparent, - struct stat *postparent) + inode_t *inode, struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent) { call_frame_t *prev = NULL; dht_layout_t *layout = NULL; @@ -2798,10 +2797,10 @@ dht_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto out; } - stbuf->st_ino = local->loc.inode->ino; + stbuf->ia_ino = local->loc.inode->ino; - preparent->st_ino = local->loc2.parent->ino; - postparent->st_ino = local->loc2.parent->ino; + preparent->ia_ino = local->loc2.parent->ino; + postparent->ia_ino = local->loc2.parent->ino; WIPE (preparent); WIPE (postparent); @@ -2817,8 +2816,8 @@ out: int dht_link_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, - struct stat *preparent, struct stat *postparent) + inode_t *inode, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent) { dht_local_t *local = NULL; xlator_t *srcvol = NULL; @@ -2923,8 +2922,8 @@ err: int dht_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - fd_t *fd, inode_t *inode, struct stat *stbuf, - struct stat *preparent, struct stat *postparent) + fd_t *fd, inode_t *inode, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent) { call_frame_t *prev = NULL; int ret = -1; @@ -2942,10 +2941,10 @@ dht_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, prev = cookie; - dht_itransform (this, prev->this, stbuf->st_ino, &stbuf->st_ino); + dht_itransform (this, prev->this, stbuf->ia_ino, &stbuf->ia_ino); if (local->loc.parent) { - preparent->st_ino = local->loc.parent->ino; - postparent->st_ino = local->loc.parent->ino; + preparent->ia_ino = local->loc.parent->ino; + postparent->ia_ino = local->loc.parent->ino; WIPE (preparent); WIPE (postparent); @@ -2972,8 +2971,8 @@ int dht_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf, - struct stat *preparent, struct stat *postparent) + inode_t *inode, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent) { dht_local_t *local = NULL; xlator_t *cached_subvol = NULL; @@ -3096,11 +3095,11 @@ dht_mkdir_selfheal_cbk (call_frame_t *frame, void *cookie, if (op_ret == 0) { dht_layout_set (this, local->inode, layout); - local->stbuf.st_ino = local->st_ino; - local->stbuf.st_dev = local->st_dev; + local->stbuf.ia_ino = local->ia_ino; + local->stbuf.ia_gen = local->ia_gen; if (local->loc.parent) { - local->preparent.st_ino = local->loc.parent->ino; - local->postparent.st_ino = local->loc.parent->ino; + local->preparent.ia_ino = local->loc.parent->ino; + local->postparent.ia_ino = local->loc.parent->ino; WIPE (&local->preparent); WIPE (&local->postparent); @@ -3116,8 +3115,8 @@ dht_mkdir_selfheal_cbk (call_frame_t *frame, void *cookie, int dht_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, inode_t *inode, struct stat *stbuf, - struct stat *preparent, struct stat *postparent) + int op_ret, int op_errno, inode_t *inode, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent) { dht_local_t *local = NULL; int this_call_cnt = 0; @@ -3148,14 +3147,14 @@ dht_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_errno = op_errno; goto unlock; } - dht_stat_merge (this, &local->stbuf, stbuf, prev->this); - dht_stat_merge (this, &local->preparent, preparent, prev->this); - dht_stat_merge (this, &local->postparent, postparent, + dht_iatt_merge (this, &local->stbuf, stbuf, prev->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->st_ino = local->stbuf.st_ino; - local->st_dev = local->stbuf.st_dev; + local->ia_ino = local->stbuf.ia_ino; + local->ia_gen = local->stbuf.ia_gen; } } @@ -3174,8 +3173,8 @@ unlock: int dht_mkdir_hashed_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, - struct stat *preparent, struct stat *postparent) + inode_t *inode, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent) { dht_local_t *local = NULL; int ret = -1; @@ -3204,12 +3203,12 @@ dht_mkdir_hashed_cbk (call_frame_t *frame, void *cookie, } local->op_ret = 0; - dht_stat_merge (this, &local->stbuf, stbuf, prev->this); - dht_stat_merge (this, &local->preparent, preparent, prev->this); - dht_stat_merge (this, &local->postparent, postparent, prev->this); + dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); + dht_iatt_merge (this, &local->preparent, preparent, prev->this); + dht_iatt_merge (this, &local->postparent, postparent, prev->this); - local->st_ino = local->stbuf.st_ino; - local->st_dev = local->stbuf.st_dev; + local->ia_ino = local->stbuf.ia_ino; + local->ia_gen = local->stbuf.ia_gen; local->call_cnt = conf->subvolume_cnt - 1; @@ -3314,8 +3313,8 @@ dht_rmdir_selfheal_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local = frame->local; if (local->loc.parent) { - local->preparent.st_ino = local->loc.parent->ino; - local->postparent.st_ino = local->loc.parent->ino; + 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, @@ -3327,8 +3326,8 @@ dht_rmdir_selfheal_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int dht_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct stat *preparent, - struct stat *postparent) + int op_ret, int op_errno, struct iatt *preparent, + struct iatt *postparent) { dht_local_t *local = NULL; int this_call_cnt = 0; @@ -3353,8 +3352,8 @@ dht_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto unlock; } - dht_stat_merge (this, &local->preparent, preparent, prev->this); - dht_stat_merge (this, &local->postparent, postparent, + dht_iatt_merge (this, &local->preparent, preparent, prev->this); + dht_iatt_merge (this, &local->postparent, postparent, prev->this); } unlock: @@ -3368,15 +3367,15 @@ unlock: dht_layout_get (this, local->loc.inode); /* TODO: neater interface needed below */ - local->stbuf.st_mode = local->loc.inode->st_mode; + local->stbuf.ia_type = local->loc.inode->ia_type; dht_selfheal_restore (frame, dht_rmdir_selfheal_cbk, &local->loc, local->layout); } else { if (local->loc.parent) { - local->preparent.st_ino = + local->preparent.ia_ino = local->loc.parent->ino; - local->postparent.st_ino = + local->postparent.ia_ino = local->loc.parent->ino; WIPE (&local->preparent); @@ -3426,8 +3425,8 @@ err: int dht_rmdir_linkfile_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct stat *preparent, - struct stat *postparent) + int op_ret, int op_errno, struct iatt *preparent, + struct iatt *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -3467,7 +3466,7 @@ dht_rmdir_linkfile_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this int dht_rmdir_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, inode_t *inode, - struct stat *stbuf, dict_t *xattr, struct stat *parent) + struct iatt *stbuf, dict_t *xattr, struct iatt *parent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -3491,8 +3490,8 @@ dht_rmdir_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, main_local->op_errno = ENOTEMPTY; gf_log (this->name, GF_LOG_WARNING, - "%s on %s found to be not a linkfile (mode=0%o)", - local->loc.path, src->name, stbuf->st_mode); + "%s on %s found to be not a linkfile (type=0%o)", + local->loc.path, src->name, stbuf->ia_type); goto err; } @@ -4048,8 +4047,8 @@ err: int dht_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct stat *statpre, - struct stat *statpost) + int op_ret, int op_errno, struct iatt *statpre, + struct iatt *statpost) { dht_local_t *local = NULL; int this_call_cnt = 0; @@ -4069,12 +4068,12 @@ dht_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto unlock; } - dht_stat_merge (this, &local->prebuf, statpre, prev->this); - dht_stat_merge (this, &local->stbuf, statpost, prev->this); + dht_iatt_merge (this, &local->prebuf, statpre, prev->this); + dht_iatt_merge (this, &local->stbuf, statpost, prev->this); if (local->inode) { - local->prebuf.st_ino = local->inode->ino; - local->stbuf.st_ino = local->inode->ino; + local->prebuf.ia_ino = local->inode->ino; + local->stbuf.ia_ino = local->inode->ino; } local->op_ret = 0; @@ -4093,7 +4092,7 @@ unlock: int dht_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { dht_layout_t *layout = NULL; dht_local_t *local = NULL; @@ -4151,7 +4150,7 @@ err: int -dht_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, struct stat *stbuf, +dht_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iatt *stbuf, int32_t valid) { dht_layout_t *layout = NULL; diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 9b978155e..e6e1e8181 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -67,12 +67,12 @@ struct dht_local { int layout_mismatch; /* Use stbuf as the postbuf, when we require both * pre and post attrs */ - struct stat stbuf; - struct stat prebuf; - struct stat preoldparent; - struct stat postoldparent; - struct stat preparent; - struct stat postparent; + struct iatt stbuf; + struct iatt prebuf; + struct iatt preoldparent; + struct iatt postoldparent; + struct iatt preparent; + struct iatt postparent; struct statvfs statvfs; fd_t *fd; inode_t *inode; @@ -80,8 +80,8 @@ struct dht_local { dict_t *xattr_req; dht_layout_t *layout; size_t size; - ino_t st_ino; - ino_t st_dev; + ino_t ia_ino; + ino_t ia_gen; xlator_t *src_hashed, *src_cached; xlator_t *dst_hashed, *dst_cached; xlator_t *cached_subvol; @@ -92,7 +92,7 @@ struct dht_local { call_frame_t *main_frame; struct { fop_mknod_cbk_t linkfile_cbk; - struct stat stbuf; + struct iatt stbuf; loc_t loc; inode_t *inode; dict_t *xattr; @@ -169,11 +169,12 @@ typedef struct dht_disk_layout dht_disk_layout_t; #define is_last_call(cnt) (cnt == 0) #define DHT_LINKFILE_MODE (S_ISVTX) -#define check_is_linkfile(i,s,x) ( \ - ((s->st_mode & ~S_IFMT) == DHT_LINKFILE_MODE) && \ - (s->st_size == 0)) +#define check_is_linkfile(i,s,x) ( \ + ((st_mode_from_ia (s->ia_prot, s->ia_type) & ~S_IFMT) \ + == DHT_LINKFILE_MODE) && \ + (s->ia_size == 0)) -#define check_is_dir(i,s,x) (S_ISDIR(s->st_mode)) +#define check_is_dir(i,s,x) (IA_ISDIR(s->ia_type)) #define layout_is_sane(layout) ((layout) && (layout->cnt > 0)) @@ -211,7 +212,7 @@ int dht_layout_dir_mismatch (xlator_t *this, dht_layout_t *layout, xlator_t *subvol, loc_t *loc, dict_t *xattr); xlator_t *dht_linkfile_subvol (xlator_t *this, inode_t *inode, - struct stat *buf, dict_t *xattr); + struct iatt *buf, dict_t *xattr); int dht_linkfile_unlink (call_frame_t *frame, xlator_t *this, xlator_t *subvol, loc_t *loc); @@ -233,7 +234,7 @@ int dht_deitransform (xlator_t *this, uint64_t y, xlator_t **subvol, void dht_local_wipe (xlator_t *this, dht_local_t *local); dht_local_t *dht_local_init (call_frame_t *frame); -int dht_stat_merge (xlator_t *this, struct stat *to, struct stat *from, +int dht_iatt_merge (xlator_t *this, struct iatt *to, struct iatt *from, xlator_t *subvol); xlator_t *dht_subvol_get_hashed (xlator_t *this, loc_t *loc); diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index fc7f7a4bf..f2e1a182a 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -340,29 +340,31 @@ dht_subvol_cnt (xlator_t *this, xlator_t *subvol) } while (0) int -dht_stat_merge (xlator_t *this, struct stat *to, - struct stat *from, xlator_t *subvol) +dht_iatt_merge (xlator_t *this, struct iatt *to, + struct iatt *from, xlator_t *subvol) { if (!from || !to) return 0; - to->st_dev = from->st_dev; + to->ia_dev = from->ia_dev; - dht_itransform (this, subvol, from->st_ino, &to->st_ino); + dht_itransform (this, subvol, from->ia_ino, &to->ia_ino); + to->ia_gen = from->ia_gen; - to->st_mode = from->st_mode; - to->st_nlink = from->st_nlink; - to->st_rdev = from->st_rdev; - to->st_size += from->st_size; - to->st_blksize = from->st_blksize; - to->st_blocks += from->st_blocks; + to->ia_prot = from->ia_prot; + to->ia_type = from->ia_type; + to->ia_nlink = from->ia_nlink; + to->ia_rdev = from->ia_rdev; + to->ia_size += from->ia_size; + to->ia_blksize = from->ia_blksize; + to->ia_blocks += from->ia_blocks; - set_if_greater (to->st_uid, from->st_uid); - set_if_greater (to->st_gid, from->st_gid); + set_if_greater (to->ia_uid, from->ia_uid); + set_if_greater (to->ia_gid, from->ia_gid); - set_if_greater (to->st_atime, from->st_atime); - set_if_greater (to->st_mtime, from->st_mtime); - set_if_greater (to->st_ctime, from->st_ctime); + set_if_greater (to->ia_atime, from->ia_atime); + set_if_greater (to->ia_mtime, from->ia_mtime); + set_if_greater (to->ia_ctime, from->ia_ctime); return 0; } diff --git a/xlators/cluster/dht/src/dht-linkfile.c b/xlators/cluster/dht/src/dht-linkfile.c index 77e7818ef..3f4630cf4 100644 --- a/xlators/cluster/dht/src/dht-linkfile.c +++ b/xlators/cluster/dht/src/dht-linkfile.c @@ -49,8 +49,8 @@ dht_linkfile_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int dht_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, inode_t *inode, - struct stat *stbuf, struct stat *preparent, - struct stat *postparent) + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -134,7 +134,7 @@ dht_linkfile_create (call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk, int dht_linkfile_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preparent, struct stat *postparent) + struct iatt *preparent, struct iatt *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -193,7 +193,7 @@ err: xlator_t * -dht_linkfile_subvol (xlator_t *this, inode_t *inode, struct stat *stbuf, +dht_linkfile_subvol (xlator_t *this, inode_t *inode, struct iatt *stbuf, dict_t *xattr) { dht_conf_t *conf = NULL; diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c index b0356da87..54c41120c 100644 --- a/xlators/cluster/dht/src/dht-rename.c +++ b/xlators/cluster/dht/src/dht-rename.c @@ -33,9 +33,9 @@ int dht_rename_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf, - struct stat *preoldparent, struct stat *postoldparent, - struct stat *prenewparent, struct stat *postnewparent) + int32_t op_ret, int32_t op_errno, struct iatt *stbuf, + struct iatt *preoldparent, struct iatt *postoldparent, + struct iatt *prenewparent, struct iatt *postnewparent) { dht_local_t *local = NULL; int this_call_cnt = 0; @@ -61,26 +61,26 @@ dht_rename_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * FIXME: is this the correct way to build stbuf and * parent bufs? */ - dht_stat_merge (this, &local->stbuf, stbuf, prev->this); - dht_stat_merge (this, &local->preoldparent, preoldparent, + dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); + dht_iatt_merge (this, &local->preoldparent, preoldparent, prev->this); - dht_stat_merge (this, &local->postoldparent, postoldparent, + dht_iatt_merge (this, &local->postoldparent, postoldparent, prev->this); - dht_stat_merge (this, &local->preparent, prenewparent, + dht_iatt_merge (this, &local->preparent, prenewparent, prev->this); - dht_stat_merge (this, &local->postparent, postnewparent, + dht_iatt_merge (this, &local->postparent, postnewparent, prev->this); } this_call_cnt = dht_frame_return (frame); if (is_last_call (this_call_cnt)) { - local->stbuf.st_ino = local->loc.inode->ino; + local->stbuf.ia_ino = local->loc.inode->ino; - local->preoldparent.st_ino = local->loc.parent->ino; - local->postoldparent.st_ino = local->loc.parent->ino; + local->preoldparent.ia_ino = local->loc.parent->ino; + local->postoldparent.ia_ino = local->loc.parent->ino; - local->preparent.st_ino = local->loc2.parent->ino; - local->postparent.st_ino = local->loc2.parent->ino; + local->preparent.ia_ino = local->loc2.parent->ino; + local->postparent.ia_ino = local->loc2.parent->ino; WIPE (&local->preoldparent); WIPE (&local->postoldparent); @@ -243,8 +243,8 @@ err: int dht_rename_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *preparent, - struct stat *postparent) + int32_t op_ret, int32_t op_errno, struct iatt *preparent, + struct iatt *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -347,9 +347,9 @@ nolinks: int dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf, - struct stat *preoldparent, struct stat *postoldparent, - struct stat *prenewparent, struct stat *postnewparent) + int32_t op_ret, int32_t op_errno, struct iatt *stbuf, + struct iatt *preoldparent, struct iatt *postoldparent, + struct iatt *prenewparent, struct iatt *postnewparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -376,19 +376,19 @@ dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto cleanup; } - dht_stat_merge (this, &local->stbuf, stbuf, prev->this); - dht_stat_merge (this, &local->preoldparent, preoldparent, prev->this); - dht_stat_merge (this, &local->postoldparent, postoldparent, prev->this); - dht_stat_merge (this, &local->preparent, prenewparent, prev->this); - dht_stat_merge (this, &local->postparent, postnewparent, prev->this); + dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); + dht_iatt_merge (this, &local->preoldparent, preoldparent, prev->this); + dht_iatt_merge (this, &local->postoldparent, postoldparent, prev->this); + dht_iatt_merge (this, &local->preparent, prenewparent, prev->this); + dht_iatt_merge (this, &local->postparent, postnewparent, prev->this); - local->stbuf.st_ino = local->loc.inode->ino; + local->stbuf.ia_ino = local->loc.inode->ino; - local->preoldparent.st_ino = local->loc.parent->ino; - local->postoldparent.st_ino = local->loc.parent->ino; + local->preoldparent.ia_ino = local->loc.parent->ino; + local->postoldparent.ia_ino = local->loc.parent->ino; - local->preparent.st_ino = local->loc2.parent->ino; - local->postparent.st_ino = local->loc2.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, @@ -504,8 +504,8 @@ dht_do_rename (call_frame_t *frame) int dht_rename_links_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf, - struct stat *preparent, struct stat *postparent) + inode_t *inode, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -680,7 +680,7 @@ dht_rename (call_frame_t *frame, xlator_t *this, newloc->path, dst_hashed->name, dst_cached ? dst_cached->name : "<nul>"); - if (S_ISDIR (oldloc->inode->st_mode)) { + if (IA_ISDIR (oldloc->inode->ia_type)) { dht_rename_dir (frame, this); } else { local->op_ret = 0; diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index a254b0ddc..8a4d3a6f5 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -196,8 +196,8 @@ dht_selfheal_dir_xattr (call_frame_t *frame, loc_t *loc, dht_layout_t *layout) int dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, - struct stat *preparent, struct stat *postparent) + inode_t *inode, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent) { dht_local_t *local = NULL; dht_layout_t *layout = NULL; @@ -212,12 +212,12 @@ dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, prev = cookie; subvol = prev->this; - dht_stat_merge (this, &local->stbuf, stbuf, prev->this); + dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); if (prev->this == local->hashed_subvol) - local->st_ino = local->stbuf.st_ino; + local->ia_ino = local->stbuf.ia_ino; - dht_stat_merge (this, &local->preparent, preparent, prev->this); - dht_stat_merge (this, &local->postparent, postparent, prev->this); + dht_iatt_merge (this, &local->preparent, preparent, prev->this); + dht_iatt_merge (this, &local->postparent, postparent, prev->this); if ((op_ret == 0) || (op_errno == EEXIST)) { for (i = 0; i < layout->cnt; i++) { @@ -271,7 +271,9 @@ dht_selfheal_dir_mkdir (call_frame_t *frame, loc_t *loc, STACK_WIND (frame, dht_selfheal_dir_mkdir_cbk, layout->list[i].xlator, layout->list[i].xlator->fops->mkdir, - loc, local->stbuf.st_mode); + loc, + st_mode_from_ia (local->stbuf.ia_prot, + local->stbuf.ia_type)); } } diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c index a4a4a2568..edb900f76 100644 --- a/xlators/cluster/dht/src/nufa.c +++ b/xlators/cluster/dht/src/nufa.c @@ -30,8 +30,8 @@ int nufa_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, dict_t *xattr, - struct stat *postparent) + inode_t *inode, struct iatt *stbuf, dict_t *xattr, + struct iatt *postparent) { xlator_t *subvol = NULL; char is_linkfile = 0; @@ -68,8 +68,8 @@ 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->st_ino, - &stbuf->st_ino); + dht_itransform (this, prev->this, stbuf->ia_ino, + &stbuf->ia_ino); ret = dht_layout_preset (this, prev->this, inode); if (ret < 0) { @@ -224,7 +224,7 @@ nufa_lookup (call_frame_t *frame, xlator_t *this, } local->inode = inode_ref (loc->inode); - local->st_ino = loc->inode->ino; + local->ia_ino = loc->inode->ino; local->call_cnt = layout->cnt; call_cnt = local->call_cnt; @@ -271,9 +271,9 @@ err: int nufa_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, - struct stat *preparent, - struct stat *postparent) + inode_t *inode, struct iatt *stbuf, + struct iatt *preparent, + struct iatt *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -382,8 +382,8 @@ err: int nufa_mknod_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, inode_t *inode, - struct stat *stbuf, struct stat *preparent, - struct stat *postparent) + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; diff --git a/xlators/cluster/dht/src/switch.c b/xlators/cluster/dht/src/switch.c index 766bd31ff..680ce8d6f 100644 --- a/xlators/cluster/dht/src/switch.c +++ b/xlators/cluster/dht/src/switch.c @@ -104,8 +104,8 @@ get_switch_matching_subvol (const char *path, dht_conf_t *conf, int switch_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, dict_t *xattr, - struct stat *postparent) + inode_t *inode, struct iatt *stbuf, dict_t *xattr, + struct iatt *postparent) { xlator_t *subvol = NULL; char is_linkfile = 0; @@ -141,8 +141,8 @@ 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->st_ino, - &stbuf->st_ino); + dht_itransform (this, prev->this, stbuf->ia_ino, + &stbuf->ia_ino); ret = dht_layout_preset (this, prev->this, inode); if (ret < 0) { @@ -297,7 +297,7 @@ switch_lookup (call_frame_t *frame, xlator_t *this, } local->inode = inode_ref (loc->inode); - local->st_ino = loc->inode->ino; + local->ia_ino = loc->inode->ino; local->call_cnt = layout->cnt; call_cnt = local->call_cnt; @@ -379,9 +379,9 @@ err: int switch_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, - struct stat *preparent, - struct stat *postparent) + inode_t *inode, struct iatt *stbuf, + struct iatt *preparent, + struct iatt *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -489,8 +489,8 @@ err: int switch_mknod_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, inode_t *inode, - struct stat *stbuf, struct stat *preparent, - struct stat *postparent) + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; diff --git a/xlators/cluster/ha/src/ha.c b/xlators/cluster/ha/src/ha.c index 442de21df..3317ae783 100644 --- a/xlators/cluster/ha/src/ha.c +++ b/xlators/cluster/ha/src/ha.c @@ -98,9 +98,9 @@ ha_lookup_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, + struct iatt *buf, dict_t *dict, - struct stat *postparent) + struct iatt *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -245,7 +245,7 @@ ha_stat_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct iatt *buf) { int ret = -1; @@ -290,8 +290,8 @@ err: int32_t ha_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *statpre, - struct stat *statpost) + int32_t op_ret, int32_t op_errno, struct iatt *statpre, + struct iatt *statpost) { int ret = -1; @@ -305,7 +305,7 @@ ha_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t -ha_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, struct stat *stbuf, +ha_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *stbuf, int32_t valid) { ha_local_t *local = NULL; @@ -333,7 +333,7 @@ err: int32_t -ha_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, struct stat *stbuf, +ha_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iatt *stbuf, int32_t valid) { ha_local_t *local = NULL; @@ -366,8 +366,8 @@ ha_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *prebuf, - struct stat *postbuf) + struct iatt *prebuf, + struct iatt *postbuf) { int ret = -1; @@ -423,8 +423,8 @@ ha_ftruncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *prebuf, - struct stat *postbuf) + struct iatt *prebuf, + struct iatt *postbuf) { int ret = -1; @@ -546,7 +546,7 @@ ha_readlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, const char *path, - struct stat *sbuf) + struct iatt *sbuf) { int ret = -1; @@ -599,9 +599,9 @@ ha_mknod_lookup_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, + struct iatt *buf, dict_t *dict, - struct stat *postparent) + struct iatt *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -664,9 +664,9 @@ ha_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -837,9 +837,9 @@ ha_mkdir_lookup_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, + struct iatt *buf, dict_t *dict, - struct stat *postparent) + struct iatt *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -893,9 +893,9 @@ ha_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -1056,8 +1056,8 @@ ha_unlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preparent, - struct stat *postparent) + struct iatt *preparent, + struct iatt *postparent) { int ret = -1; @@ -1108,8 +1108,8 @@ ha_rmdir_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preparent, - struct stat *postparent) + struct iatt *preparent, + struct iatt *postparent) { int ret = -1; @@ -1166,9 +1166,9 @@ ha_symlink_lookup_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, + struct iatt *buf, dict_t *dict, - struct stat *postparent) + struct iatt *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -1222,9 +1222,9 @@ ha_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -1385,11 +1385,11 @@ ha_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf, - struct stat *preoldparent, - struct stat *postoldparent, - struct stat *prenewparent, - struct stat *postnewparent) + struct iatt *buf, + struct iatt *preoldparent, + struct iatt *postoldparent, + struct iatt *prenewparent, + struct iatt *postnewparent) { int ret = -1; @@ -1443,9 +1443,9 @@ ha_link_lookup_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, + struct iatt *buf, dict_t *dict, - struct stat *postparent) + struct iatt *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -1499,9 +1499,9 @@ ha_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -1669,9 +1669,9 @@ ha_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -2044,7 +2044,7 @@ ha_readv_cbk (call_frame_t *frame, int32_t op_errno, struct iovec *vector, int32_t count, - struct stat *stbuf, + struct iatt *stbuf, struct iobref *iobref) { int ret = 0; @@ -2111,8 +2111,8 @@ ha_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *prebuf, - struct stat *postbuf) + struct iatt *prebuf, + struct iatt *postbuf) { int ret = 0; ret = ha_handle_cbk (frame, cookie, op_ret, op_errno); @@ -2237,8 +2237,8 @@ ha_fsync_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *prebuf, - struct stat *postbuf) + struct iatt *prebuf, + struct iatt *postbuf) { int ret = 0; ret = ha_handle_cbk (frame, cookie, op_ret, op_errno); @@ -2297,7 +2297,7 @@ ha_fstat_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct iatt *buf) { int ret = 0; diff --git a/xlators/cluster/ha/src/ha.h b/xlators/cluster/ha/src/ha.h index 0da31850c..e5c9541db 100644 --- a/xlators/cluster/ha/src/ha.h +++ b/xlators/cluster/ha/src/ha.h @@ -28,9 +28,9 @@ typedef struct { char *state, *pattern; dict_t *dict; loc_t loc; - struct stat buf; - struct stat postparent; - struct stat preparent; + struct iatt buf; + struct iatt postparent; + struct iatt preparent; fd_t *fd; inode_t *inode; int32_t flags; diff --git a/xlators/cluster/map/src/map.c b/xlators/cluster/map/src/map.c index 72464fc82..17de0c095 100644 --- a/xlators/cluster/map/src/map.c +++ b/xlators/cluster/map/src/map.c @@ -36,13 +36,13 @@ map_stat_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct iatt *buf) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, buf->st_ino, &buf->st_ino); + map_itransform (this, prev->this, buf->ia_ino, &buf->ia_ino); STACK_UNWIND (frame, op_ret, op_errno, buf); return 0; @@ -54,14 +54,14 @@ map_setattr_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *statpre, - struct stat *statpost) + struct iatt *statpre, + struct iatt *statpost) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, statpre->st_ino, &statpre->st_ino); - map_itransform (this, prev->this, statpost->st_ino, &statpost->st_ino); + map_itransform (this, prev->this, statpre->ia_ino, &statpre->ia_ino); + map_itransform (this, prev->this, statpost->ia_ino, &statpost->ia_ino); STACK_UNWIND (frame, op_ret, op_errno, statpre, statpost); return 0; @@ -73,14 +73,14 @@ map_fsetattr_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *statpre, - struct stat *statpost) + struct iatt *statpre, + struct iatt *statpost) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, statpre->st_ino, &statpre->st_ino); - map_itransform (this, prev->this, statpost->st_ino, &statpost->st_ino); + map_itransform (this, prev->this, statpre->ia_ino, &statpre->ia_ino); + map_itransform (this, prev->this, statpost->ia_ino, &statpost->ia_ino); STACK_UNWIND (frame, op_ret, op_errno, statpre, statpost); return 0; @@ -92,13 +92,13 @@ map_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *prebuf, - struct stat *postbuf) + struct iatt *prebuf, + struct iatt *postbuf) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, postbuf->st_ino, &postbuf->st_ino); + map_itransform (this, prev->this, postbuf->ia_ino, &postbuf->ia_ino); STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -110,13 +110,13 @@ map_ftruncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *prebuf, - struct stat *postbuf) + struct iatt *prebuf, + struct iatt *postbuf) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, postbuf->st_ino, &postbuf->st_ino); + map_itransform (this, prev->this, postbuf->ia_ino, &postbuf->ia_ino); STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -141,7 +141,7 @@ map_readlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, const char *path, - struct stat *sbuf) + struct iatt *sbuf) { STACK_UNWIND (frame, op_ret, op_errno, path, sbuf); return 0; @@ -153,8 +153,8 @@ map_unlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preparent, - struct stat *postparent) + struct iatt *preparent, + struct iatt *postparent) { STACK_UNWIND (frame, op_ret, op_errno, preparent, postparent); return 0; @@ -166,8 +166,8 @@ map_rmdir_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preparent, - struct stat *postparent) + struct iatt *preparent, + struct iatt *postparent) { STACK_UNWIND (frame, op_ret, op_errno, preparent, postparent); return 0; @@ -180,16 +180,16 @@ map_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf, - struct stat *preoldparent, - struct stat *postoldparent, - struct stat *prenewparent, - struct stat *postnewparent) + struct iatt *buf, + struct iatt *preoldparent, + struct iatt *postoldparent, + struct iatt *prenewparent, + struct iatt *postnewparent) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, buf->st_ino, &buf->st_ino); + map_itransform (this, prev->this, buf->ia_ino, &buf->ia_ino); STACK_UNWIND (frame, op_ret, op_errno, buf); return 0; @@ -202,14 +202,14 @@ map_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, buf->st_ino, &buf->st_ino); + map_itransform (this, prev->this, buf->ia_ino, &buf->ia_ino); STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -235,13 +235,13 @@ map_readv_cbk (call_frame_t *frame, int32_t op_errno, struct iovec *vector, int32_t count, - struct stat *stbuf, + struct iatt *stbuf, struct iobref *iobref) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, stbuf->st_ino, &stbuf->st_ino); + map_itransform (this, prev->this, stbuf->ia_ino, &stbuf->ia_ino); STACK_UNWIND (frame, op_ret, op_errno, vector, count, stbuf, iobref); return 0; @@ -253,13 +253,13 @@ map_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *prebuf, - struct stat *postbuf) + struct iatt *prebuf, + struct iatt *postbuf) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, postbuf->st_ino, &postbuf->st_ino); + map_itransform (this, prev->this, postbuf->ia_ino, &postbuf->ia_ino); STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -283,8 +283,8 @@ map_fsync_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *prebuf, - struct stat *postbuf) + struct iatt *prebuf, + struct iatt *postbuf) { STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -297,12 +297,12 @@ map_fstat_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct iatt *buf) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, buf->st_ino, &buf->st_ino); + map_itransform (this, prev->this, buf->ia_ino, &buf->ia_ino); STACK_UNWIND (frame, op_ret, op_errno, buf); return 0; @@ -492,14 +492,14 @@ map_newentry_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, buf->st_ino, &buf->st_ino); + map_itransform (this, prev->this, buf->ia_ino, &buf->ia_ino); STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -515,14 +515,14 @@ map_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, buf->st_ino, &buf->st_ino); + map_itransform (this, prev->this, buf->ia_ino, &buf->ia_ino); STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf); return 0; @@ -624,14 +624,14 @@ map_single_lookup_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, + struct iatt *buf, dict_t *dict, - struct stat *postparent) + struct iatt *postparent) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, buf->st_ino, &buf->st_ino); + map_itransform (this, prev->this, buf->ia_ino, &buf->ia_ino); STACK_UNWIND (frame, op_ret, op_errno, inode, buf, dict); @@ -645,9 +645,9 @@ map_root_lookup_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, + struct iatt *buf, dict_t *dict, - struct stat *postparent) + struct iatt *postparent) { int callcnt = 0; map_local_t *local = NULL; @@ -762,7 +762,7 @@ map_single_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, list_for_each_entry (orig_entry, &entries->list, list) { map_itransform (this, prev->this, orig_entry->d_ino, &orig_entry->d_ino); - orig_entry->d_stat.st_ino = orig_entry->d_ino; + orig_entry->d_stat.ia_ino = orig_entry->d_ino; } STACK_UNWIND (frame, op_ret, op_errno, entries); return 0; @@ -815,7 +815,7 @@ map_generic_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, &entry->d_off); if (whichop == GF_FOP_READDIRP) - entry->d_stat.st_ino = entry->d_ino; + entry->d_stat.ia_ino = entry->d_ino; entry->d_type = orig_entry->d_type; entry->d_len = orig_entry->d_len; @@ -957,7 +957,7 @@ int32_t map_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct stat *stbuf, + struct iatt *stbuf, int32_t valid) { int32_t op_errno = 1; @@ -989,7 +989,7 @@ int32_t map_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct stat *stbuf, + struct iatt *stbuf, int32_t valid) { int32_t op_errno = 1; diff --git a/xlators/cluster/map/src/map.h b/xlators/cluster/map/src/map.h index b5f57518b..b423642cc 100644 --- a/xlators/cluster/map/src/map.h +++ b/xlators/cluster/map/src/map.h @@ -46,7 +46,7 @@ typedef struct { int32_t op_errno; int call_count; struct statvfs statvfs; - struct stat stbuf; + struct iatt stbuf; inode_t *inode; dict_t *dict; fd_t *fd; diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index 21f1d0d03..420f43e20 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -75,7 +75,7 @@ stripe_get_matching_bs (const char *path, struct stripe_options *opts, int32_t stripe_common_remove_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preparent, struct stat *postparent) + struct iatt *preparent, struct iatt *postparent) { STACK_UNWIND (frame, op_ret, op_errno, preparent, postparent); return 0; @@ -135,8 +135,8 @@ stripe_common_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t stripe_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *prebuf, - struct stat *postbuf) + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -164,14 +164,14 @@ stripe_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->pre_buf = *prebuf; local->post_buf = *postbuf; } - local->prebuf_blocks += prebuf->st_blocks; - local->postbuf_blocks += postbuf->st_blocks; + local->prebuf_blocks += prebuf->ia_blocks; + local->postbuf_blocks += postbuf->ia_blocks; - if (local->prebuf_size < prebuf->st_size) - local->prebuf_size = prebuf->st_size; + if (local->prebuf_size < prebuf->ia_size) + local->prebuf_size = prebuf->ia_size; - if (local->postbuf_size < postbuf->st_size) - local->postbuf_size = postbuf->st_size; + if (local->postbuf_size < postbuf->ia_size) + local->postbuf_size = postbuf->ia_size; } } UNLOCK (&frame->lock); @@ -186,10 +186,10 @@ stripe_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, loc_wipe (&local->loc2); if (local->op_ret != -1) { - local->pre_buf.st_blocks = local->prebuf_blocks; - local->pre_buf.st_size = local->prebuf_size; - local->post_buf.st_blocks = local->postbuf_blocks; - local->post_buf.st_size = local->postbuf_size; + local->pre_buf.ia_blocks = local->prebuf_blocks; + local->pre_buf.ia_size = local->prebuf_size; + local->post_buf.ia_blocks = local->postbuf_blocks; + local->post_buf.ia_size = local->postbuf_size; } STACK_UNWIND (frame, local->op_ret, local->op_errno, &local->pre_buf, &local->post_buf); @@ -205,8 +205,8 @@ stripe_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int32_t stripe_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *preparent, - struct stat *postparent) + int32_t op_ret, int32_t op_errno, struct iatt *preparent, + struct iatt *postparent) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -235,14 +235,14 @@ stripe_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->preparent = *preparent; local->postparent = *postparent; } - local->preparent_blocks += preparent->st_blocks; - local->postparent_blocks += postparent->st_blocks; + local->preparent_blocks += preparent->ia_blocks; + local->postparent_blocks += postparent->ia_blocks; - if (local->preparent_size < preparent->st_size) - local->preparent_size = preparent->st_size; + if (local->preparent_size < preparent->ia_size) + local->preparent_size = preparent->ia_size; - if (local->postparent_size < postparent->st_size) - local->postparent_size = postparent->st_size; + if (local->postparent_size < postparent->ia_size) + local->postparent_size = postparent->ia_size; } } UNLOCK (&frame->lock); @@ -257,10 +257,10 @@ stripe_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, loc_wipe (&local->loc2); if (local->op_ret != -1) { - local->preparent.st_blocks = local->preparent_blocks; - local->preparent.st_size = local->preparent_size; - local->postparent.st_blocks = local->postparent_blocks; - local->postparent.st_size = local->postparent_size; + local->preparent.ia_blocks = local->preparent_blocks; + local->preparent.ia_size = local->preparent_size; + local->postparent.ia_blocks = local->postparent_blocks; + local->postparent.ia_size = local->postparent_size; } STACK_UNWIND (frame, local->op_ret, local->op_errno, &local->preparent, &local->postparent); @@ -270,8 +270,8 @@ stripe_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t stripe_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *prebuf, - struct stat *postbuf) + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -301,14 +301,14 @@ stripe_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->post_buf = *postbuf; } - local->prebuf_blocks += prebuf->st_blocks; - local->postbuf_blocks += postbuf->st_blocks; + local->prebuf_blocks += prebuf->ia_blocks; + local->postbuf_blocks += postbuf->ia_blocks; - if (local->prebuf_size < prebuf->st_size) - local->prebuf_size = prebuf->st_size; + if (local->prebuf_size < prebuf->ia_size) + local->prebuf_size = prebuf->ia_size; - if (local->postbuf_size < postbuf->st_size) - local->postbuf_size = postbuf->st_size; + if (local->postbuf_size < postbuf->ia_size) + local->postbuf_size = postbuf->ia_size; } } UNLOCK (&frame->lock); @@ -323,10 +323,10 @@ stripe_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, loc_wipe (&local->loc2); if (local->op_ret != -1) { - local->pre_buf.st_blocks = local->prebuf_blocks; - local->pre_buf.st_size = local->prebuf_size; - local->post_buf.st_blocks = local->postbuf_blocks; - local->post_buf.st_size = local->postbuf_size; + local->pre_buf.ia_blocks = local->prebuf_blocks; + local->pre_buf.ia_size = local->prebuf_size; + local->post_buf.ia_blocks = local->postbuf_blocks; + local->post_buf.ia_size = local->postbuf_size; } STACK_UNWIND (frame, local->op_ret, local->op_errno, @@ -339,7 +339,7 @@ stripe_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t stripe_common_buf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct iatt *buf) { STACK_UNWIND (frame, op_ret, op_errno, buf); return 0; @@ -347,15 +347,16 @@ stripe_common_buf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, /** * stripe_buf_cbk - This function is used for all the _cbk with - * 'struct stat *buf' as extra argument (other than minimum) + * 'struct iatt *buf' as extra argument (other than minimum) * This is called from functions like, chmod, fchmod, chown, fchown, * truncate, ftruncate, utimens etc. * * @cookie - this argument should be always 'xlator_t *' of child node */ + int32_t stripe_buf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct iatt *buf) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -385,9 +386,9 @@ stripe_buf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->stbuf = *buf; } - local->stbuf_blocks += buf->st_blocks; - if (local->stbuf_size < buf->st_size) - local->stbuf_size = buf->st_size; + local->stbuf_blocks += buf->ia_blocks; + if (local->stbuf_size < buf->ia_size) + local->stbuf_size = buf->ia_size; } } UNLOCK (&frame->lock); @@ -402,8 +403,8 @@ stripe_buf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, loc_wipe (&local->loc2); if (local->op_ret != -1) { - local->stbuf.st_size = local->stbuf_size; - local->stbuf.st_blocks = local->stbuf_blocks; + local->stbuf.ia_size = local->stbuf_size; + local->stbuf.ia_blocks = local->stbuf_blocks; } STACK_UNWIND (frame, local->op_ret, local->op_errno, @@ -417,8 +418,8 @@ stripe_buf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t stripe_common_inode_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, struct stat *preparent, - struct stat *postparent) + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf, preparent, postparent); @@ -437,8 +438,8 @@ int32_t stripe_inode_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, struct stat *preparent, - struct stat *postparent) + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -471,16 +472,16 @@ stripe_inode_cbk (call_frame_t *frame, void *cookie, local->postparent = *postparent; local->preparent = *preparent; } - local->stbuf_blocks += buf->st_blocks; - local->preparent_blocks += preparent->st_blocks; - local->postparent_blocks += postparent->st_blocks; + local->stbuf_blocks += buf->ia_blocks; + local->preparent_blocks += preparent->ia_blocks; + local->postparent_blocks += postparent->ia_blocks; - if (local->stbuf_size < buf->st_size) - local->stbuf_size = buf->st_size; - if (local->preparent_size < preparent->st_size) - local->preparent_size = preparent->st_size; - if (local->postparent_size < postparent->st_size) - local->postparent_size = postparent->st_size; + if (local->stbuf_size < buf->ia_size) + local->stbuf_size = buf->ia_size; + if (local->preparent_size < preparent->ia_size) + local->preparent_size = preparent->ia_size; + if (local->postparent_size < postparent->ia_size) + local->postparent_size = postparent->ia_size; } } UNLOCK (&frame->lock); @@ -492,12 +493,12 @@ stripe_inode_cbk (call_frame_t *frame, void *cookie, local_inode = local->inode; if (local->op_ret != -1) { - local->preparent.st_blocks = local->preparent_blocks; - local->preparent.st_size = local->preparent_size; - local->postparent.st_blocks = local->postparent_blocks; - local->postparent.st_size = local->postparent_size; - local->stbuf.st_size = local->stbuf_size; - local->stbuf.st_blocks = local->stbuf_blocks; + local->preparent.ia_blocks = local->preparent_blocks; + local->preparent.ia_size = local->preparent_size; + local->postparent.ia_blocks = local->postparent_blocks; + local->postparent.ia_size = local->postparent_size; + local->stbuf.ia_size = local->stbuf_size; + local->stbuf.ia_blocks = local->stbuf_blocks; } STACK_UNWIND (frame, local->op_ret, local->op_errno, local->inode, &local->stbuf, @@ -513,7 +514,7 @@ stripe_inode_cbk (call_frame_t *frame, void *cookie, int32_t stripe_sh_chown_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preop, struct stat *postop) + struct iatt *preop, struct iatt *postop) { int callcnt = -1; stripe_local_t *local = NULL; @@ -536,8 +537,8 @@ stripe_sh_chown_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t stripe_sh_make_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, struct stat *preparent, - struct stat *postparent) + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent) { stripe_local_t *local = NULL; call_frame_t *prev = NULL; @@ -561,8 +562,8 @@ stripe_entry_self_heal (call_frame_t *frame, xlator_t *this, stripe_local_t *rlocal = NULL; stripe_private_t *priv = NULL; - if (!(S_ISREG (local->stbuf.st_mode) || - S_ISDIR (local->stbuf.st_mode))) + if (!(IA_ISREG (local->stbuf.ia_type) || + IA_ISDIR (local->stbuf.ia_type))) return 0; priv = this->private; @@ -581,15 +582,18 @@ stripe_entry_self_heal (call_frame_t *frame, xlator_t *this, memcpy (&rlocal->stbuf, &local->stbuf, sizeof (struct stat)); while (trav) { - if (S_ISREG (local->stbuf.st_mode)) { + if (IA_ISREG (local->stbuf.ia_type)) { STACK_WIND (rframe, stripe_sh_make_entry_cbk, trav->xlator, trav->xlator->fops->mknod, - &local->loc, local->stbuf.st_mode, 0); + &local->loc, + st_mode_from_ia (local->stbuf.ia_prot, + local->stbuf.ia_type), 0); } - if (S_ISDIR (local->stbuf.st_mode)) { + if (IA_ISREG (local->stbuf.ia_type)) { STACK_WIND (rframe, stripe_sh_make_entry_cbk, trav->xlator, trav->xlator->fops->mkdir, - &local->loc, local->stbuf.st_mode); + &local->loc, st_mode_from_ia (local->stbuf.ia_prot, + local->stbuf.ia_type)); } trav = trav->next; } @@ -601,7 +605,7 @@ out: int32_t stripe_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, dict_t *dict, struct stat *postparent) + struct iatt *buf, dict_t *dict, struct iatt *postparent) { int32_t callcnt = 0; dict_t *tmp_dict = NULL; @@ -640,13 +644,13 @@ stripe_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->inode = inode_ref (inode); local->dict = dict_ref (dict); } - local->stbuf_blocks += buf->st_blocks; - local->postparent_blocks += postparent->st_blocks; + local->stbuf_blocks += buf->ia_blocks; + local->postparent_blocks += postparent->ia_blocks; - if (local->stbuf_size < buf->st_size) - local->stbuf_size = buf->st_size; - if (local->postparent_size < postparent->st_size) - local->postparent_size = postparent->st_size; + if (local->stbuf_size < buf->ia_size) + local->stbuf_size = buf->ia_size; + if (local->postparent_size < postparent->ia_size) + local->postparent_size = postparent->ia_size; } } UNLOCK (&frame->lock); @@ -662,10 +666,10 @@ stripe_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, tmp_inode = local->inode; if (local->op_ret != -1) { - local->stbuf.st_blocks = local->stbuf_blocks; - local->stbuf.st_size = local->stbuf_size; - local->postparent.st_blocks = local->postparent_blocks; - local->postparent.st_size = local->postparent_size; + local->stbuf.ia_blocks = local->stbuf_blocks; + local->stbuf.ia_size = local->stbuf_size; + local->postparent.ia_blocks = local->postparent_blocks; + local->postparent.ia_size = local->postparent_size; } loc_wipe (&local->loc); @@ -914,7 +918,7 @@ stripe_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) int32_t stripe_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preop, struct stat *postop) + struct iatt *preop, struct iatt *postop) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -945,13 +949,13 @@ stripe_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->post_buf = *postop; } - local->prebuf_blocks += preop->st_blocks; - local->postbuf_blocks += postop->st_blocks; + local->prebuf_blocks += preop->ia_blocks; + local->postbuf_blocks += postop->ia_blocks; - if (local->prebuf_size < preop->st_size) - local->prebuf_size = preop->st_size; - if (local->postbuf_size < postop->st_size) - local->postbuf_size = postop->st_size; + if (local->prebuf_size < preop->ia_size) + local->prebuf_size = preop->ia_size; + if (local->postbuf_size < postop->ia_size) + local->postbuf_size = postop->ia_size; } } UNLOCK (&frame->lock); @@ -966,10 +970,10 @@ stripe_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, loc_wipe (&local->loc2); if (local->op_ret != -1) { - local->pre_buf.st_blocks = local->prebuf_blocks; - local->pre_buf.st_size = local->prebuf_size; - local->post_buf.st_blocks = local->postbuf_blocks; - local->post_buf.st_size = local->postbuf_size; + local->pre_buf.ia_blocks = local->prebuf_blocks; + local->pre_buf.ia_size = local->prebuf_size; + local->post_buf.ia_blocks = local->postbuf_blocks; + local->post_buf.ia_size = local->postbuf_size; } STACK_UNWIND (frame, local->op_ret, local->op_errno, @@ -982,7 +986,7 @@ stripe_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t stripe_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { xlator_list_t *trav = NULL; stripe_local_t *local = NULL; @@ -1029,7 +1033,7 @@ stripe_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t stripe_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { stripe_local_t *local = NULL; stripe_private_t *priv = NULL; @@ -1068,9 +1072,9 @@ stripe_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t stripe_stack_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf, - struct stat *preoldparent, struct stat *postoldparent, - struct stat *prenewparent, struct stat *postnewparent) + int32_t op_ret, int32_t op_errno, struct iatt *buf, + struct iatt *preoldparent, struct iatt *postoldparent, + struct iatt *prenewparent, struct iatt *postnewparent) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -1096,26 +1100,26 @@ stripe_stack_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == 0) { local->op_ret = 0; - local->stbuf.st_blocks += buf->st_blocks; - local->preparent.st_blocks += preoldparent->st_blocks; - local->postparent.st_blocks += postoldparent->st_blocks; - local->pre_buf.st_blocks += prenewparent->st_blocks; - local->post_buf.st_blocks += postnewparent->st_blocks; + local->stbuf.ia_blocks += buf->ia_blocks; + local->preparent.ia_blocks += preoldparent->ia_blocks; + local->postparent.ia_blocks += postoldparent->ia_blocks; + local->pre_buf.ia_blocks += prenewparent->ia_blocks; + local->post_buf.ia_blocks += postnewparent->ia_blocks; - if (local->stbuf.st_size < buf->st_size) - local->stbuf.st_size = buf->st_size; + if (local->stbuf.ia_size < buf->ia_size) + local->stbuf.ia_size = buf->ia_size; - if (local->preparent.st_size < preoldparent->st_size) - local->preparent.st_size = preoldparent->st_size; + if (local->preparent.ia_size < preoldparent->ia_size) + local->preparent.ia_size = preoldparent->ia_size; - if (local->postparent.st_size < postoldparent->st_size) - local->postparent.st_size = postoldparent->st_size; + if (local->postparent.ia_size < postoldparent->ia_size) + local->postparent.ia_size = postoldparent->ia_size; - if (local->pre_buf.st_size < prenewparent->st_size) - local->pre_buf.st_size = prenewparent->st_size; + if (local->pre_buf.ia_size < prenewparent->ia_size) + local->pre_buf.ia_size = prenewparent->ia_size; - if (local->post_buf.st_size < postnewparent->st_size) - local->post_buf.st_size = postnewparent->st_size; + if (local->post_buf.ia_size < postnewparent->ia_size) + local->post_buf.ia_size = postnewparent->ia_size; } } UNLOCK (&frame->lock); @@ -1140,9 +1144,9 @@ stripe_stack_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t stripe_first_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf, - struct stat *preoldparent, struct stat *postoldparent, - struct stat *prenewparent, struct stat *postnewparent) + int32_t op_ret, int32_t op_errno, struct iatt *buf, + struct iatt *preoldparent, struct iatt *postoldparent, + struct iatt *prenewparent, struct iatt *postnewparent) { stripe_local_t *local = NULL; xlator_list_t *trav = NULL; @@ -1291,8 +1295,8 @@ stripe_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) int32_t stripe_first_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno,struct stat *preparent, - struct stat *postparent) + int32_t op_ret, int32_t op_errno,struct iatt *preparent, + struct iatt *postparent) { xlator_list_t *trav = NULL; @@ -1311,10 +1315,10 @@ stripe_first_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->preparent = *preparent; local->postparent = *postparent; - local->preparent_blocks += preparent->st_blocks; - local->postparent_blocks += postparent->st_blocks; - local->preparent_size = preparent->st_size; - local->postparent_size = postparent->st_size; + local->preparent_blocks += preparent->ia_blocks; + local->postparent_blocks += postparent->ia_blocks; + local->preparent_size = preparent->ia_size; + local->postparent_size = postparent->ia_size; while (trav) { STACK_WIND (frame, stripe_unlink_cbk, trav->xlator, @@ -1375,8 +1379,8 @@ stripe_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc) int32_t stripe_mknod_ifreg_fail_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno, struct stat *preparent, - struct stat *postparent) + int32_t op_errno, struct iatt *preparent, + struct iatt *postparent) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -1458,8 +1462,8 @@ stripe_mknod_ifreg_setxattr_cbk (call_frame_t *frame, void *cookie, int32_t stripe_mknod_ifreg_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, struct stat *preparent, - struct stat *postparent) + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent) { int ret = 0; int32_t callcnt = 0; @@ -1495,16 +1499,16 @@ stripe_mknod_ifreg_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->postparent = *postparent; } - local->stbuf_blocks += buf->st_blocks; - local->preparent_blocks += preparent->st_blocks; - local->postparent_blocks += postparent->st_blocks; + local->stbuf_blocks += buf->ia_blocks; + local->preparent_blocks += preparent->ia_blocks; + local->postparent_blocks += postparent->ia_blocks; - if (local->stbuf_size < buf->st_size) - local->stbuf_size = buf->st_size; - if (local->preparent_size < preparent->st_size) - local->preparent_size = preparent->st_size; - if (local->postparent_size < postparent->st_size) - local->postparent_size = postparent->st_size; + if (local->stbuf_size < buf->ia_size) + local->stbuf_size = buf->ia_size; + if (local->preparent_size < preparent->ia_size) + local->preparent_size = preparent->ia_size; + if (local->postparent_size < postparent->ia_size) + local->postparent_size = postparent->ia_size; } } UNLOCK (&frame->lock); @@ -1514,12 +1518,12 @@ stripe_mknod_ifreg_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_ret = -1; if (local->op_ret != -1) { - local->preparent.st_blocks = local->preparent_blocks; - local->preparent.st_size = local->preparent_size; - local->postparent.st_blocks = local->postparent_blocks; - local->postparent.st_size = local->postparent_size; - local->stbuf.st_size = local->stbuf_size; - local->stbuf.st_blocks = local->stbuf_blocks; + local->preparent.ia_blocks = local->preparent_blocks; + local->preparent.ia_size = local->preparent_size; + local->postparent.ia_blocks = local->postparent_blocks; + local->postparent.ia_size = local->postparent_size; + local->stbuf.ia_size = local->stbuf_size; + local->stbuf.ia_blocks = local->stbuf_blocks; } if ((local->op_ret != -1) && priv->xattr_supported) { @@ -1758,8 +1762,8 @@ stripe_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc) int32_t stripe_create_fail_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno, struct stat *preparent, - struct stat *postparent) + int32_t op_errno, struct iatt *preparent, + struct iatt *postparent) { int32_t callcnt = 0; fd_t *lfd = NULL; @@ -1864,8 +1868,8 @@ stripe_create_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t stripe_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, - inode_t *inode, struct stat *buf, struct stat *preparent, - struct stat *postparent) + inode_t *inode, struct iatt *buf, struct iatt *preparent, + struct iatt *postparent) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -1903,16 +1907,16 @@ stripe_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->postparent = *postparent; } - local->stbuf_blocks += buf->st_blocks; - local->preparent_blocks += preparent->st_blocks; - local->postparent_blocks += postparent->st_blocks; + local->stbuf_blocks += buf->ia_blocks; + local->preparent_blocks += preparent->ia_blocks; + local->postparent_blocks += postparent->ia_blocks; - if (local->stbuf_size < buf->st_size) - local->stbuf_size = buf->st_size; - if (local->preparent_size < preparent->st_size) - local->preparent_size = preparent->st_size; - if (local->postparent_size < postparent->st_size) - local->postparent_size = postparent->st_size; + if (local->stbuf_size < buf->ia_size) + local->stbuf_size = buf->ia_size; + if (local->preparent_size < preparent->ia_size) + local->preparent_size = preparent->ia_size; + if (local->postparent_size < postparent->ia_size) + local->postparent_size = postparent->ia_size; } } UNLOCK (&frame->lock); @@ -1922,12 +1926,12 @@ stripe_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_ret = -1; if (local->op_ret != -1) { - local->preparent.st_blocks = local->preparent_blocks; - local->preparent.st_size = local->preparent_size; - local->postparent.st_blocks = local->postparent_blocks; - local->postparent.st_size = local->postparent_size; - local->stbuf.st_size = local->stbuf_size; - local->stbuf.st_blocks = local->stbuf_blocks; + local->preparent.ia_blocks = local->preparent_blocks; + local->preparent.ia_size = local->preparent_size; + local->postparent.ia_blocks = local->postparent_blocks; + local->postparent.ia_size = local->postparent_size; + local->stbuf.ia_size = local->stbuf_size; + local->stbuf.ia_blocks = local->stbuf_blocks; } /* */ @@ -2822,7 +2826,7 @@ int32_t stripe_single_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iovec *vector, int32_t count, - struct stat *stbuf, struct iobref *iobref) + struct iatt *stbuf, struct iobref *iobref) { STACK_UNWIND (frame, op_ret, op_errno, vector, count, stbuf, iobref); return 0; @@ -2835,7 +2839,7 @@ stripe_single_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t stripe_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iovec *vector, - int32_t count, struct stat *stbuf, struct iobref *iobref) + int32_t count, struct iatt *stbuf, struct iobref *iobref) { int32_t index = 0; int32_t callcnt = 0; @@ -2876,7 +2880,7 @@ stripe_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (callcnt == main_local->wind_count) { int32_t final_count = 0; struct iovec *final_vec = NULL; - struct stat tmp_stbuf = {0,}; + struct iatt tmp_stbuf = {0,}; struct iobref *iobref = NULL; op_ret = 0; @@ -2895,10 +2899,10 @@ stripe_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } /* ANSWER-ME: Do we need to send anything more in stbuf? */ - if (tmp_stbuf.st_size < - main_local->replies[index].stbuf.st_size) { - tmp_stbuf.st_size = - main_local->replies[index].stbuf.st_size; + if (tmp_stbuf.ia_size < + main_local->replies[index].stbuf.ia_size) { + tmp_stbuf.ia_size = + main_local->replies[index].stbuf.ia_size; } /* TODO: Should I handle a case where there is a hole @@ -3086,8 +3090,8 @@ stripe_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, */ int32_t stripe_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *prebuf, - struct stat *postbuf) + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -3128,7 +3132,7 @@ stripe_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int32_t stripe_single_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct iatt *stbuf) { STACK_UNWIND (frame, op_ret, op_errno, stbuf); return 0; diff --git a/xlators/cluster/stripe/src/stripe.h b/xlators/cluster/stripe/src/stripe.h index 614fb7a08..85a50f817 100644 --- a/xlators/cluster/stripe/src/stripe.h +++ b/xlators/cluster/stripe/src/stripe.h @@ -69,7 +69,7 @@ struct readv_replies { int32_t count; //count of vector int32_t op_ret; //op_ret of readv int32_t op_errno; - struct stat stbuf; /* 'stbuf' is also a part of reply */ + struct iatt stbuf; /* 'stbuf' is also a part of reply */ }; typedef struct _stripe_fd_ctx { @@ -92,11 +92,11 @@ struct stripe_local { stripe_fd_ctx_t *fctx; /* Used by _cbk functions */ - struct stat stbuf; - struct stat pre_buf; - struct stat post_buf; - struct stat preparent; - struct stat postparent; + struct iatt stbuf; + struct iatt pre_buf; + struct iatt post_buf; + struct iatt preparent; + struct iatt postparent; off_t stbuf_size; off_t prebuf_size; diff --git a/xlators/cluster/unify/src/unify-self-heal.c b/xlators/cluster/unify/src/unify-self-heal.c index 3e4affe8c..86f9e88fa 100644 --- a/xlators/cluster/unify/src/unify-self-heal.c +++ b/xlators/cluster/unify/src/unify-self-heal.c @@ -145,7 +145,7 @@ unify_sh_setdents_cbk (call_frame_t *frame, while (trav) { prev->next = trav->next; FREE (trav->name); - if (S_ISLNK (trav->buf.st_mode)) + if (IA_ISLNK (trav->buf.ia_type)) FREE (trav->link); FREE (trav); trav = prev->next; @@ -260,7 +260,7 @@ unify_sh_ns_setdents_cbk (call_frame_t *frame, while (trav) { prev->next = trav->next; FREE (trav->name); - if (S_ISLNK (trav->buf.st_mode)) + if (IA_ISLNK (trav->buf.ia_type)) FREE (trav->link); FREE (trav); trav = prev->next; @@ -669,7 +669,7 @@ unify_bgsh_setdents_cbk (call_frame_t *frame, while (trav) { prev->next = trav->next; FREE (trav->name); - if (S_ISLNK (trav->buf.st_mode)) + if (IA_ISLNK (trav->buf.ia_type)) FREE (trav->link); FREE (trav); trav = prev->next; @@ -776,7 +776,7 @@ unify_bgsh_ns_setdents_cbk (call_frame_t *frame, while (trav) { prev->next = trav->next; FREE (trav->name); - if (S_ISLNK (trav->buf.st_mode)) + if (IA_ISLNK (trav->buf.ia_type)) FREE (trav->link); FREE (trav); trav = prev->next; diff --git a/xlators/cluster/unify/src/unify.c b/xlators/cluster/unify/src/unify.c index 6ce31da9d..2eadfe31c 100644 --- a/xlators/cluster/unify/src/unify.c +++ b/xlators/cluster/unify/src/unify.c @@ -27,7 +27,7 @@ * NOTE: * Now, unify has support for global namespace, which is used to keep a * global view of fs's namespace tree. The stat for directories are taken - * just from the namespace, where as for files, just 'st_ino' is taken from + * just from the namespace, where as for files, just 'ia_ino' is taken from * Namespace node, and other stat info is taken from the actual storage node. * Also Namespace node helps to keep consistant inode for files across * glusterfs (re-)mounts. @@ -129,7 +129,7 @@ unify_loc_subvol (loc_t *loc, xlator_t *this) priv = this->private; subvol = NS (this); - if (!S_ISDIR (loc->inode->st_mode)) { + if (!IA_ISDIR (loc->inode->ia_type)) { ret = inode_ctx_get (loc->inode, this, &tmp_list); list = (int16_t *)(long)tmp_list; if (!list) @@ -253,7 +253,7 @@ unify_buf_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct iatt *buf) { int32_t callcnt = 0; unify_private_t *priv = this->private; @@ -281,16 +281,16 @@ unify_buf_cbk (call_frame_t *frame, local->op_ret = 0; if (NS (this) == prev_frame->this) { - local->st_ino = buf->st_ino; + local->ia_ino = buf->ia_ino; /* If the entry is directory, get the stat from NS node */ - if (S_ISDIR (buf->st_mode) || - !local->stbuf.st_blksize) { + if (IA_ISDIR (buf->ia_type) || + !local->stbuf.ia_blksize) { local->stbuf = *buf; } } - if ((!S_ISDIR (buf->st_mode)) && + if ((!IA_ISDIR (buf->ia_type)) && (NS (this) != prev_frame->this)) { /* If file, take the stat info from Storage node. */ @@ -303,10 +303,10 @@ unify_buf_cbk (call_frame_t *frame, if (!callcnt) { /* If the inode number is not filled, operation should fail */ - if (!local->st_ino) + if (!local->ia_ino) local->op_ret = -1; - local->stbuf.st_ino = local->st_ino; + local->stbuf.ia_ino = local->ia_ino; unify_local_wipe (local); STACK_UNWIND (frame, local->op_ret, local->op_errno, &local->stbuf); @@ -315,7 +315,8 @@ unify_buf_cbk (call_frame_t *frame, return 0; } -#define check_if_dht_linkfile(s) ((s->st_mode & ~S_IFMT) == S_ISVTX) +#define check_if_dht_linkfile(s) \ + ((st_mode_from_ia (s->ia_prot, s->ia_type) & ~S_IFMT) == S_ISVTX) /** * unify_lookup_cbk - @@ -327,9 +328,9 @@ unify_lookup_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, + struct iatt *buf, dict_t *dict, - struct stat *postparent) + struct iatt *postparent) { int32_t callcnt = 0; unify_private_t *priv = this->private; @@ -390,11 +391,11 @@ unify_lookup_cbk (call_frame_t *frame, priv->xl_array[(long)cookie]->name); } - if (local->stbuf.st_mode && local->stbuf.st_blksize) { + if (local->stbuf.ia_type && local->stbuf.ia_blksize) { /* make sure we already have a stbuf stored in local->stbuf */ - if (S_ISDIR (local->stbuf.st_mode) && - !S_ISDIR (buf->st_mode)) { + if (IA_ISDIR (local->stbuf.ia_type) && + !IA_ISDIR (buf->ia_type)) { gf_log (this->name, GF_LOG_CRITICAL, "[CRITICAL] '%s' is directory " "on namespace, non-directory " @@ -403,8 +404,8 @@ unify_lookup_cbk (call_frame_t *frame, priv->xl_array[(long)cookie]->name); local->return_eio = 1; } - if (!S_ISDIR (local->stbuf.st_mode) && - S_ISDIR (buf->st_mode)) { + if (!IA_ISDIR (local->stbuf.ia_type) && + IA_ISDIR (buf->ia_type)) { gf_log (this->name, GF_LOG_CRITICAL, "[CRITICAL] '%s' is directory " "on node '%s', non-directory " @@ -415,7 +416,7 @@ unify_lookup_cbk (call_frame_t *frame, } } - if (!local->revalidate && !S_ISDIR (buf->st_mode)) { + if (!local->revalidate && !IA_ISDIR (buf->ia_type)) { /* This is the first time lookup on file*/ if (!local->list) { /* list is not allocated, allocate @@ -436,7 +437,7 @@ unify_lookup_cbk (call_frame_t *frame, (int16_t)(long)cookie; } - if (!local->revalidate && S_ISDIR (buf->st_mode)) { + if (!local->revalidate && IA_ISDIR (buf->ia_type)) { /* fresh lookup of a directory */ inode_ctx_put (local->loc1.inode, this, priv->inode_generation); @@ -450,20 +451,20 @@ unify_lookup_cbk (call_frame_t *frame, /* index of NS node is == total child count */ if (priv->child_count == (int16_t)(long)cookie) { /* Take the inode number from namespace */ - local->st_ino = buf->st_ino; - if (S_ISDIR (buf->st_mode) || - !(local->stbuf.st_blksize)) { + local->ia_ino = buf->ia_ino; + if (IA_ISDIR (buf->ia_type) || + !(local->stbuf.ia_blksize)) { local->stbuf = *buf; local->oldpostparent = *postparent; } - } else if (!S_ISDIR (buf->st_mode)) { + } else if (!IA_ISDIR (buf->ia_type)) { /* If file, then get the stat from storage node */ local->stbuf = *buf; } - if (local->st_nlink < buf->st_nlink) { - local->st_nlink = buf->st_nlink; + if (local->ia_nlink < buf->ia_nlink) { + local->ia_nlink = buf->ia_nlink; } } } @@ -484,12 +485,12 @@ unify_lookup_cbk (call_frame_t *frame, return 0; } - if (!local->stbuf.st_blksize) { + if (!local->stbuf.ia_blksize) { /* Inode not present */ local->op_ret = -1; } else { if (!local->revalidate && - !S_ISDIR (local->stbuf.st_mode)) { + !IA_ISDIR (local->stbuf.ia_type)) { /* If its a file, big array is useless, allocate the smaller one */ int16_t *list = NULL; @@ -506,7 +507,7 @@ unify_lookup_cbk (call_frame_t *frame, (uint64_t)(long)local->list); } - if (S_ISDIR(local->loc1.inode->st_mode)) { + if (IA_ISDIR(local->loc1.inode->ia_type)) { /* lookup is done for directory */ if (local->failed && priv->self_heal) { /* Triggering self-heal */ @@ -516,10 +517,10 @@ unify_lookup_cbk (call_frame_t *frame, priv->inode_generation++; } } else { - local->stbuf.st_ino = local->st_ino; + local->stbuf.ia_ino = local->ia_ino; } - local->stbuf.st_nlink = local->st_nlink; + local->stbuf.ia_nlink = local->ia_nlink; } if (local->op_ret == -1) { if (!local->revalidate && local->list) @@ -540,7 +541,7 @@ unify_lookup_cbk (call_frame_t *frame, if ((priv->self_heal && !priv->optimist) && (!local->revalidate && (local->op_ret == 0) && - S_ISDIR(local->stbuf.st_mode))) { + IA_ISDIR(local->stbuf.ia_type))) { /* Let the self heal be done here */ zr_unify_self_heal (frame, this, local); local_dict = NULL; @@ -598,13 +599,13 @@ unify_lookup (call_frame_t *frame, } if (inode_ctx_get (loc->inode, this, NULL) - && S_ISDIR (loc->inode->st_mode)) { + && IA_ISDIR (loc->inode->ia_type)) { local->revalidate = 1; } if (!inode_ctx_get (loc->inode, this, NULL) && - loc->inode->st_mode && - !S_ISDIR (loc->inode->st_mode)) { + loc->inode->ia_type && + !IA_ISDIR (loc->inode->ia_type)) { uint64_t tmp_list = 0; /* check if revalidate or fresh lookup */ inode_ctx_get (loc->inode, this, &tmp_list); @@ -665,7 +666,7 @@ unify_lookup (call_frame_t *frame, break; } } else { - if (loc->inode->st_mode) { + if (loc->inode->ia_type) { if (inode_ctx_get (loc->inode, this, NULL)) { inode_ctx_get (loc->inode, this, &local->inode_generation); @@ -718,8 +719,8 @@ unify_stat (call_frame_t *frame, STACK_UNWIND (frame, -1, ENOMEM, NULL); return 0; } - local->st_ino = loc->inode->ino; - if (S_ISDIR (loc->inode->st_mode)) { + local->ia_ino = loc->inode->ino; + if (IA_ISDIR (loc->inode->ia_type)) { /* Directory */ local->call_count = 1; STACK_WIND (frame, unify_buf_cbk, NS(this), @@ -791,9 +792,9 @@ unify_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { int32_t callcnt = 0; unify_private_t *priv = this->private; @@ -855,9 +856,9 @@ unify_ns_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { unify_private_t *priv = this->private; unify_local_t *local = frame->local; @@ -941,8 +942,8 @@ unify_rmdir_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preparent, - struct stat *postparent) + struct iatt *preparent, + struct iatt *postparent) { int32_t callcnt = 0; unify_private_t *priv = this->private; @@ -976,8 +977,8 @@ unify_ns_rmdir_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preparent, - struct stat *postparent) + struct iatt *preparent, + struct iatt *postparent) { int16_t index = 0; unify_private_t *priv = this->private; @@ -1113,7 +1114,7 @@ unify_open_lookup_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, + struct iatt *buf, dict_t *dict) { int32_t callcnt = 0; @@ -1140,7 +1141,7 @@ unify_open_lookup_cbk (call_frame_t *frame, } else { local->list[1] = (int16_t)(long)cookie; } - if (S_ISDIR (buf->st_mode)) + if (IA_ISDIR (buf->ia_type)) local->failed = 1; } } @@ -1306,7 +1307,7 @@ unify_open (call_frame_t *frame, #ifdef GF_DARWIN_HOST_OS /* Handle symlink here */ - if (S_ISLNK (loc->inode->st_mode)) { + if (IA_ISLNK (loc->inode->ia_type)) { /* Callcount doesn't matter here */ STACK_WIND (frame, unify_open_readlink_cbk, @@ -1342,8 +1343,8 @@ unify_create_unlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preparent, - struct stat *postparent) + struct iatt *preparent, + struct iatt *postparent) { unify_local_t *local = frame->local; inode_t *inode = local->loc1.inode; @@ -1457,9 +1458,9 @@ unify_create_lookup_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, + struct iatt *buf, dict_t *dict, - struct stat *postparent) + struct iatt *postparent) { int32_t callcnt = 0; int16_t index = 0; @@ -1482,7 +1483,7 @@ unify_create_lookup_cbk (call_frame_t *frame, local->op_ret = op_ret; local->list[local->index++] = (int16_t)(long)cookie; if (NS(this) == priv->xl_array[(long)cookie]) { - local->st_ino = buf->st_ino; + local->ia_ino = buf->ia_ino; } else { local->stbuf = *buf; } @@ -1500,7 +1501,7 @@ unify_create_lookup_cbk (call_frame_t *frame, file_list[1] = list[1]; file_list[2] = -1; - local->stbuf.st_ino = local->st_ino; + local->stbuf.ia_ino = local->ia_ino; /* TODO: log on failure */ inode_ctx_put (local->loc1.inode, this, (uint64_t)(long)local->list); @@ -1563,9 +1564,9 @@ unify_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { int ret = 0; unify_local_t *local = frame->local; @@ -1596,7 +1597,7 @@ unify_create_cbk (call_frame_t *frame, local->op_ret = op_ret; local->stbuf = *buf; /* Just inode number should be from NS node */ - local->stbuf.st_ino = local->st_ino; + local->stbuf.ia_ino = local->ia_ino; /* TODO: log on failure */ ret = fd_ctx_set (fd, this, (uint64_t)(long)prev_frame->this); @@ -1623,9 +1624,9 @@ unify_ns_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { struct sched_ops *sched_ops = NULL; xlator_t *sched_xl = NULL; @@ -1654,7 +1655,7 @@ unify_ns_create_cbk (call_frame_t *frame, if (op_ret >= 0) { /* Get the inode number from the NS node */ - local->st_ino = buf->st_ino; + local->ia_ino = buf->ia_ino; local->oldpreparent = *preparent; local->oldpostparent = *postparent; @@ -1803,8 +1804,8 @@ unify_opendir (call_frame_t *frame, int32_t unify_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *statpre, - struct stat *statpost) + int32_t op_ret, int32_t op_errno, struct iatt *statpre, + struct iatt *statpost) { int32_t callcnt = 0; unify_private_t *priv = this->private; @@ -1832,17 +1833,17 @@ unify_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_ret = 0; if (NS (this) == prev_frame->this) { - local->st_ino = statpost->st_ino; + local->ia_ino = statpost->ia_ino; /* If the entry is directory, get the stat from NS node */ - if (S_ISDIR (statpost->st_mode) || - !local->stpost.st_blksize) { + if (IA_ISDIR (statpost->ia_type) || + !local->stpost.ia_blksize) { local->stpre = *statpre; local->stpost = *statpost; } } - if ((!S_ISDIR (statpost->st_mode)) && + if ((!IA_ISDIR (statpost->ia_type)) && (NS (this) != prev_frame->this)) { /* If file, take the stat info from Storage node. */ @@ -1856,11 +1857,11 @@ unify_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (!callcnt) { /* If the inode number is not filled, operation should fail */ - if (!local->st_ino) + if (!local->ia_ino) local->op_ret = -1; - local->stpre.st_ino = local->st_ino; - local->stpost.st_ino = local->st_ino; + local->stpre.ia_ino = local->ia_ino; + local->stpost.ia_ino = local->ia_ino; unify_local_wipe (local); STACK_UNWIND (frame, local->op_ret, local->op_errno, &local->stpre, &local->stpost); @@ -1872,7 +1873,7 @@ unify_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t unify_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { unify_local_t *local = NULL; unify_private_t *priv = this->private; @@ -1889,7 +1890,7 @@ unify_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, INIT_LOCAL (frame, local); loc_copy (&local->loc1, loc); - if (S_ISDIR (loc->inode->st_mode)) { + if (IA_ISDIR (loc->inode->ia_type)) { local->call_count = 1; STACK_WIND (frame, @@ -1924,7 +1925,7 @@ unify_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t unify_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { unify_local_t *local = NULL; xlator_t *child = NULL; @@ -1967,8 +1968,8 @@ unify_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *prebuf, - struct stat *postbuf) + struct iatt *prebuf, + struct iatt *postbuf) { int32_t callcnt = 0; unify_private_t *priv = this->private; @@ -1992,17 +1993,17 @@ unify_truncate_cbk (call_frame_t *frame, if (op_ret >= 0) { if (NS (this) == prev_frame->this) { - local->st_ino = postbuf->st_ino; + local->ia_ino = postbuf->ia_ino; /* If the entry is directory, get the stat from NS node */ - if (S_ISDIR (postbuf->st_mode) || - !local->stbuf.st_blksize) { + if (IA_ISDIR (postbuf->ia_type) || + !local->stbuf.ia_blksize) { local->stbuf = *prebuf; local->poststbuf = *postbuf; } } - if ((!S_ISDIR (postbuf->st_mode)) && + if ((!IA_ISDIR (postbuf->ia_type)) && (NS (this) != prev_frame->this)) { /* If file, take the stat info from Storage node. */ @@ -2014,9 +2015,9 @@ unify_truncate_cbk (call_frame_t *frame, UNLOCK (&frame->lock); if (!callcnt) { - if (local->st_ino) { - local->stbuf.st_ino = local->st_ino; - local->poststbuf.st_ino = local->st_ino; + if (local->ia_ino) { + local->stbuf.ia_ino = local->ia_ino; + local->poststbuf.ia_ino = local->ia_ino; } else { local->op_ret = -1; } @@ -2049,9 +2050,9 @@ unify_truncate (call_frame_t *frame, /* Initialization */ INIT_LOCAL (frame, local); loc_copy (&local->loc1, loc); - local->st_ino = loc->inode->ino; + local->ia_ino = loc->inode->ino; - if (S_ISDIR (loc->inode->st_mode)) { + if (IA_ISDIR (loc->inode->ia_type)) { local->call_count = 1; STACK_WIND (frame, @@ -2102,7 +2103,7 @@ unify_readlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, const char *path, - struct stat *sbuf) + struct iatt *sbuf) { STACK_UNWIND (frame, op_ret, op_errno, path, sbuf); return 0; @@ -2163,8 +2164,8 @@ unify_unlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preparent, - struct stat *postparent) + struct iatt *preparent, + struct iatt *postparent) { int32_t callcnt = 0; unify_private_t *priv = this->private; @@ -2253,7 +2254,7 @@ unify_readv_cbk (call_frame_t *frame, int32_t op_errno, struct iovec *vector, int32_t count, - struct stat *stbuf, + struct iatt *stbuf, struct iobref *iobref) { STACK_UNWIND (frame, op_ret, op_errno, vector, count, stbuf, iobref); @@ -2298,18 +2299,18 @@ unify_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *prebuf, - struct stat *postbuf) + struct iatt *prebuf, + struct iatt *postbuf) { unify_local_t *local = NULL; local = frame->local; local->stbuf = *prebuf; - local->stbuf.st_ino = local->st_ino; + local->stbuf.ia_ino = local->ia_ino; local->poststbuf = *postbuf; - local->poststbuf.st_ino = local->st_ino; + local->poststbuf.ia_ino = local->ia_ino; STACK_UNWIND (frame, op_ret, op_errno, &local->stbuf, &local->poststbuf); @@ -2334,7 +2335,7 @@ unify_writev (call_frame_t *frame, unify_local_t *local = NULL; INIT_LOCAL (frame, local); - local->st_ino = fd->inode->ino; + local->ia_ino = fd->inode->ino; fd_ctx_get (fd, this, &tmp_child); child = (xlator_t *)(long)tmp_child; @@ -2433,8 +2434,8 @@ unify_fsync_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *prebuf, - struct stat *postbuf) + struct iatt *prebuf, + struct iatt *postbuf) { STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -2478,7 +2479,7 @@ unify_fstat (call_frame_t *frame, UNIFY_CHECK_FD_AND_UNWIND_ON_ERR(fd); INIT_LOCAL (frame, local); - local->st_ino = fd->inode->ino; + local->ia_ino = fd->inode->ino; if (!fd_ctx_get (fd, this, &tmp_child)) { /* If its set, then its file */ @@ -2819,7 +2820,7 @@ unify_setxattr (call_frame_t *frame, local->failed = -1; loc_copy (&local->loc1, loc); - if (S_ISDIR (loc->inode->st_mode)) { + if (IA_ISDIR (loc->inode->ia_type)) { if (trav && trav->key && ZR_FILE_CONTENT_REQUEST(trav->key)) { /* direct the storage xlators to change file @@ -2951,7 +2952,7 @@ unify_getxattr (call_frame_t *frame, UNIFY_CHECK_INODE_CTX_AND_UNWIND_ON_ERR (loc); INIT_LOCAL (frame, local); - if (S_ISDIR (loc->inode->st_mode)) { + if (IA_ISDIR (loc->inode->ia_type)) { local->call_count = priv->child_count; for (index = 0; index < priv->child_count; index++) STACK_WIND (frame, @@ -3057,7 +3058,7 @@ unify_removexattr (call_frame_t *frame, /* Initialization */ INIT_LOCAL (frame, local); - if (S_ISDIR (loc->inode->st_mode)) { + if (IA_ISDIR (loc->inode->ia_type)) { local->call_count = priv->child_count; for (index = 0; index < priv->child_count; index++) STACK_WIND (frame, @@ -3110,8 +3111,8 @@ unify_mknod_unlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preparent, - struct stat *postparent) + struct iatt *preparent, + struct iatt *postparent) { unify_local_t *local = frame->local; @@ -3135,9 +3136,9 @@ unify_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { unify_local_t *local = frame->local; @@ -3155,7 +3156,7 @@ unify_mknod_cbk (call_frame_t *frame, } local->stbuf = *buf; - local->stbuf.st_ino = local->st_ino; + local->stbuf.ia_ino = local->ia_ino; unify_local_wipe (local); STACK_UNWIND (frame, op_ret, op_errno, inode, &local->stbuf, &local->oldpreparent, &local->oldpostparent); @@ -3172,9 +3173,9 @@ unify_ns_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { struct sched_ops *sched_ops = NULL; xlator_t *sched_xl = NULL; @@ -3201,7 +3202,7 @@ unify_ns_mknod_cbk (call_frame_t *frame, /* Create one inode for this entry */ local->op_ret = 0; local->stbuf = *buf; - local->st_ino = buf->st_ino; + local->ia_ino = buf->ia_ino; local->oldpreparent = *preparent; local->oldpostparent = *postparent; @@ -3283,8 +3284,8 @@ unify_symlink_unlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preparent, - struct stat *postparent) + struct iatt *preparent, + struct iatt *postparent) { unify_local_t *local = frame->local; if (op_ret == -1) @@ -3306,9 +3307,9 @@ unify_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { unify_local_t *local = frame->local; @@ -3330,7 +3331,7 @@ unify_symlink_cbk (call_frame_t *frame, } local->stbuf = *buf; - local->stbuf.st_ino = local->st_ino; + local->stbuf.ia_ino = local->ia_ino; unify_local_wipe (local); STACK_UNWIND (frame, op_ret, op_errno, inode, &local->stbuf, &local->oldpreparent, &local->oldpostparent); @@ -3348,9 +3349,9 @@ unify_ns_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { struct sched_ops *sched_ops = NULL; @@ -3375,7 +3376,7 @@ unify_ns_symlink_cbk (call_frame_t *frame, /* Create one inode for this entry */ local->op_ret = 0; - local->st_ino = buf->st_ino; + local->ia_ino = buf->ia_ino; local->oldpreparent = *preparent; local->oldpostparent = *postparent; @@ -3464,8 +3465,8 @@ unify_rename_unlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preparent, - struct stat *postparent) + struct iatt *preparent, + struct iatt *postparent) { int32_t callcnt = 0; unify_local_t *local = frame->local; @@ -3486,7 +3487,7 @@ unify_rename_unlink_cbk (call_frame_t *frame, UNLOCK (&frame->lock); if (!callcnt) { - local->stbuf.st_ino = local->st_ino; + local->stbuf.ia_ino = local->ia_ino; unify_local_wipe (local); STACK_UNWIND (frame, local->op_ret, local->op_errno, &local->stbuf); @@ -3500,11 +3501,11 @@ unify_ns_rename_undo_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf, - struct stat *preoldparent, - struct stat *postoldparent, - struct stat *prenewparent, - struct stat *postnewparent) + struct iatt *buf, + struct iatt *preoldparent, + struct iatt *postoldparent, + struct iatt *prenewparent, + struct iatt *postnewparent) { unify_local_t *local = frame->local; @@ -3515,7 +3516,7 @@ unify_ns_rename_undo_cbk (call_frame_t *frame, strerror (op_errno)); } - local->stbuf.st_ino = local->st_ino; + local->stbuf.ia_ino = local->ia_ino; unify_local_wipe (local); STACK_UNWIND (frame, local->op_ret, local->op_errno, &local->stbuf); return 0; @@ -3527,11 +3528,11 @@ unify_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf, - struct stat *preoldparent, - struct stat *postoldparent, - struct stat *prenewparent, - struct stat *postnewparent) + struct iatt *buf, + struct iatt *preoldparent, + struct iatt *postoldparent, + struct iatt *prenewparent, + struct iatt *postnewparent) { int32_t index = 0; int32_t callcnt = 0; @@ -3544,7 +3545,7 @@ unify_rename_cbk (call_frame_t *frame, { callcnt = --local->call_count; if (op_ret >= 0) { - if (!S_ISDIR (buf->st_mode)) + if (!IA_ISDIR (buf->ia_type)) local->stbuf = *buf; local->op_ret = op_ret; } else { @@ -3559,8 +3560,8 @@ unify_rename_cbk (call_frame_t *frame, UNLOCK (&frame->lock); if (!callcnt) { - local->stbuf.st_ino = local->st_ino; - if (S_ISDIR (local->loc1.inode->st_mode)) { + local->stbuf.ia_ino = local->ia_ino; + if (IA_ISDIR (local->loc1.inode->ia_type)) { unify_local_wipe (local); STACK_UNWIND (frame, local->op_ret, local->op_errno, &local->stbuf, &local->oldpreparent, @@ -3692,11 +3693,11 @@ unify_ns_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf, - struct stat *preoldparent, - struct stat *postoldparent, - struct stat *prenewparent, - struct stat *postnewparent) + struct iatt *buf, + struct iatt *preoldparent, + struct iatt *postoldparent, + struct iatt *prenewparent, + struct iatt *postnewparent) { int32_t index = 0; int32_t callcnt = 0; @@ -3719,7 +3720,7 @@ unify_ns_rename_cbk (call_frame_t *frame, } local->stbuf = *buf; - local->st_ino = buf->st_ino; + local->ia_ino = buf->ia_ino; local->oldpreparent = *preoldparent; local->oldpostparent = *postoldparent; @@ -3727,7 +3728,7 @@ unify_ns_rename_cbk (call_frame_t *frame, local->newpostparent = *postnewparent; /* Everything is fine. */ - if (S_ISDIR (buf->st_mode)) { + if (IA_ISDIR (buf->ia_type)) { local->call_count = priv->child_count; for (index=0; index < priv->child_count; index++) { STACK_WIND (frame, @@ -3826,15 +3827,15 @@ unify_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { unify_local_t *local = frame->local; if (op_ret >= 0) local->stbuf = *buf; - local->stbuf.st_ino = local->st_ino; + local->stbuf.ia_ino = local->ia_ino; unify_local_wipe (local); STACK_UNWIND (frame, op_ret, op_errno, inode, &local->stbuf, @@ -3853,9 +3854,9 @@ unify_ns_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, - struct stat *preparent, - struct stat *postparent) + struct iatt *buf, + struct iatt *preparent, + struct iatt *postparent) { unify_private_t *priv = this->private; unify_local_t *local = frame->local; @@ -3878,7 +3879,7 @@ unify_ns_link_cbk (call_frame_t *frame, /* Update inode for this entry */ local->op_ret = 0; - local->st_ino = buf->st_ino; + local->ia_ino = buf->ia_ino; local->oldpreparent = *preparent; local->oldpostparent = *postparent; @@ -4178,7 +4179,7 @@ unify_forget (xlator_t *this, int16_t *list = NULL; uint64_t tmp_list = 0; - if (inode->st_mode && (!S_ISDIR(inode->st_mode))) { + if (inode->ia_type && (!IA_ISDIR(inode->ia_type))) { inode_ctx_get (inode, this, &tmp_list); if (tmp_list) { list = (int16_t *)(long)tmp_list; diff --git a/xlators/cluster/unify/src/unify.h b/xlators/cluster/unify/src/unify.h index b81946697..cf3560d5b 100644 --- a/xlators/cluster/unify/src/unify.h +++ b/xlators/cluster/unify/src/unify.h @@ -96,16 +96,16 @@ struct _unify_local_t { int32_t entry_count; int32_t count; // dir_entry_t count; fd_t *fd; - struct stat stbuf; - struct stat stpre; - struct stat stpost; + struct iatt stbuf; + struct iatt stpre; + struct iatt stpost; struct statvfs statvfs_buf; struct timespec tv[2]; char *name; int32_t revalidate; - ino_t st_ino; - nlink_t st_nlink; + ino_t ia_ino; + nlink_t ia_nlink; dict_t *dict; @@ -125,15 +125,15 @@ struct _unify_local_t { struct unify_self_heal_struct *sh_struct; loc_t loc1, loc2; - struct stat poststbuf; + struct iatt poststbuf; /* When not used for rename, old* * are used as the attrs for the current * parent directory. */ - struct stat oldpreparent; - struct stat oldpostparent; - struct stat newpreparent; - struct stat newpostparent; + struct iatt oldpreparent; + struct iatt oldpostparent; + struct iatt newpreparent; + struct iatt newpostparent; int32_t wbflags; }; typedef struct _unify_local_t unify_local_t; |