From 283ec9608e6cbc9393941d5fae901e558360d2bd Mon Sep 17 00:00:00 2001 From: "Anand V. Avati" Date: Tue, 16 Mar 2010 09:46:33 +0000 Subject: 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 Signed-off-by: Anand V. Avati BUG: 361 (GlusterFS 3.0 should work on Mac OS/X) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=361 --- xlators/cluster/afr/src/afr-dir-read.c | 6 +- xlators/cluster/afr/src/afr-dir-write.c | 146 ++--- xlators/cluster/afr/src/afr-inode-read.c | 16 +- xlators/cluster/afr/src/afr-inode-write.c | 40 +- xlators/cluster/afr/src/afr-inode-write.h | 4 +- xlators/cluster/afr/src/afr-open.c | 6 +- xlators/cluster/afr/src/afr-self-heal-algorithm.c | 12 +- xlators/cluster/afr/src/afr-self-heal-common.c | 63 +- xlators/cluster/afr/src/afr-self-heal-common.h | 2 +- xlators/cluster/afr/src/afr-self-heal-data.c | 31 +- xlators/cluster/afr/src/afr-self-heal-entry.c | 112 ++-- xlators/cluster/afr/src/afr-self-heal-metadata.c | 36 +- xlators/cluster/afr/src/afr-self-heal.h | 10 +- xlators/cluster/afr/src/afr.c | 60 +- xlators/cluster/afr/src/afr.h | 100 +-- xlators/cluster/dht/src/dht-common.c | 289 +++++---- xlators/cluster/dht/src/dht-common.h | 31 +- xlators/cluster/dht/src/dht-helper.c | 32 +- xlators/cluster/dht/src/dht-linkfile.c | 8 +- xlators/cluster/dht/src/dht-rename.c | 62 +- xlators/cluster/dht/src/dht-selfheal.c | 16 +- xlators/cluster/dht/src/nufa.c | 20 +- xlators/cluster/dht/src/switch.c | 20 +- xlators/cluster/ha/src/ha.c | 100 +-- xlators/cluster/ha/src/ha.h | 6 +- xlators/cluster/map/src/map.c | 114 ++-- xlators/cluster/map/src/map.h | 2 +- xlators/cluster/stripe/src/stripe.c | 348 ++++++----- xlators/cluster/stripe/src/stripe.h | 12 +- xlators/cluster/unify/src/unify-self-heal.c | 8 +- xlators/cluster/unify/src/unify.c | 311 ++++----- xlators/cluster/unify/src/unify.h | 20 +- xlators/debug/error-gen/src/error-gen.c | 58 +- xlators/debug/io-stats/src/io-stats.c | 56 +- xlators/debug/trace/src/trace.c | 264 ++++---- xlators/encryption/rot-13/src/rot-13.c | 6 +- xlators/features/filter/src/filter.c | 118 ++-- xlators/features/locks/src/common.c | 5 +- xlators/features/locks/src/posix.c | 20 +- xlators/features/path-convertor/src/path.c | 62 +- xlators/features/quota/src/quota.c | 80 +-- xlators/features/trash/src/trash.c | 126 ++-- xlators/mount/fuse/src/fuse-bridge.c | 162 ++--- xlators/performance/io-cache/src/io-cache.c | 62 +- xlators/performance/io-cache/src/io-cache.h | 8 +- xlators/performance/io-cache/src/ioc-inode.c | 2 +- xlators/performance/io-cache/src/page.c | 16 +- xlators/performance/io-threads/src/io-threads.c | 72 +-- xlators/performance/quick-read/src/quick-read.c | 36 +- xlators/performance/quick-read/src/quick-read.h | 2 +- xlators/performance/read-ahead/src/page.c | 2 +- xlators/performance/read-ahead/src/read-ahead.c | 34 +- xlators/performance/read-ahead/src/read-ahead.h | 2 +- .../performance/stat-prefetch/src/stat-prefetch.c | 56 +- .../performance/stat-prefetch/src/stat-prefetch.h | 2 +- .../performance/symlink-cache/src/symlink-cache.c | 24 +- .../performance/write-behind/src/write-behind.c | 64 +- xlators/protocol/client/src/client-protocol.c | 236 +++---- xlators/protocol/client/src/client-protocol.h | 40 +- xlators/protocol/server/src/server-helpers.c | 48 +- xlators/protocol/server/src/server-helpers.h | 2 +- xlators/protocol/server/src/server-protocol.c | 212 +++---- xlators/protocol/server/src/server-protocol.h | 2 +- xlators/protocol/server/src/server-resolve.c | 4 +- xlators/storage/posix/src/posix.c | 696 ++++----------------- 65 files changed, 2071 insertions(+), 2551 deletions(-) (limited to 'xlators') 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 -#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 : ""); - 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; diff --git a/xlators/debug/error-gen/src/error-gen.c b/xlators/debug/error-gen/src/error-gen.c index e6a5967cc..931e9dc96 100644 --- a/xlators/debug/error-gen/src/error-gen.c +++ b/xlators/debug/error-gen/src/error-gen.c @@ -390,7 +390,7 @@ error_gen (xlator_t *this, int op_no) int error_gen_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) { STACK_UNWIND_STRICT (lookup, frame, op_ret, op_errno, inode, buf, dict, postparent); @@ -436,7 +436,7 @@ error_gen_forget (xlator_t *this, inode_t *inode) int error_gen_stat_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_STRICT (stat, frame, op_ret, op_errno, buf); @@ -473,7 +473,7 @@ error_gen_stat (call_frame_t *frame, xlator_t *this, loc_t *loc) int error_gen_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) { STACK_UNWIND_STRICT (setattr, frame, op_ret, op_errno, preop, postop); @@ -483,7 +483,7 @@ error_gen_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int error_gen_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { int op_errno = 0; eg_t *egp = NULL; @@ -511,7 +511,7 @@ error_gen_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, int error_gen_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { int op_errno = 0; eg_t *egp = NULL; @@ -540,7 +540,7 @@ error_gen_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, int error_gen_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) + struct iatt *prebuf, struct iatt *postbuf) { STACK_UNWIND_STRICT (truncate, frame, op_ret, op_errno, prebuf, postbuf); @@ -579,8 +579,8 @@ error_gen_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, int error_gen_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) { STACK_UNWIND_STRICT (ftruncate, frame, op_ret, op_errno, prebuf, postbuf); @@ -658,7 +658,7 @@ error_gen_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int error_gen_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *path, struct stat *sbuf) + const char *path, struct iatt *sbuf) { STACK_UNWIND_STRICT (readlink, frame, op_ret, op_errno, path, sbuf); return 0; @@ -696,8 +696,8 @@ error_gen_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int error_gen_mknod_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_STRICT (mknod, frame, op_ret, op_errno, inode, buf, @@ -738,8 +738,8 @@ error_gen_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, int error_gen_mkdir_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_STRICT (mkdir, frame, op_ret, op_errno, inode, buf, @@ -779,7 +779,7 @@ error_gen_mkdir (call_frame_t *frame, xlator_t *this, int error_gen_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) { STACK_UNWIND_STRICT (unlink, frame, op_ret, op_errno, preparent, postparent); @@ -817,7 +817,7 @@ error_gen_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) int error_gen_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) + struct iatt *preparent, struct iatt *postparent) { STACK_UNWIND_STRICT (rmdir, frame, op_ret, op_errno, preparent, postparent); @@ -855,8 +855,8 @@ error_gen_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc) int error_gen_symlink_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_STRICT (symlink, frame, op_ret, op_errno, inode, buf, preparent, postparent); @@ -895,9 +895,9 @@ error_gen_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, int error_gen_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) { STACK_UNWIND_STRICT (rename, frame, op_ret, op_errno, buf, preoldparent, postoldparent, @@ -938,8 +938,8 @@ error_gen_rename (call_frame_t *frame, xlator_t *this, int error_gen_link_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_STRICT (link, frame, op_ret, op_errno, inode, buf, preparent, postparent); @@ -979,8 +979,8 @@ error_gen_link (call_frame_t *frame, xlator_t *this, int error_gen_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) + fd_t *fd, inode_t *inode, struct iatt *buf, + struct iatt *preparent, struct iatt *postparent) { STACK_UNWIND_STRICT (create, frame, op_ret, op_errno, fd, inode, buf, preparent, postparent); @@ -1058,7 +1058,7 @@ int error_gen_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_STRICT (readv, frame, op_ret, op_errno, vector, count, stbuf, iobref); @@ -1099,7 +1099,7 @@ error_gen_readv (call_frame_t *frame, xlator_t *this, int error_gen_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) + struct iatt *prebuf, struct iatt *postbuf) { STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -1174,8 +1174,8 @@ error_gen_flush (call_frame_t *frame, xlator_t *this, fd_t *fd) int error_gen_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_errno, struct iatt *prebuf, + struct iatt *postbuf) { STACK_UNWIND_STRICT (fsync, frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -1211,7 +1211,7 @@ error_gen_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags) int error_gen_fstat_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_STRICT (fstat, frame, op_ret, op_errno, buf); return 0; diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index b3cfbeb4f..eecca0a72 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -347,8 +347,8 @@ io_stats_dump_fd (xlator_t *this, struct ios_fd *iosfd) int io_stats_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) { struct ios_fd *iosfd = NULL; char *path = NULL; @@ -419,7 +419,7 @@ unwind: int io_stats_stat_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_STRICT (stat, frame, op_ret, op_errno, buf); return 0; @@ -430,7 +430,7 @@ int io_stats_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 iobref *iobref) + struct iatt *buf, struct iobref *iobref) { struct ios_conf *conf = NULL; int len = 0; @@ -455,7 +455,7 @@ io_stats_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int io_stats_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) + struct iatt *prebuf, struct iatt *postbuf) { STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -493,7 +493,7 @@ io_stats_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int io_stats_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) + struct iatt *prebuf, struct iatt *postbuf) { STACK_UNWIND_STRICT (fsync, frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -503,7 +503,7 @@ io_stats_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int io_stats_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) { STACK_UNWIND_STRICT (setattr, frame, op_ret, op_errno, preop, postop); return 0; @@ -513,7 +513,7 @@ io_stats_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int io_stats_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) { STACK_UNWIND_STRICT (unlink, frame, op_ret, op_errno, preparent, postparent); @@ -523,9 +523,9 @@ io_stats_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int io_stats_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) { STACK_UNWIND_STRICT (rename, frame, op_ret, op_errno, buf, preoldparent, postoldparent, @@ -537,7 +537,7 @@ io_stats_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int io_stats_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) + struct iatt *sbuf) { STACK_UNWIND_STRICT (readlink, frame, op_ret, op_errno, buf, sbuf); return 0; @@ -547,8 +547,8 @@ io_stats_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int io_stats_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) { STACK_UNWIND_STRICT (lookup, frame, op_ret, op_errno, inode, buf, xattr, postparent); @@ -559,8 +559,8 @@ io_stats_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int io_stats_symlink_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) { STACK_UNWIND_STRICT (symlink, frame, op_ret, op_errno, inode, buf, preparent, postparent); @@ -571,8 +571,8 @@ io_stats_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int io_stats_mknod_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) { STACK_UNWIND_STRICT (mknod, frame, op_ret, op_errno, inode, buf, preparent, postparent); @@ -583,8 +583,8 @@ io_stats_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int io_stats_mkdir_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) { STACK_UNWIND_STRICT (mkdir, frame, op_ret, op_errno, inode, buf, preparent, postparent); @@ -595,8 +595,8 @@ io_stats_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int io_stats_link_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) { STACK_UNWIND_STRICT (link, frame, op_ret, op_errno, inode, buf, preparent, postparent); @@ -628,7 +628,7 @@ io_stats_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int io_stats_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) + struct iatt *preparent, struct iatt *postparent) { STACK_UNWIND_STRICT (rmdir, frame, op_ret, op_errno, preparent, postparent); @@ -639,7 +639,7 @@ io_stats_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int io_stats_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) + struct iatt *prebuf, struct iatt *postbuf) { STACK_UNWIND_STRICT (truncate, frame, op_ret, op_errno, prebuf, postbuf); @@ -704,7 +704,7 @@ io_stats_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int io_stats_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) + struct iatt *prebuf, struct iatt *postbuf) { STACK_UNWIND_STRICT (ftruncate, frame, op_ret, op_errno, prebuf, postbuf); @@ -714,7 +714,7 @@ io_stats_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int io_stats_fstat_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_STRICT (fstat, frame, op_ret, op_errno, buf); return 0; @@ -1007,7 +1007,7 @@ io_stats_link (call_frame_t *frame, xlator_t *this, int io_stats_setattr (call_frame_t *frame, xlator_t *this, - loc_t *loc, struct stat *stbuf, int32_t valid) + loc_t *loc, struct iatt *stbuf, int32_t valid) { BUMP_FOP (SETATTR); @@ -1336,7 +1336,7 @@ io_stats_ftruncate (call_frame_t *frame, xlator_t *this, int io_stats_fsetattr (call_frame_t *frame, xlator_t *this, - fd_t *fd, struct stat *stbuf, int32_t valid) + fd_t *fd, struct iatt *stbuf, int32_t valid) { BUMP_FOP (FSETATTR); diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c index 313f0f3cc..a9e580c0e 100644 --- a/xlators/debug/trace/src/trace.c +++ b/xlators/debug/trace/src/trace.c @@ -60,7 +60,7 @@ struct { int trace_log_level = GF_LOG_NORMAL; static char * -trace_stat_to_str (struct stat *stbuf) +trace_stat_to_str (struct iatt *stbuf) { char *statstr = NULL; char atime_buf[256] = {0,}; @@ -69,22 +69,22 @@ trace_stat_to_str (struct stat *stbuf) int asprint_ret_value = 0; strftime (atime_buf, 256, "[%b %d %H:%M:%S]", - localtime (&stbuf->st_atime)); + localtime ((time_t *)&stbuf->ia_atime)); strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", - localtime (&stbuf->st_mtime)); + localtime ((time_t *)&stbuf->ia_mtime)); strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", - localtime (&stbuf->st_ctime)); + localtime ((time_t *)&stbuf->ia_ctime)); asprint_ret_value = asprintf (&statstr, - "st_ino=%"PRIu64", st_dev=%"PRIu64 - ", st_mode=%o, st_nlink=%"GF_PRI_NLINK", " - "st_uid=%d, st_gid=%d, st_size=%"PRId64", st_blocks=%"PRId64 - ", st_atime=%s, st_mtime=%s, st_ctime=%s", - stbuf->st_ino, stbuf->st_dev, - stbuf->st_mode, stbuf->st_nlink, - stbuf->st_uid, - stbuf->st_gid, stbuf->st_size, - stbuf->st_blocks, atime_buf, + "ia_ino=%"PRIu64", ia_gen=%"PRIu64 + ", st_mode=%o, ia_nlink=%"GF_PRI_NLINK", " + "ia_uid=%d, ia_gid=%d, ia_size=%"PRId64", ia_blocks=%"PRId64 + ", ia_atime=%s, ia_mtime=%s, ia_ctime=%s", + stbuf->ia_ino, stbuf->ia_gen, + st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type), + stbuf->ia_nlink, stbuf->ia_uid, + stbuf->ia_gid, stbuf->ia_size, + stbuf->ia_blocks, atime_buf, mtime_buf, ctime_buf); if (asprint_ret_value < 0) @@ -97,8 +97,8 @@ trace_stat_to_str (struct stat *stbuf) int trace_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) { char *statstr = NULL; char *preparentstr = NULL; @@ -154,7 +154,7 @@ trace_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_stat_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) { char atime_buf[256]; char mtime_buf[256]; @@ -163,20 +163,24 @@ trace_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (trace_fop_names[GF_FOP_STAT].enabled) { if (op_ret >= 0) { - strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_atime)); - strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_mtime)); - strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_ctime)); + strftime (atime_buf, 256, "[%b %d %H:%M:%S]", + localtime ((time_t *)&buf->ia_atime)); + strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", + localtime ((time_t *)&buf->ia_mtime)); + strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", + localtime ((time_t *)&buf->ia_ctime)); gf_log (this->name, GF_LOG_NORMAL, - "%"PRId64": (op_ret=%d, buf {st_dev=%"GF_PRI_DEV", " - "st_ino=%"PRIu64", st_mode=%o, st_nlink=%"GF_PRI_NLINK", " - "st_uid=%d, st_gid=%d, st_rdev=%"GF_PRI_DEV", st_size=%"PRId64 - ", st_blksize=%"GF_PRI_BLKSIZE", st_blocks=%"PRId64", " - "st_atime=%s, st_mtime=%s, st_ctime=%s})", - frame->root->unique, op_ret, buf->st_dev, buf->st_ino, - buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid, - buf->st_rdev, buf->st_size, buf->st_blksize, - buf->st_blocks, atime_buf, mtime_buf, ctime_buf); + "%"PRId64": (op_ret=%d, buf {ia_gen=%"GF_PRI_DEV", " + "ia_ino=%"PRIu64", st_mode=%o, ia_nlink=%"GF_PRI_NLINK", " + "ia_uid=%d, ia_gid=%d, ia_rdev=%"GF_PRI_DEV", ia_size=%"PRId64 + ", ia_blksize=%"GF_PRI_BLKSIZE", ia_blocks=%"PRId64", " + "ia_atime=%s, ia_mtime=%s, ia_ctime=%s})", + frame->root->unique, op_ret, buf->ia_gen, buf->ia_ino, + st_mode_from_ia (buf->ia_prot, buf->ia_type), + buf->ia_nlink, buf->ia_uid, buf->ia_gid, + buf->ia_rdev, buf->ia_size, buf->ia_blksize, + buf->ia_blocks, atime_buf, mtime_buf, ctime_buf); } else { gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, op_errno=%d)", @@ -192,7 +196,7 @@ trace_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_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 iobref *iobref) + int32_t count, struct iatt *buf, struct iobref *iobref) { char atime_buf[256]; char mtime_buf[256]; @@ -200,19 +204,23 @@ trace_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (trace_fop_names[GF_FOP_READ].enabled) { if (op_ret >= 0) { - strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_atime)); - strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_mtime)); - strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_ctime)); + strftime (atime_buf, 256, "[%b %d %H:%M:%S]", + localtime ((time_t *)&buf->ia_atime)); + strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", + localtime ((time_t *)&buf->ia_mtime)); + strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", + localtime ((time_t *)&buf->ia_ctime)); gf_log (this->name, GF_LOG_NORMAL, - "%"PRId64": (op_ret=%d, op_errno=%d, *buf {st_dev=%"GF_PRI_DEV", " - "st_ino=%"PRIu64", st_mode=%o, st_nlink=%"GF_PRI_NLINK", " - "st_uid=%d, st_gid=%d, st_rdev=%"GF_PRI_DEV", " - "st_size=%"PRId64", st_blksize=%"GF_PRI_BLKSIZE", " - "st_blocks=%"PRId64", st_atime=%s, st_mtime=%s, st_ctime=%s})", - frame->root->unique, op_ret, op_errno, buf->st_dev, buf->st_ino, - buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid, - buf->st_rdev, buf->st_size, buf->st_blksize, buf->st_blocks, + "%"PRId64": (op_ret=%d, op_errno=%d, *buf {ia_gen=%"GF_PRI_DEV", " + "ia_ino=%"PRIu64", st_mode=%o, ia_nlink=%"GF_PRI_NLINK", " + "ia_uid=%d, ia_gid=%d, ia_rdev=%"GF_PRI_DEV", " + "ia_size=%"PRId64", ia_blksize=%"GF_PRI_BLKSIZE", " + "ia_blocks=%"PRId64", ia_atime=%s, ia_mtime=%s, ia_ctime=%s})", + frame->root->unique, op_ret, op_errno, buf->ia_gen, buf->ia_ino, + st_mode_from_ia (buf->ia_prot, buf->ia_type), + buf->ia_nlink, buf->ia_uid, buf->ia_gid, + buf->ia_rdev, buf->ia_size, buf->ia_blksize, buf->ia_blocks, atime_buf, mtime_buf, ctime_buf); } else { gf_log (this->name, GF_LOG_NORMAL, @@ -230,7 +238,7 @@ trace_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_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) + struct iatt *prebuf, struct iatt *postbuf) { char *preopstr = NULL; char *postopstr = NULL; @@ -243,7 +251,7 @@ trace_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, ino = %"PRIu64 ", *prebuf = {%s}, *postbuf = {%s})", - frame->root->unique, op_ret, postbuf->st_ino, + frame->root->unique, op_ret, postbuf->ia_ino, preopstr, postopstr); if (preopstr) @@ -314,7 +322,7 @@ trace_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_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) + struct iatt *prebuf, struct iatt *postbuf) { char *preopstr = NULL; char *postopstr = NULL; @@ -327,7 +335,7 @@ trace_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, ino = %"PRIu64 ", *prebuf = {%s}, *postbuf = {%s}", - frame->root->unique, op_ret, postbuf->st_ino, + frame->root->unique, op_ret, postbuf->ia_ino, preopstr, postopstr); if (preopstr) @@ -351,7 +359,7 @@ trace_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_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) + struct iatt *statpre, struct iatt *statpost) { char atime_pre[256] = {0,}; char mtime_pre[256] = {0,}; @@ -363,31 +371,33 @@ trace_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (trace_fop_names[GF_FOP_SETATTR].enabled) { if (op_ret >= 0) { strftime (atime_pre, 256, "[%b %d %H:%M:%S]", - localtime (&statpre->st_atime)); + localtime ((time_t *)&statpre->ia_atime)); strftime (mtime_pre, 256, "[%b %d %H:%M:%S]", - localtime (&statpre->st_mtime)); + localtime ((time_t *)&statpre->ia_mtime)); strftime (ctime_pre, 256, "[%b %d %H:%M:%S]", - localtime (&statpre->st_ctime)); + localtime ((time_t *)&statpre->ia_ctime)); strftime (atime_post, 256, "[%b %d %H:%M:%S]", - localtime (&statpost->st_atime)); + localtime ((time_t *)&statpost->ia_atime)); strftime (mtime_post, 256, "[%b %d %H:%M:%S]", - localtime (&statpost->st_mtime)); + localtime ((time_t *)&statpost->ia_mtime)); strftime (ctime_post, 256, "[%b %d %H:%M:%S]", - localtime (&statpost->st_ctime)); + localtime ((time_t *)&statpost->ia_ctime)); gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, *statpre " - "{st_ino=%"PRIu64", st_mode=%o, st_uid=%d, " - "st_gid=%d, st_atime=%s, st_mtime=%s, " - "st_ctime=%s}, *statpost {st_ino=%"PRIu64", " - "st_mode=%o, st_uid=%d, st_gid=%d, st_atime=%s," - " st_mtime=%s, st_ctime=%s})", - frame->root->unique, op_ret, statpre->st_ino, - statpre->st_mode, statpre->st_uid, - statpre->st_gid, atime_pre, mtime_pre, - ctime_pre, statpost->st_ino, statpost->st_mode, - statpost->st_uid, statpost->st_gid, atime_post, + "{ia_ino=%"PRIu64", st_mode=%o, ia_uid=%d, " + "ia_gid=%d, ia_atime=%s, ia_mtime=%s, " + "ia_ctime=%s}, *statpost {ia_ino=%"PRIu64", " + "st_mode=%o, ia_uid=%d, ia_gid=%d, ia_atime=%s," + " ia_mtime=%s, ia_ctime=%s})", + frame->root->unique, op_ret, statpre->ia_ino, + st_mode_from_ia (statpre->ia_prot, statpre->ia_type), + statpre->ia_uid, + statpre->ia_gid, atime_pre, mtime_pre, + ctime_pre, statpost->ia_ino, + st_mode_from_ia (statpost->ia_prot, statpost->ia_type), + statpost->ia_uid, statpost->ia_gid, atime_post, mtime_post, ctime_post); } else { gf_log (this->name, GF_LOG_NORMAL, @@ -404,7 +414,7 @@ trace_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *statpre, struct stat *statpost) + struct iatt *statpre, struct iatt *statpost) { char atime_pre[256] = {0,}; char mtime_pre[256] = {0,}; @@ -416,31 +426,33 @@ trace_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (trace_fop_names[GF_FOP_FSETATTR].enabled) { if (op_ret >= 0) { strftime (atime_pre, 256, "[%b %d %H:%M:%S]", - localtime (&statpre->st_atime)); + localtime ((time_t *)&statpre->ia_atime)); strftime (mtime_pre, 256, "[%b %d %H:%M:%S]", - localtime (&statpre->st_mtime)); + localtime ((time_t *)&statpre->ia_mtime)); strftime (ctime_pre, 256, "[%b %d %H:%M:%S]", - localtime (&statpre->st_ctime)); + localtime ((time_t *)&statpre->ia_ctime)); strftime (atime_post, 256, "[%b %d %H:%M:%S]", - localtime (&statpost->st_atime)); + localtime ((time_t *)&statpost->ia_atime)); strftime (mtime_post, 256, "[%b %d %H:%M:%S]", - localtime (&statpost->st_mtime)); + localtime ((time_t *)&statpost->ia_mtime)); strftime (ctime_post, 256, "[%b %d %H:%M:%S]", - localtime (&statpost->st_ctime)); + localtime ((time_t *)&statpost->ia_ctime)); gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, *statpre " - "{st_ino=%"PRIu64", st_mode=%o, st_uid=%d, " - "st_gid=%d, st_atime=%s, st_mtime=%s, " - "st_ctime=%s}, *statpost {st_ino=%"PRIu64", " - "st_mode=%o, st_uid=%d, st_gid=%d, st_atime=%s," - " st_mtime=%s, st_ctime=%s})", - frame->root->unique, op_ret, statpre->st_ino, - statpre->st_mode, statpre->st_uid, - statpre->st_gid, atime_pre, mtime_pre, - ctime_pre, statpost->st_ino, statpost->st_mode, - statpost->st_uid, statpost->st_gid, atime_post, + "{ia_ino=%"PRIu64", st_mode=%o, ia_uid=%d, " + "ia_gid=%d, ia_atime=%s, ia_mtime=%s, " + "ia_ctime=%s}, *statpost {ia_ino=%"PRIu64", " + "st_mode=%o, ia_uid=%d, ia_gid=%d, ia_atime=%s," + " ia_mtime=%s, ia_ctime=%s})", + frame->root->unique, op_ret, statpre->ia_ino, + st_mode_from_ia (statpre->ia_prot, statpre->ia_type), + statpre->ia_uid, + statpre->ia_gid, atime_pre, mtime_pre, + ctime_pre, statpost->ia_ino, + st_mode_from_ia (statpost->ia_prot, statpost->ia_type), + statpost->ia_uid, statpost->ia_gid, atime_post, mtime_post, ctime_post); } else { gf_log (this->name, GF_LOG_NORMAL, @@ -458,7 +470,7 @@ trace_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_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) { char *preparentstr = NULL; char *postparentstr = NULL; @@ -494,9 +506,9 @@ trace_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_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) { char *statstr = NULL; char *preoldparentstr = NULL; @@ -538,9 +550,9 @@ trace_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, op_ret, op_errno); } gf_log (this->name, GF_LOG_NORMAL, - "%"PRId64": (op_ret=%d, op_errno=%d, buf {st_ino=%"PRIu64"})", + "%"PRId64": (op_ret=%d, op_errno=%d, buf {ia_ino=%"PRIu64"})", frame->root->unique, op_ret, op_errno, - (buf? buf->st_ino : 0)); + (buf? buf->ia_ino : 0)); } STACK_UNWIND_STRICT (rename, frame, op_ret, op_errno, buf, @@ -553,7 +565,7 @@ trace_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *buf, struct stat *stbuf) + const char *buf, struct iatt *stbuf) { char *statstr = NULL; @@ -583,8 +595,8 @@ trace_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_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) { char *statstr = NULL; char *postparentstr = NULL; @@ -620,8 +632,8 @@ trace_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_symlink_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) { char *statstr = NULL; char *preparentstr = NULL; @@ -665,8 +677,8 @@ trace_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_mknod_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) { char *statstr = NULL; char *preparentstr = NULL; @@ -709,8 +721,8 @@ trace_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_mkdir_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) { char *statstr = NULL; char *preparentstr = NULL; @@ -726,7 +738,7 @@ trace_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "%"PRId64": (op_ret=%d, ino = %"PRIu64 ", *stbuf = {%s}, *prebuf = {%s}, " "*postbuf = {%s} )", - frame->root->unique, op_ret, buf->st_ino, + frame->root->unique, op_ret, buf->ia_ino, statstr, preparentstr, postparentstr); if (statstr) @@ -753,8 +765,8 @@ trace_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_link_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) { char *statstr = NULL; char *preparentstr = NULL; @@ -770,7 +782,7 @@ trace_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "%"PRId64": (op_ret=%d, ino = %"PRIu64 ", *stbuf = {%s}, *prebuf = {%s}, " "*postbuf = {%s})", - frame->root->unique, op_ret, buf->st_ino, + frame->root->unique, op_ret, buf->ia_ino, statstr, preparentstr, postparentstr); if (statstr) @@ -827,7 +839,7 @@ trace_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_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) + struct iatt *preparent, struct iatt *postparent) { char *preparentstr = NULL; char *postparentstr = NULL; @@ -864,7 +876,7 @@ trace_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_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) + struct iatt *prebuf, struct iatt *postbuf) { char *preopstr = NULL; char *postopstr = NULL; @@ -1003,7 +1015,7 @@ trace_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_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) + struct iatt *prebuf, struct iatt *postbuf) { char *prebufstr = NULL; char *postbufstr = NULL; @@ -1039,7 +1051,7 @@ trace_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trace_fstat_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) { char atime_buf[256]; char mtime_buf[256]; @@ -1048,22 +1060,23 @@ trace_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (trace_fop_names[GF_FOP_FSTAT].enabled) { if (op_ret >= 0) { strftime (atime_buf, 256, "[%b %d %H:%M:%S]", - localtime (&buf->st_atime)); + localtime ((time_t *)&buf->ia_atime)); strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", - localtime (&buf->st_mtime)); + localtime ((time_t *)&buf->ia_mtime)); strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", - localtime (&buf->st_ctime)); + localtime ((time_t *)&buf->ia_ctime)); gf_log (this->name, GF_LOG_NORMAL, - "%"PRId64": (op_ret=%d, *buf {st_dev=%"GF_PRI_DEV", " - "st_ino=%"PRIu64", st_mode=%o, st_nlink=%"GF_PRI_NLINK", " - "st_uid=%d, st_gid=%d, st_rdev=%"GF_PRI_DEV", st_size=%"PRId64", " - "st_blksize=%"GF_PRI_BLKSIZE", st_blocks=%"PRId64", st_atime=%s, " - "st_mtime=%s, st_ctime=%s})", - frame->root->unique, op_ret, buf->st_dev, buf->st_ino, - buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid, - buf->st_rdev, buf->st_size, buf->st_blksize, - buf->st_blocks, atime_buf, mtime_buf, ctime_buf); + "%"PRId64": (op_ret=%d, *buf {ia_gen=%"GF_PRI_DEV", " + "ia_ino=%"PRIu64", st_mode=%o, ia_nlink=%"GF_PRI_NLINK", " + "ia_uid=%d, ia_gid=%d, ia_rdev=%"GF_PRI_DEV", ia_size=%"PRId64", " + "ia_blksize=%"GF_PRI_BLKSIZE", ia_blocks=%"PRId64", ia_atime=%s, " + "ia_mtime=%s, ia_ctime=%s})", + frame->root->unique, op_ret, buf->ia_gen, buf->ia_ino, + st_mode_from_ia (buf->ia_prot, buf->ia_type), + buf->ia_nlink, buf->ia_uid, buf->ia_gid, + buf->ia_rdev, buf->ia_size, buf->ia_blksize, + buf->ia_blocks, atime_buf, mtime_buf, ctime_buf); } else { gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, op_errno=%d)", @@ -1478,7 +1491,7 @@ trace_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc) int trace_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { char actime_str[256] = {0,}; char modtime_str[256] = {0,}; @@ -1488,7 +1501,8 @@ trace_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (loc {path=%s, ino=%"PRIu64"}," " mode=%o)", frame->root->unique, loc->path, - loc->inode->ino, stbuf->st_mode); + loc->inode->ino, + st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type)); } if (valid & (GF_SET_ATTR_UID | GF_SET_ATTR_GID)) { @@ -1496,18 +1510,18 @@ trace_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, "%"PRId64": (loc {path=%s, ino=%"PRIu64"}," " uid=%o, gid=%o)", frame->root->unique, loc->path, loc->inode->ino, - stbuf->st_uid, stbuf->st_gid); + stbuf->ia_uid, stbuf->ia_gid); } if (valid & (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME)) { strftime (actime_str, 256, "[%b %d %H:%M:%S]", - localtime (&stbuf->st_atime)); + localtime ((time_t *)&stbuf->ia_atime)); strftime (modtime_str, 256, "[%b %d %H:%M:%S]", - localtime (&stbuf->st_mtime)); + localtime ((time_t *)&stbuf->ia_mtime)); gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, " - "*stbuf=%p {st_atime=%s, st_mtime=%s})", + "*stbuf=%p {ia_atime=%s, ia_mtime=%s})", frame->root->unique, loc->path, loc->inode->ino, stbuf, actime_str, modtime_str); } @@ -1524,7 +1538,7 @@ trace_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, int trace_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { char actime_str[256] = {0,}; char modtime_str[256] = {0,}; @@ -1534,25 +1548,25 @@ trace_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (*fd=%p, mode=%o)", frame->root->unique, fd, - stbuf->st_mode); + st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type)); } if (valid & (GF_SET_ATTR_UID | GF_SET_ATTR_GID)) { gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (*fd=%p, uid=%o, gid=%o)", frame->root->unique, fd, - stbuf->st_uid, stbuf->st_gid); + stbuf->ia_uid, stbuf->ia_gid); } if (valid & (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME)) { strftime (actime_str, 256, "[%b %d %H:%M:%S]", - localtime (&stbuf->st_atime)); + localtime ((time_t *)&stbuf->ia_atime)); strftime (modtime_str, 256, "[%b %d %H:%M:%S]", - localtime (&stbuf->st_mtime)); + localtime ((time_t *)&stbuf->ia_mtime)); gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (*fd=%p" - "*stbuf=%p {st_atime=%s, st_mtime=%s})", + "*stbuf=%p {ia_atime=%s, ia_mtime=%s})", frame->root->unique, fd, stbuf, actime_str, modtime_str); } diff --git a/xlators/encryption/rot-13/src/rot-13.c b/xlators/encryption/rot-13/src/rot-13.c index d5c702882..dc938781c 100644 --- a/xlators/encryption/rot-13/src/rot-13.c +++ b/xlators/encryption/rot-13/src/rot-13.c @@ -67,7 +67,7 @@ rot13_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) { rot_13_private_t *priv = (rot_13_private_t *)this->private; @@ -100,8 +100,8 @@ rot13_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) { STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; diff --git a/xlators/features/filter/src/filter.c b/xlators/features/filter/src/filter.c index 1d5099113..0f5e67fb0 100644 --- a/xlators/features/filter/src/filter.c +++ b/xlators/features/filter/src/filter.c @@ -159,36 +159,36 @@ update_frame (call_frame_t *frame, /* if 'root' don't change the uid/gid */ static int32_t -update_stat (struct stat *stbuf, +update_stat (struct iatt *stbuf, struct gf_filter *filter) { int32_t idx = 0; for (idx = 0; idx < filter->translate_num_uid_entries; idx++) { - if (stbuf->st_uid == GF_FILTER_ROOT_UID) + if (stbuf->ia_uid == GF_FILTER_ROOT_UID) continue; - if ((stbuf->st_uid >= filter->translate_input_uid[idx][0]) && - (stbuf->st_uid <= filter->translate_input_uid[idx][1])) { - stbuf->st_uid = filter->translate_output_uid[idx]; + if ((stbuf->ia_uid >= filter->translate_input_uid[idx][0]) && + (stbuf->ia_uid <= filter->translate_input_uid[idx][1])) { + stbuf->ia_uid = filter->translate_output_uid[idx]; break; } } for (idx = 0; idx < filter->translate_num_gid_entries; idx++) { - if (stbuf->st_gid == GF_FILTER_ROOT_GID) + if (stbuf->ia_gid == GF_FILTER_ROOT_GID) continue; - if ((stbuf->st_gid >= filter->translate_input_gid[idx][0]) && - (stbuf->st_gid <= filter->translate_input_gid[idx][1])) { - stbuf->st_gid = filter->translate_output_gid[idx]; + if ((stbuf->ia_gid >= filter->translate_input_gid[idx][0]) && + (stbuf->ia_gid <= filter->translate_input_gid[idx][1])) { + stbuf->ia_gid = filter->translate_output_gid[idx]; break; } } if (filter->fixed_uid_set) { - stbuf->st_uid = filter->fixed_uid; + stbuf->ia_uid = filter->fixed_uid; } if (filter->fixed_gid_set) { - stbuf->st_gid = filter->fixed_gid; + stbuf->ia_gid = filter->fixed_gid; } return 0; @@ -201,14 +201,14 @@ filter_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 ret = 0; if (op_ret >= 0) { update_stat (buf, this->private); - ret = inode_ctx_put (inode, this, (uint64_t)(long)buf->st_uid); + ret = inode_ctx_put (inode, this, (uint64_t)(long)buf->ia_uid); if (ret == -1) { gf_log (this->name, GF_LOG_ERROR, "couldn't set context"); @@ -242,7 +242,7 @@ filter_stat_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct iatt *buf) { if (op_ret >= 0) { update_stat (buf, this->private); @@ -270,8 +270,8 @@ filter_setattr_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preop, - struct stat *postop) + struct iatt *preop, + struct iatt *postop) { if (op_ret >= 0) { update_stat (preop, this->private); @@ -285,7 +285,7 @@ int32_t filter_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct stat *stbuf, + struct iatt *stbuf, int32_t valid) { int32_t ret = 0; @@ -326,8 +326,8 @@ filter_fsetattr_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preop, - struct stat *postop) + struct iatt *preop, + struct iatt *postop) { if (op_ret >= 0) { update_stat (preop, this->private); @@ -344,7 +344,7 @@ int32_t filter_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct stat *stbuf, + struct iatt *stbuf, int32_t valid) { STACK_WIND (frame, @@ -363,8 +363,8 @@ filter_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) { if (op_ret >= 0) { update_stat (prebuf, this->private); @@ -415,8 +415,8 @@ filter_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) { if (op_ret >= 0) { update_stat (prebuf, this->private); @@ -449,7 +449,7 @@ filter_readlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, const char *path, - struct stat *sbuf) + struct iatt *sbuf) { if (op_ret >= 0) update_stat (sbuf, this->private); @@ -494,15 +494,15 @@ filter_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) { int ret = 0; if (op_ret >= 0) { update_stat (buf, this->private); - ret = inode_ctx_put (inode, this, (uint64_t)(long)buf->st_uid); + ret = inode_ctx_put (inode, this, (uint64_t)(long)buf->ia_uid); if (ret == -1) { gf_log (this->name, GF_LOG_ERROR, "couldn't set context"); @@ -560,14 +560,14 @@ filter_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) { int ret = 0; if (op_ret >= 0) { update_stat (buf, this->private); - ret = inode_ctx_put (inode, this, (uint64_t)(long)buf->st_uid); + ret = inode_ctx_put (inode, this, (uint64_t)(long)buf->ia_uid); if (ret == -1) { gf_log (this->name, GF_LOG_ERROR, "couldn't set context"); @@ -623,8 +623,8 @@ filter_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) { if (op_ret >= 0) { update_stat (preparent, this->private); @@ -679,8 +679,8 @@ filter_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) { if (op_ret >= 0) { update_stat (preparent, this->private); @@ -736,14 +736,14 @@ filter_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) { int ret = 0; if (op_ret >= 0) { update_stat (buf, this->private); - ret = inode_ctx_put (inode, this, (uint64_t)(long)buf->st_uid); + ret = inode_ctx_put (inode, this, (uint64_t)(long)buf->ia_uid); if (ret == -1) { gf_log (this->name, GF_LOG_ERROR, "couldn't set context"); @@ -800,11 +800,11 @@ filter_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) { if (op_ret >= 0) { update_stat (buf, this->private); @@ -875,14 +875,14 @@ filter_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) { int ret = 0; if (op_ret >= 0) { update_stat (buf, this->private); - ret = inode_ctx_put (inode, this, (uint64_t)(long)buf->st_uid); + ret = inode_ctx_put (inode, this, (uint64_t)(long)buf->ia_uid); if (ret == -1) { gf_log (this->name, GF_LOG_ERROR, "couldn't set context"); @@ -929,14 +929,14 @@ filter_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; if (op_ret >= 0) { update_stat (buf, this->private); - ret = inode_ctx_put (inode, this, (uint64_t)(long)buf->st_uid); + ret = inode_ctx_put (inode, this, (uint64_t)(long)buf->ia_uid); if (ret == -1) { gf_log (this->name, GF_LOG_ERROR, "couldn't set context"); @@ -1053,7 +1053,7 @@ filter_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) { if (op_ret >= 0) { @@ -1093,8 +1093,8 @@ filter_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) { if (op_ret >= 0) { update_stat (prebuf, this->private); @@ -1145,7 +1145,7 @@ filter_fstat_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct iatt *buf) { if (op_ret >= 0) { update_stat (buf, this->private); diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c index 3df1312e5..83800ff5a 100644 --- a/xlators/features/locks/src/common.c +++ b/xlators/features/locks/src/common.c @@ -410,7 +410,7 @@ pl_inode_get (xlator_t *this, inode_t *inode) { uint64_t tmp_pl_inode = 0; pl_inode_t *pl_inode = NULL; - mode_t st_mode = 0; +// mode_t st_mode = 0; int ret = 0; ret = inode_ctx_get (inode, this,&tmp_pl_inode); @@ -428,10 +428,11 @@ pl_inode_get (xlator_t *this, inode_t *inode) gf_log (this->name, GF_LOG_TRACE, "Allocating new pl inode"); +/* st_mode = inode->st_mode; if ((st_mode & S_ISGID) && !(st_mode & S_IXGRP)) pl_inode->mandatory = 1; - +*/ pthread_mutex_init (&pl_inode->mutex, NULL); diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index 06f4de17d..2e6afd9fc 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -58,8 +58,8 @@ struct _truncate_ops { int pl_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) { struct _truncate_ops *local = NULL; @@ -108,7 +108,7 @@ truncate_allowed (pl_inode_t *pl_inode, static int truncate_stat_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) { posix_locks_private_t *priv = NULL; struct _truncate_ops *local = NULL; @@ -442,8 +442,8 @@ pl_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, int pl_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) + fd_t *fd, inode_t *inode, struct iatt *buf, + struct iatt *preparent, struct iatt *postparent) { int dummy = 1; int ret = -1; @@ -478,7 +478,7 @@ pl_create (call_frame_t *frame, xlator_t *this, int pl_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 iovec *vector, int32_t count, struct iatt *stbuf, struct iobref *iobref) { STACK_UNWIND_STRICT (readv, frame, op_ret, op_errno, @@ -489,8 +489,8 @@ pl_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int pl_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) { STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, prebuf, postbuf); @@ -1090,9 +1090,9 @@ pl_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) { pl_local_t *local = NULL; diff --git a/xlators/features/path-convertor/src/path.c b/xlators/features/path-convertor/src/path.c index d58f0f3cb..3589e1485 100644 --- a/xlators/features/path-convertor/src/path.c +++ b/xlators/features/path-convertor/src/path.c @@ -134,9 +134,9 @@ path_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) { STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf); return 0; @@ -187,7 +187,7 @@ path_readlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, const char *buf, - struct stat *sbuf) + struct iatt *sbuf) { STACK_UNWIND (frame, op_ret, op_errno, buf, sbuf); return 0; @@ -200,9 +200,9 @@ path_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 *xattr, - struct stat *postparent) + struct iatt *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf, xattr); return 0; @@ -216,9 +216,9 @@ path_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) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -231,9 +231,9 @@ path_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) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -247,9 +247,9 @@ path_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) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -262,9 +262,9 @@ path_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) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -289,11 +289,11 @@ path_rename_buf_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) { STACK_UNWIND (frame, op_ret, op_errno, buf); return 0; @@ -307,7 +307,7 @@ path_common_buf_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct iatt *buf) { STACK_UNWIND (frame, op_ret, op_errno, buf); return 0; @@ -327,8 +327,8 @@ path_common_dict_cbk (call_frame_t *frame, int32_t path_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) + int32_t op_ret, int32_t op_errno,struct iatt *preparent, + struct iatt *postparent) { STACK_UNWIND (frame, op_ret, op_errno); return 0; @@ -336,8 +336,8 @@ path_common_remove_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t path_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) { STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -672,8 +672,8 @@ path_setattr_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *preop, - struct stat *postop) + struct iatt *preop, + struct iatt *postop) { STACK_UNWIND (frame, op_ret, op_errno, preop, postop); return 0; @@ -683,7 +683,7 @@ int32_t path_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct stat *stbuf, + struct iatt *stbuf, int32_t valid) { char *loc_path = (char *)loc->path; diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 193681821..822c29bd3 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -33,7 +33,7 @@ #endif struct quota_local { - struct stat stbuf; + struct iatt stbuf; inode_t *inode; char *path; fd_t *fd; @@ -153,8 +153,8 @@ gf_quota_check_free_disk (xlator_t *this) int quota_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) { struct quota_priv *priv = this->private; struct quota_local *local = NULL; @@ -162,8 +162,8 @@ quota_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local = frame->local; if ((op_ret >= 0) && priv->disk_usage_limit) { - gf_quota_usage_subtract (this, (local->stbuf.st_blocks - - postbuf->st_blocks) * 512); + gf_quota_usage_subtract (this, (local->stbuf.ia_blocks - + postbuf->ia_blocks) * 512); loc_wipe (&local->loc); } @@ -175,7 +175,7 @@ quota_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int quota_truncate_stat_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) { struct quota_local *local = NULL; struct quota_priv *priv = NULL; @@ -226,8 +226,8 @@ quota_truncate (call_frame_t *frame, xlator_t *this, int quota_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) { struct quota_priv *priv = NULL; struct quota_local *local = NULL; @@ -236,8 +236,8 @@ quota_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, priv = this->private; if ((op_ret >= 0) && priv->disk_usage_limit) { - gf_quota_usage_subtract (this, (local->stbuf.st_blocks - - postbuf->st_blocks) * 512); + gf_quota_usage_subtract (this, (local->stbuf.ia_blocks - + postbuf->ia_blocks) * 512); fd_unref (local->fd); } @@ -249,7 +249,7 @@ quota_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int quota_ftruncate_fstat_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) { struct quota_local *local = NULL; struct quota_priv *priv = NULL; @@ -302,15 +302,15 @@ quota_ftruncate (call_frame_t *frame, xlator_t *this, int quota_mknod_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) { struct quota_priv *priv = NULL; priv = this->private; if ((op_ret >= 0) && priv->disk_usage_limit) { - gf_quota_usage_add (this, buf->st_blocks * 512); + gf_quota_usage_add (this, buf->ia_blocks * 512); } STACK_UNWIND_STRICT (mknod, frame, op_ret, op_errno, inode, buf, @@ -356,15 +356,15 @@ quota_mknod (call_frame_t *frame, xlator_t *this, int quota_mkdir_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) { struct quota_priv *priv = NULL; priv = this->private; if ((op_ret >= 0) && priv->disk_usage_limit) { - gf_quota_usage_subtract (this, buf->st_blocks * 512); + gf_quota_usage_subtract (this, buf->ia_blocks * 512); } STACK_UNWIND_STRICT (mkdir, frame, op_ret, op_errno, inode, buf, @@ -410,8 +410,8 @@ quota_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode) int quota_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) { struct quota_local *local = NULL; @@ -420,7 +420,7 @@ quota_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (local) { if (op_ret >= 0) { gf_quota_usage_subtract (this, - local->stbuf.st_blocks * 512); + local->stbuf.ia_blocks * 512); } loc_wipe (&local->loc); } @@ -432,14 +432,14 @@ quota_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int quota_unlink_stat_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) { struct quota_local *local = NULL; local = frame->local; if (op_ret >= 0) { - if (buf->st_nlink == 1) { + if (buf->ia_nlink == 1) { local->stbuf = *buf; } } @@ -485,8 +485,8 @@ quota_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) int quota_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) { struct quota_local *local = NULL; @@ -494,7 +494,7 @@ quota_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (local) { if (op_ret >= 0) { - gf_quota_usage_subtract (this, local->stbuf.st_blocks * 512); + gf_quota_usage_subtract (this, local->stbuf.ia_blocks * 512); } loc_wipe (&local->loc); } @@ -506,7 +506,7 @@ quota_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int quota_rmdir_stat_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) { struct quota_local *local = NULL; @@ -556,15 +556,15 @@ quota_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc) int quota_symlink_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) { struct quota_priv *priv = NULL; priv = this->private; if ((op_ret >= 0) && priv->disk_usage_limit) { - gf_quota_usage_add (this, buf->st_blocks * 512); + gf_quota_usage_add (this, buf->ia_blocks * 512); } STACK_UNWIND_STRICT (symlink, frame, op_ret, op_errno, inode, buf, @@ -610,14 +610,14 @@ quota_symlink (call_frame_t *frame, xlator_t *this, int quota_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) + fd_t *fd, inode_t *inode, struct iatt *buf, + struct iatt *preparent, struct iatt *postparent) { struct quota_priv *priv = this->private; int ret = 0; if ((op_ret >= 0) && priv->disk_usage_limit) { - gf_quota_usage_add (this, buf->st_blocks * 512); + gf_quota_usage_add (this, buf->ia_blocks * 512); ret = fd_ctx_set (fd, this, 1); } @@ -690,8 +690,8 @@ quota_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, int quota_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) { struct quota_priv *priv = NULL; struct quota_local *local = NULL; @@ -702,8 +702,8 @@ quota_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (priv->disk_usage_limit) { if (op_ret >= 0) { - gf_quota_usage_add (this, (postbuf->st_blocks - - prebuf->st_blocks) * 512); + gf_quota_usage_add (this, (postbuf->ia_blocks - + prebuf->ia_blocks) * 512); } fd_unref (local->fd); iobref_unref (local->iobref); @@ -716,7 +716,7 @@ quota_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int quota_writev_fstat_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) { struct quota_local *local = NULL; struct quota_priv *priv = NULL; @@ -730,7 +730,7 @@ quota_writev_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (priv->current_disk_usage > priv->disk_usage_limit) { iovlen = iov_length (local->vector, local->count); - if (iovlen > (buf->st_blksize - (buf->st_size % buf->st_blksize))) { + if (iovlen > (buf->ia_blksize - (buf->ia_size % buf->ia_blksize))) { fd_unref (local->fd); iobref_unref (local->iobref); STACK_UNWIND_STRICT (writev, frame, -1, ENOSPC, @@ -978,9 +978,9 @@ quota_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) { STACK_UNWIND (frame, op_ret, diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c index aa5cea0d1..3d41ab798 100644 --- a/xlators/features/trash/src/trash.c +++ b/xlators/features/trash/src/trash.c @@ -29,24 +29,24 @@ int32_t trash_ftruncate_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 *iobuf); + struct iatt *stbuf, struct iobref *iobuf); int32_t trash_truncate_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); + struct iatt *prebuf, struct iatt *postbuf); int32_t trash_truncate_mkdir_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); + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent); int32_t trash_unlink_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); void trash_local_wipe (trash_local_t *local) @@ -71,7 +71,7 @@ out: int32_t trash_common_unwind_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) { TRASH_STACK_UNWIND (frame, op_ret, op_errno, preparent, postparent); return 0; @@ -80,8 +80,8 @@ trash_common_unwind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t trash_unlink_mkdir_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) + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent) { trash_local_t *local = NULL; char *tmp_str = NULL; @@ -175,14 +175,14 @@ out: int32_t trash_rename_mkdir_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); + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent); int32_t trash_unlink_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) { trash_local_t *local = NULL; trash_private_t *priv = NULL; @@ -254,7 +254,7 @@ trash_unlink_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t trash_common_unwind_buf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *prebuf, struct stat *postbuf) + struct iatt *prebuf, struct iatt *postbuf) { TRASH_STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -262,9 +262,9 @@ trash_common_unwind_buf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int trash_common_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) { TRASH_STACK_UNWIND (frame, op_ret, op_errno, stbuf, preoldparent, postoldparent, prenewparent, postnewparent); @@ -274,7 +274,7 @@ trash_common_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t trash_unlink_stat_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) { trash_private_t *priv = NULL; trash_local_t *local = NULL; @@ -289,15 +289,15 @@ trash_unlink_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto fail; } - if ((buf->st_size == 0) || - (buf->st_size > priv->max_trash_file_size)) { + if ((buf->ia_size == 0) || + (buf->ia_size > priv->max_trash_file_size)) { /* if the file is too big or zero, just unlink it */ - if (buf->st_size > priv->max_trash_file_size) { + if (buf->ia_size > priv->max_trash_file_size) { gf_log (this->name, GF_LOG_DEBUG, "%s: file size too big (%"GF_PRI_SIZET") to " "move into trash directory", - local->loc.path, buf->st_size); + local->loc.path, buf->ia_size); } STACK_WIND (frame, trash_common_unwind_cbk, @@ -325,9 +325,9 @@ fail: int32_t trash_rename_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) { trash_local_t *local = NULL; char *tmp_str = NULL; @@ -384,8 +384,8 @@ trash_rename_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t trash_rename_mkdir_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) + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent) { trash_local_t *local = NULL; char *tmp_str = NULL; @@ -447,8 +447,8 @@ out: int32_t trash_rename_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) + struct iatt *buf, dict_t *xattr, + struct iatt *postparent) { trash_private_t *priv = NULL; trash_local_t *local = NULL; @@ -464,15 +464,15 @@ trash_rename_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, &local->loc, &local->newloc); return 0; } - if ((buf->st_size == 0) || - (buf->st_size > priv->max_trash_file_size)) { + if ((buf->ia_size == 0) || + (buf->ia_size > priv->max_trash_file_size)) { /* if the file is too big or zero, just unlink it */ - if (buf->st_size > priv->max_trash_file_size) { + if (buf->ia_size > priv->max_trash_file_size) { gf_log (this->name, GF_LOG_DEBUG, "%s: file size too big (%"GF_PRI_SIZET") to " "move into trash directory", - local->newloc.path, buf->st_size); + local->newloc.path, buf->ia_size); } STACK_WIND (frame, trash_common_rename_cbk, @@ -639,7 +639,7 @@ trash_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) int32_t trash_truncate_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) { /* use this Function when a failure occurs, and delete the newly created file. */ @@ -664,7 +664,7 @@ int32_t trash_truncate_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 *iobuf) + struct iatt *stbuf, struct iobref *iobuf) { trash_local_t *local = NULL; @@ -681,7 +681,7 @@ trash_truncate_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto out; } - local->fsize = stbuf->st_size; + local->fsize = stbuf->ia_size; STACK_WIND (frame, trash_truncate_writev_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->writev, local->newfd, vector, count, local->cur_offset, iobuf); @@ -694,7 +694,7 @@ out: int32_t trash_truncate_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) + struct iatt *prebuf, struct iatt *postbuf) { trash_local_t *local = NULL; @@ -767,8 +767,8 @@ out: int32_t trash_truncate_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) { trash_local_t *local = NULL; char *tmp_str = NULL; @@ -830,8 +830,8 @@ out: int32_t trash_truncate_mkdir_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) + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent) { trash_local_t *local = NULL; char *tmp_str = NULL; @@ -883,11 +883,13 @@ trash_truncate_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dir_name = dirname (tmp_str); if (strcmp ((char*)cookie, dir_name) == 0) { flags = O_CREAT|O_EXCL|O_WRONLY; + ia_prot_t prot = {0, }; //Call create again once directory structure is created. STACK_WIND (frame, trash_truncate_create_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->create, - &local->newloc, flags, local->loc.inode->st_mode, + &local->newloc, flags, + st_mode_from_ia (prot, local->loc.inode->ia_type), local->newfd); goto out; } @@ -930,7 +932,7 @@ out: int32_t trash_truncate_stat_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) { trash_private_t *priv = NULL; trash_local_t *local = NULL; @@ -952,9 +954,9 @@ trash_truncate_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, return 0; } - if ((buf->st_size == 0) || (buf->st_size > priv->max_trash_file_size)) { + if ((buf->ia_size == 0) || (buf->ia_size > priv->max_trash_file_size)) { // If the file is too big, just unlink it. - if (buf->st_size > priv->max_trash_file_size) + if (buf->ia_size > priv->max_trash_file_size) gf_log (this->name, GF_LOG_DEBUG, "%s: file too big, " "not moving to trash", local->loc.path); @@ -988,7 +990,8 @@ trash_truncate_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, STACK_WIND (frame, trash_truncate_create_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->create, - &local->newloc, flags, local->loc.inode->st_mode, + &local->newloc, flags, + st_mode_from_ia (buf->ia_prot, local->loc.inode->ia_type), local->newfd); return 0; @@ -1057,7 +1060,7 @@ out: int32_t trash_ftruncate_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) { trash_local_t *local = NULL; @@ -1080,7 +1083,7 @@ trash_ftruncate_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t trash_ftruncate_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) + struct iatt *prebuf, struct iatt *postbuf) { trash_local_t *local = NULL; @@ -1114,12 +1117,12 @@ int32_t trash_ftruncate_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 *iobuf) + struct iatt *stbuf, struct iobref *iobuf) { trash_local_t *local = NULL; local = frame->local; - local->fsize = stbuf->st_size; + local->fsize = stbuf->ia_size; if (op_ret == -1) { STACK_WIND (frame, trash_ftruncate_unlink_cbk, @@ -1139,8 +1142,8 @@ trash_ftruncate_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t trash_ftruncate_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) { trash_local_t *local = NULL; char *tmp_str = NULL; @@ -1191,8 +1194,8 @@ trash_ftruncate_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t trash_ftruncate_mkdir_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) + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent) { trash_local_t *local = NULL; char *tmp_str = NULL; @@ -1243,6 +1246,7 @@ trash_ftruncate_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == 0) { dir_name = dirname (tmp_str); if (strcmp ((char*)cookie, dir_name) == 0) { + ia_prot_t prot = {0, }; flags = O_CREAT|O_EXCL|O_WRONLY; //Call create again once directory structure is created. @@ -1250,7 +1254,8 @@ trash_ftruncate_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, FIRST_CHILD(this), FIRST_CHILD(this)->fops->create, &local->newloc, flags, - local->loc.inode->st_mode, local->newfd); + st_mode_from_ia (prot, local->loc.inode->ia_type), + local->newfd); goto out; } } @@ -1292,7 +1297,7 @@ out: int32_t trash_ftruncate_fstat_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) { trash_private_t *priv = NULL; trash_local_t *local = NULL; @@ -1307,7 +1312,7 @@ trash_ftruncate_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, TRASH_STACK_UNWIND (frame, -1, op_errno, buf, NULL); return 0; } - if ((buf->st_size == 0) || (buf->st_size > priv->max_trash_file_size)) + if ((buf->ia_size == 0) || (buf->ia_size > priv->max_trash_file_size)) { STACK_WIND (frame, trash_common_unwind_buf_cbk, this->children->xlator, @@ -1320,7 +1325,8 @@ trash_ftruncate_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, STACK_WIND (frame, trash_ftruncate_create_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->create, &local->newloc, ( O_CREAT | O_EXCL | O_WRONLY ), - local->loc.inode->st_mode, local->newfd); + st_mode_from_ia (buf->ia_prot, local->loc.inode->ia_type), + local->newfd); return 0; } diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 2b93cfb98..1381d6f40 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -422,30 +422,30 @@ fail: /* courtesy of folly */ static void -stat2attr (struct stat *st, struct fuse_attr *fa) -{ - fa->ino = st->st_ino; - fa->size = st->st_size; - fa->blocks = st->st_blocks; - fa->atime = st->st_atime; - fa->mtime = st->st_mtime; - fa->ctime = st->st_ctime; - fa->atimensec = ST_ATIM_NSEC (st); - fa->mtimensec = ST_MTIM_NSEC (st); - fa->ctimensec = ST_CTIM_NSEC (st); - fa->mode = st->st_mode; - fa->nlink = st->st_nlink; - fa->uid = st->st_uid; - fa->gid = st->st_gid; - fa->rdev = st->st_rdev; - fa->blksize = st->st_blksize; +stat2attr (struct iatt *st, struct fuse_attr *fa) +{ + fa->ino = st->ia_ino; + fa->size = st->ia_size; + fa->blocks = st->ia_blocks; + fa->atime = st->ia_atime; + fa->mtime = st->ia_mtime; + fa->ctime = st->ia_ctime; + fa->atimensec = st->ia_atime_nsec; + fa->mtimensec = st->ia_mtime_nsec; + fa->ctimensec = st->ia_ctime_nsec; + fa->mode = st_mode_from_ia (st->ia_prot, st->ia_type); + fa->nlink = st->ia_nlink; + fa->uid = st->ia_uid; + fa->gid = st->ia_gid; + fa->rdev = st->ia_rdev; + fa->blksize = st->ia_blksize; } static int fuse_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) + inode_t *inode, struct iatt *buf) { fuse_state_t *state = NULL; fuse_in_header_t *finh = NULL; @@ -458,19 +458,19 @@ fuse_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, finh = state->finh; if (!op_ret && state->loc.ino == 1) { - buf->st_ino = 1; + buf->ia_ino = 1; } if (op_ret == 0) { gf_log ("glusterfs-fuse", GF_LOG_TRACE, "%"PRIu64": %s() %s => %"PRId64" (%"PRId64")", frame->root->unique, gf_fop_list[frame->root->op], - state->loc.path, buf->st_ino, state->loc.ino); + state->loc.path, buf->ia_ino, state->loc.ino); - buf->st_blksize = this->ctx->page_size; + buf->ia_blksize = this->ctx->page_size; stat2attr (buf, &feo.attr); - if (!buf->st_ino) { + if (!buf->ia_ino) { gf_log ("glusterfs-fuse", GF_LOG_WARNING, "%"PRIu64": %s() %s returning inode 0", frame->root->unique, @@ -531,8 +531,8 @@ fuse_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, static int fuse_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) { fuse_entry_cbk (frame, cookie, this, op_ret, op_errno, inode, buf); return 0; @@ -542,8 +542,8 @@ fuse_newentry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, static int fuse_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stat, dict_t *dict, - struct stat *postparent) + inode_t *inode, struct iatt *stat, dict_t *dict, + struct iatt *postparent) { fuse_state_t *state = NULL; call_frame_t *prev = NULL; @@ -632,8 +632,8 @@ fuse_forget (xlator_t *this, fuse_in_header_t *finh, void *msg) static int fuse_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) { fuse_state_t *state; fuse_in_header_t *finh; @@ -649,11 +649,11 @@ fuse_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "%"PRIu64": %s() %s => %"PRId64, frame->root->unique, gf_fop_list[frame->root->op], state->loc.path ? state->loc.path : "ERR", - prebuf->st_ino); + prebuf->ia_ino); /* TODO: make these timeouts configurable via meta */ /* TODO: what if the inode number has changed by now */ - postbuf->st_blksize = this->ctx->page_size; + postbuf->ia_blksize = this->ctx->page_size; stat2attr (postbuf, &fao.attr); fao.attr_valid = calc_timeout_sec (priv->attribute_timeout); @@ -683,7 +683,7 @@ fuse_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, static int fuse_attr_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) { fuse_state_t *state; fuse_in_header_t *finh; @@ -699,11 +699,11 @@ fuse_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "%"PRIu64": %s() %s => %"PRId64, frame->root->unique, gf_fop_list[frame->root->op], state->loc.path ? state->loc.path : "ERR", - buf->st_ino); + buf->ia_ino); /* TODO: make these timeouts configurable via meta */ /* TODO: what if the inode number has changed by now */ - buf->st_blksize = this->ctx->page_size; + buf->ia_blksize = this->ctx->page_size; stat2attr (buf, &fao.attr); fao.attr_valid = calc_timeout_sec (priv->attribute_timeout); @@ -734,8 +734,8 @@ fuse_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, static int fuse_root_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stat, dict_t *dict, - struct stat *postparent) + inode_t *inode, struct iatt *stat, dict_t *dict, + struct iatt *postparent) { fuse_attr_cbk (frame, cookie, this, op_ret, op_errno, stat); @@ -783,7 +783,7 @@ fuse_getattr (xlator_t *this, fuse_in_header_t *finh, void *msg) fd = fd_lookup (state->loc.inode, finh->pid); state->fd = fd; - if (!fd || S_ISDIR (state->loc.inode->st_mode)) { + if (!fd || IA_ISDIR (state->loc.inode->ia_type)) { /* this is the @ret of fuse_loc_fill, checked here to permit fstat() to happen even when fuse_loc_fill fails */ @@ -832,7 +832,7 @@ fuse_fd_cbk (call_frame_t *frame, void *cookie, xlator_t *this, foo.fh = (uintptr_t) fd; foo.open_flags = 0; - if (!S_ISDIR (fd->inode->st_mode)) { + if (!IA_ISDIR (fd->inode->ia_type)) { if (((state->flags & O_ACCMODE) != O_RDONLY) && priv->direct_io_mode) foo.open_flags |= FOPEN_DIRECT_IO; @@ -884,7 +884,7 @@ fuse_do_truncate (fuse_state_t *state, size_t size) static int fuse_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) + struct iatt *statpre, struct iatt *statpost) { fuse_state_t *state; fuse_in_header_t *finh; @@ -902,12 +902,12 @@ fuse_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "%"PRIu64": %s() %s => %"PRId64, frame->root->unique, gf_fop_list[frame->root->op], state->loc.path ? state->loc.path : "ERR", - statpost->st_ino); + statpost->ia_ino); /* TODO: make these timeouts configurable via meta */ /* TODO: what if the inode number has changed by now */ - statpost->st_blksize = this->ctx->page_size; + statpost->ia_blksize = this->ctx->page_size; stat2attr (statpost, &fao.attr); @@ -982,7 +982,7 @@ fuse_setattr (xlator_t *this, fuse_in_header_t *finh, void *msg) { struct fuse_setattr_in *fsi = msg; - struct stat attr = {0, }; + struct iatt attr = {0, }; fuse_private_t *priv = NULL; fuse_state_t *state = NULL; @@ -1046,15 +1046,15 @@ fuse_setattr (xlator_t *this, fuse_in_header_t *finh, void *msg) state->truncate_needed = _gf_true; } - attr.st_size = fsi->size; - attr.st_atime = fsi->atime; - attr.st_mtime = fsi->mtime; - ST_ATIM_NSEC_SET (&attr, fsi->atimensec); - ST_MTIM_NSEC_SET (&attr, fsi->mtimensec); + attr.ia_size = fsi->size; + attr.ia_atime = fsi->atime; + attr.ia_mtime = fsi->mtime; + attr.ia_atime_nsec = fsi->atimensec; + attr.ia_mtime_nsec = fsi->mtimensec; - attr.st_mode = fsi->mode; - attr.st_uid = fsi->uid; - attr.st_gid = fsi->gid; + attr.ia_prot = ia_prot_from_st_mode (fsi->mode); + attr.ia_uid = fsi->uid; + attr.ia_gid = fsi->gid; if (state->fd && !((fsi->valid & FATTR_ATIME) || (fsi->valid & FATTR_MTIME))) { @@ -1082,8 +1082,8 @@ fuse_setattr (xlator_t *this, fuse_in_header_t *finh, void *msg) static int gf_fuse_xattr_enotsup_log; static int fuse_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) { fuse_state_t *state = frame->root->state; fuse_in_header_t *finh = state->finh; @@ -1187,8 +1187,8 @@ fuse_err_cbk (call_frame_t *frame, void *cookie, xlator_t *this, static int fuse_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) { fuse_state_t *state = NULL; fuse_in_header_t *finh = NULL; @@ -1259,7 +1259,7 @@ fuse_access (xlator_t *this, fuse_in_header_t *finh, void *msg) static int fuse_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, const char *linkname, - struct stat *buf) + struct iatt *buf) { fuse_state_t *state = NULL; fuse_in_header_t *finh = NULL; @@ -1490,9 +1490,9 @@ fuse_symlink (xlator_t *this, fuse_in_header_t *finh, void *msg) int fuse_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) { fuse_state_t *state = NULL; fuse_in_header_t *finh = NULL; @@ -1502,18 +1502,18 @@ fuse_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == 0) { gf_log ("glusterfs-fuse", GF_LOG_TRACE, - "%"PRIu64": %s -> %s => 0 (buf->st_ino=%"PRId64" , loc->ino=%"PRId64")", + "%"PRIu64": %s -> %s => 0 (buf->ia_ino=%"PRId64" , loc->ino=%"PRId64")", frame->root->unique, state->loc.path, state->loc2.path, - buf->st_ino, state->loc.ino); + buf->ia_ino, state->loc.ino); { /* ugly ugly - to stay blind to situation where rename happens on a new inode */ - buf->st_ino = state->loc.ino; - buf->st_mode = state->loc.inode->st_mode; + buf->ia_ino = state->loc.ino; + buf->ia_type = state->loc.inode->ia_type; } - buf->st_blksize = this->ctx->page_size; + buf->ia_blksize = this->ctx->page_size; inode_rename (state->itable, state->loc.parent, state->loc.name, @@ -1627,8 +1627,8 @@ fuse_link (xlator_t *this, fuse_in_header_t *finh, void *msg) static int fuse_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) + fd_t *fd, inode_t *inode, struct iatt *buf, + struct iatt *preparent, struct iatt *postparent) { fuse_state_t *state = NULL; fuse_in_header_t *finh = NULL; @@ -1655,9 +1655,9 @@ fuse_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_log ("glusterfs-fuse", GF_LOG_TRACE, "%"PRIu64": %s() %s => %p (ino=%"PRId64")", frame->root->unique, gf_fop_list[frame->root->op], - state->loc.path, fd, buf->st_ino); + state->loc.path, fd, buf->ia_ino); - buf->st_blksize = this->ctx->page_size; + buf->ia_blksize = this->ctx->page_size; stat2attr (buf, &feo.attr); linked_inode = inode_link (inode, state->loc.parent, @@ -1815,7 +1815,7 @@ static int fuse_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) { fuse_state_t *state = NULL; fuse_in_header_t *finh = NULL; @@ -1829,7 +1829,7 @@ fuse_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_log ("glusterfs-fuse", GF_LOG_TRACE, "%"PRIu64": READ => %d/%"GF_PRI_SIZET",%"PRId64"/%"PRId64, frame->root->unique, - op_ret, state->size, state->off, stbuf->st_size); + op_ret, state->size, state->off, stbuf->ia_size); iov_out = CALLOC (count + 1, sizeof (*iov_out)); if (iov_out) { @@ -1890,7 +1890,7 @@ fuse_readv (xlator_t *this, fuse_in_header_t *finh, void *msg) static int fuse_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf, struct stat *postbuf) + struct iatt *stbuf, struct iatt *postbuf) { fuse_state_t *state = NULL; fuse_in_header_t *finh = NULL; @@ -1903,7 +1903,7 @@ fuse_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_log ("glusterfs-fuse", GF_LOG_TRACE, "%"PRIu64": WRITE => %d/%"GF_PRI_SIZET",%"PRId64"/%"PRId64, frame->root->unique, - op_ret, state->size, state->off, stbuf->st_size); + op_ret, state->size, state->off, stbuf->ia_size); fwo.size = op_ret; send_fuse_obj (this, finh, &fwo); @@ -2131,29 +2131,29 @@ fuse_opendir (xlator_t *this, fuse_in_header_t *finh, void *msg) unsigned char -d_type_from_stat (struct stat *buf) +d_type_from_stat (struct iatt *buf) { unsigned char d_type; - if (S_ISLNK (buf->st_mode)) { + if (IA_ISLNK (buf->ia_type)) { d_type = DT_LNK; - } else if (S_ISDIR (buf->st_mode)) { + } else if (IA_ISDIR (buf->ia_type)) { d_type = DT_DIR; - } else if (S_ISFIFO (buf->st_mode)) { + } else if (IA_ISFIFO (buf->ia_type)) { d_type = DT_FIFO; - } else if (S_ISSOCK (buf->st_mode)) { + } else if (IA_ISSOCK (buf->ia_type)) { d_type = DT_SOCK; - } else if (S_ISCHR (buf->st_mode)) { + } else if (IA_ISCHR (buf->ia_type)) { d_type = DT_CHR; - } else if (S_ISBLK (buf->st_mode)) { + } else if (IA_ISBLK (buf->ia_type)) { d_type = DT_BLK; - } else if (S_ISREG (buf->st_mode)) { + } else if (IA_ISREG (buf->ia_type)) { d_type = DT_REG; } else { @@ -2316,7 +2316,7 @@ fuse_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, Scale the block counts to match ->f_bsize. */ - /* TODO: with old coreutils, f_bsize is taken from stat()'s st_blksize + /* TODO: with old coreutils, f_bsize is taken from stat()'s ia_blksize * so the df with old coreutils this wont work :( */ @@ -2974,8 +2974,8 @@ static fuse_handler_t *fuse_ops[FUSE_713_OP_HIGH]; int fuse_first_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) { fuse_private_t *priv = NULL; diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index beb2e0ccc..2e523b15b 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -149,7 +149,7 @@ ioc_inode_flush (ioc_inode_t *ioc_inode) int32_t ioc_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) { STACK_UNWIND_STRICT (setattr, frame, op_ret, op_errno, preop, postop); return 0; @@ -157,7 +157,7 @@ ioc_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t ioc_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { uint64_t ioc_inode = 0; @@ -177,7 +177,7 @@ ioc_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t ioc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf, dict_t *dict, struct stat *postparent) + struct iatt *stbuf, dict_t *dict, struct iatt *postparent) { ioc_inode_t *ioc_inode = NULL; ioc_table_t *table = this->private; @@ -219,10 +219,10 @@ ioc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, ioc_inode_lock (ioc_inode); { if (ioc_inode->cache.mtime == 0) { - ioc_inode->cache.mtime = stbuf->st_mtime; + ioc_inode->cache.mtime = stbuf->ia_mtime; } - ioc_inode->st_size = stbuf->st_size; + ioc_inode->ia_size = stbuf->ia_size; } ioc_inode_unlock (ioc_inode); @@ -321,12 +321,12 @@ ioc_forget (xlator_t *this, inode_t *inode) */ int32_t ioc_cache_validate_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) { ioc_local_t *local = NULL; ioc_inode_t *ioc_inode = NULL; size_t destroy_size = 0; - struct stat *local_stbuf = NULL; + struct iatt *local_stbuf = NULL; local = frame->local; ioc_inode = local->inode; @@ -345,7 +345,7 @@ ioc_cache_validate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { destroy_size = __ioc_inode_flush (ioc_inode); if (op_ret >= 0) - ioc_inode->cache.mtime = stbuf->st_mtime; + ioc_inode->cache.mtime = stbuf->ia_mtime; } ioc_inode_unlock (ioc_inode); local_stbuf = NULL; @@ -536,21 +536,14 @@ ioc_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, ioc_inode_lock (ioc_inode); { - if ((table->min_file_size > ioc_inode->st_size) + if ((table->min_file_size > ioc_inode->ia_size) || ((table->max_file_size >= 0) - && (table->max_file_size < ioc_inode->st_size))) { + && (table->max_file_size < ioc_inode->ia_size))) { fd_ctx_set (fd, this, 1); } } ioc_inode_unlock (ioc_inode); - /* If mandatory locking has been enabled on this file, - we disable caching on it */ - if (((inode->st_mode & S_ISGID) - && !(inode->st_mode & S_IXGRP))) { - fd_ctx_set (fd, this, 1); - } - /* If O_DIRECT open, we disable caching on it */ if ((local->flags & O_DIRECT)){ /* O_DIRECT is only for one fd, not the inode @@ -591,8 +584,8 @@ ioc_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t ioc_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) { ioc_local_t *local = NULL; ioc_table_t *table = NULL; @@ -612,12 +605,12 @@ ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, ioc_inode_lock (ioc_inode); { - ioc_inode->cache.mtime = buf->st_mtime; - ioc_inode->st_size = buf->st_size; + ioc_inode->cache.mtime = buf->ia_mtime; + ioc_inode->ia_size = buf->ia_size; - if ((table->min_file_size > ioc_inode->st_size) + if ((table->min_file_size > ioc_inode->ia_size) || ((table->max_file_size >= 0) - && (table->max_file_size < ioc_inode->st_size))) { + && (table->max_file_size < ioc_inode->ia_size))) { fd_ctx_set (fd, this, 1); } } @@ -626,15 +619,6 @@ ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, inode_ctx_put (fd->inode, this, (uint64_t)(long)ioc_inode); - /* - * If mandatory locking has been enabled on this file, - * we disable caching on it - */ - if ((inode->st_mode & S_ISGID) && - !(inode->st_mode & S_IXGRP)) { - fd_ctx_set (fd, this, 1); - } - /* If O_DIRECT open, we disable caching on it */ if (local->flags & O_DIRECT){ /* @@ -760,7 +744,7 @@ ioc_release (xlator_t *this, fd_t *fd) int32_t ioc_readv_disabled_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, + int32_t count, struct iatt *stbuf, struct iobref *iobref) { STACK_UNWIND_STRICT (readv, frame, op_ret, op_errno, vector, count, @@ -1082,8 +1066,8 @@ out: */ int32_t ioc_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) { ioc_local_t *local = NULL; uint64_t ioc_inode = 0; @@ -1153,8 +1137,8 @@ ioc_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, */ int32_t ioc_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) { STACK_UNWIND_STRICT (truncate, frame, op_ret, op_errno, prebuf, @@ -1176,8 +1160,8 @@ ioc_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int32_t ioc_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) { STACK_UNWIND_STRICT (ftruncate, frame, op_ret, op_errno, prebuf, diff --git a/xlators/performance/io-cache/src/io-cache.h b/xlators/performance/io-cache/src/io-cache.h index b1e061eee..15a2828bb 100644 --- a/xlators/performance/io-cache/src/io-cache.h +++ b/xlators/performance/io-cache/src/io-cache.h @@ -141,7 +141,7 @@ struct ioc_cache { struct ioc_inode { struct ioc_table *table; - off_t st_size; + off_t ia_size; struct ioc_cache cache; struct list_head inode_list; /* * list of inodes, maintained by @@ -191,7 +191,7 @@ ptr_to_str (void *ptr); int32_t ioc_readv_disabled_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, + int32_t count, struct iatt *stbuf, struct iobref *iobref); ioc_page_t * @@ -325,10 +325,10 @@ ioc_inode_flush (ioc_inode_t *ioc_inode); void ioc_inode_wakeup (call_frame_t *frame, ioc_inode_t *ioc_inode, - struct stat *stbuf); + struct iatt *stbuf); int8_t -ioc_cache_still_valid (ioc_inode_t *ioc_inode, struct stat *stbuf); +ioc_cache_still_valid (ioc_inode_t *ioc_inode, struct iatt *stbuf); int32_t ioc_prune (ioc_table_t *table); diff --git a/xlators/performance/io-cache/src/ioc-inode.c b/xlators/performance/io-cache/src/ioc-inode.c index 74c657fe7..763f329db 100644 --- a/xlators/performance/io-cache/src/ioc-inode.c +++ b/xlators/performance/io-cache/src/ioc-inode.c @@ -62,7 +62,7 @@ ptr_to_str (void *ptr) void ioc_inode_wakeup (call_frame_t *frame, ioc_inode_t *ioc_inode, - struct stat *stbuf) + struct iatt *stbuf) { ioc_waitq_t *waiter = NULL, *waited = NULL; ioc_waitq_t *page_waitq = NULL; diff --git a/xlators/performance/io-cache/src/page.c b/xlators/performance/io-cache/src/page.c index fc0eba101..c4cc8f060 100644 --- a/xlators/performance/io-cache/src/page.c +++ b/xlators/performance/io-cache/src/page.c @@ -282,17 +282,17 @@ out: * assumes ioc_inode is locked */ int8_t -ioc_cache_still_valid (ioc_inode_t *ioc_inode, struct stat *stbuf) +ioc_cache_still_valid (ioc_inode_t *ioc_inode, struct iatt *stbuf) { int8_t cache_still_valid = 1; #if 0 - if (!stbuf || (stbuf->st_mtime != ioc_inode->cache.mtime) || + if (!stbuf || (stbuf->ia_mtime != ioc_inode->cache.mtime) || (stbuf->st_mtim.tv_nsec != ioc_inode->stbuf.st_mtim.tv_nsec)) cache_still_valid = 0; #else - if (!stbuf || (stbuf->st_mtime != ioc_inode->cache.mtime)) + if (!stbuf || (stbuf->ia_mtime != ioc_inode->cache.mtime)) cache_still_valid = 0; #endif @@ -301,7 +301,7 @@ ioc_cache_still_valid (ioc_inode_t *ioc_inode, struct stat *stbuf) /* talk with avati@gluster.com to enable this section */ if (!ioc_inode->mtime && stbuf) { cache_still_valid = 1; - ioc_inode->mtime = stbuf->st_mtime; + ioc_inode->mtime = stbuf->ia_mtime; } #endif @@ -329,7 +329,7 @@ ioc_waitq_return (ioc_waitq_t *waitq) int ioc_fault_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) { ioc_local_t *local = NULL; off_t offset = 0; @@ -353,7 +353,7 @@ ioc_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this, payload_size = op_ret; zero_filled = ((op_ret >=0) - && (stbuf->st_mtime == 0)); + && (stbuf->ia_mtime == 0)); ioc_inode_lock (ioc_inode); { @@ -367,7 +367,7 @@ ioc_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } if ((op_ret >= 0) && !zero_filled) - ioc_inode->cache.mtime = stbuf->st_mtime; + ioc_inode->cache.mtime = stbuf->ia_mtime; gettimeofday (&ioc_inode->cache.tv, NULL); @@ -695,7 +695,7 @@ ioc_frame_unwind (call_frame_t *frame) struct iovec *vector = NULL; int32_t copied = 0; struct iobref *iobref = NULL; - struct stat stbuf = {0,}; + struct iatt stbuf = {0,}; int32_t op_ret = 0, op_errno = 0; local = frame->local; diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index feae1439e..5ef716733 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -162,8 +162,8 @@ iot_schedule_ordered (iot_conf_t *conf, inode_t *inode, call_stub_t *stub) int iot_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) { STACK_UNWIND_STRICT (lookup, frame, op_ret, op_errno, inode, buf, xattr, postparent); @@ -216,7 +216,7 @@ out: int iot_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) { STACK_UNWIND_STRICT (setattr, frame, op_ret, op_errno, preop, postop); return 0; @@ -225,7 +225,7 @@ iot_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int iot_setattr_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { STACK_WIND (frame, iot_setattr_cbk, FIRST_CHILD (this), @@ -237,7 +237,7 @@ iot_setattr_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, int iot_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { call_stub_t *stub = NULL; int ret = -1; @@ -269,7 +269,7 @@ out: int iot_fsetattr_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) { STACK_UNWIND_STRICT (fsetattr, frame, op_ret, op_errno, preop, postop); return 0; @@ -278,7 +278,7 @@ iot_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int iot_fsetattr_wrapper (call_frame_t *frame, xlator_t *this, - fd_t *fd, struct stat *stbuf, int32_t valid) + fd_t *fd, struct iatt *stbuf, int32_t valid) { STACK_WIND (frame, iot_fsetattr_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->fsetattr, fd, stbuf, valid); @@ -288,7 +288,7 @@ iot_fsetattr_wrapper (call_frame_t *frame, xlator_t *this, int iot_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { call_stub_t *stub = NULL; int ret = -1; @@ -366,7 +366,7 @@ out: int iot_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, const char *path, - struct stat *stbuf) + struct iatt *stbuf) { STACK_UNWIND_STRICT (readlink, frame, op_ret, op_errno, path, stbuf); return 0; @@ -418,8 +418,8 @@ out: int iot_mknod_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_STRICT (mknod, frame, op_ret, op_errno, inode, buf, preparent, postparent); @@ -471,8 +471,8 @@ out: int iot_mkdir_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_STRICT (mkdir, frame, op_ret, op_errno, inode, buf, preparent, postparent); @@ -521,8 +521,8 @@ out: int iot_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) { STACK_UNWIND_STRICT (rmdir, frame, op_ret, op_errno, preparent, postparent); @@ -570,8 +570,8 @@ out: int iot_symlink_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_STRICT (symlink, frame, op_ret, op_errno, inode, buf, preparent, postparent); @@ -622,9 +622,9 @@ out: int iot_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) { STACK_UNWIND_STRICT (rename, frame, op_ret, op_errno, buf, preoldparent, postoldparent, prenewparent, postnewparent); @@ -726,8 +726,8 @@ out: int iot_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 *stbuf, struct stat *preparent, - struct stat *postparent) + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent) { STACK_UNWIND_STRICT (create, frame, op_ret, op_errno, fd, inode, stbuf, preparent, postparent); @@ -784,7 +784,7 @@ out: int iot_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) { STACK_UNWIND_STRICT (readv, frame, op_ret, op_errno, vector, count, stbuf, iobref); @@ -887,8 +887,8 @@ out: int iot_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) { STACK_UNWIND_STRICT (fsync, frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -939,8 +939,8 @@ out: int iot_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) { STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -1048,7 +1048,7 @@ out: int iot_stat_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_STRICT (stat, frame, op_ret, op_errno, buf); return 0; @@ -1108,7 +1108,7 @@ out: int iot_fstat_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_STRICT (fstat, frame, op_ret, op_errno, buf); return 0; @@ -1157,8 +1157,8 @@ out: int iot_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) { STACK_UNWIND_STRICT (truncate, frame, op_ret, op_errno, prebuf, postbuf); @@ -1220,8 +1220,8 @@ out: int iot_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) { STACK_UNWIND_STRICT (ftruncate, frame, op_ret, op_errno, prebuf, postbuf); @@ -1324,8 +1324,8 @@ out: int iot_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) { STACK_UNWIND_STRICT (unlink, frame, op_ret, op_errno, preparent, postparent); @@ -1378,7 +1378,7 @@ out: int iot_link_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_STRICT (link, frame, op_ret, op_errno, inode, buf, preparent, postparent); diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c index 5dd33486c..36cfc42b4 100644 --- a/xlators/performance/quick-read/src/quick-read.c +++ b/xlators/performance/quick-read/src/quick-read.c @@ -150,7 +150,7 @@ out: int32_t qr_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) { data_t *content = NULL; qr_file_t *qr_file = NULL; @@ -164,11 +164,11 @@ qr_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, conf = this->private; - if (buf->st_size > conf->max_file_size) { + if (buf->ia_size > conf->max_file_size) { goto out; } - if (S_ISDIR (buf->st_mode)) { + if (IA_ISDIR (buf->ia_type)) { goto out; } @@ -215,7 +215,7 @@ unlock: LOCK (&qr_file->lock); { if (qr_file->xattr - && (qr_file->stbuf.st_mtime != buf->st_mtime)) { + && (qr_file->stbuf.ia_mtime != buf->ia_mtime)) { dict_unref (qr_file->xattr); qr_file->xattr = NULL; } @@ -546,7 +546,7 @@ qr_need_validation (qr_conf_t *conf, qr_file_t *file) static int32_t qr_validate_cache_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) { qr_file_t *qr_file = NULL; qr_local_t *local = NULL; @@ -580,7 +580,7 @@ qr_validate_cache_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&qr_file->lock); { - if (qr_file->stbuf.st_mtime != buf->st_mtime) { + if (qr_file->stbuf.ia_mtime != buf->ia_mtime) { dict_unref (qr_file->xattr); qr_file->xattr = NULL; } @@ -729,7 +729,7 @@ out: int32_t qr_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_STRICT (readv, frame, op_ret, op_errno, vector, count, stbuf, iobref); @@ -759,7 +759,7 @@ qr_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, char need_open = 0, can_wind = 0, need_unwind = 0; struct iobuf *iobuf = NULL; struct iobref *iobref = NULL; - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; data_t *content = NULL; qr_fd_ctx_t *qr_fd_ctx = NULL; call_stub_t *stub = NULL; @@ -978,8 +978,8 @@ out: int32_t qr_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) { STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -1098,7 +1098,7 @@ out: int32_t qr_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno, struct stat *buf) + int32_t op_errno, struct iatt *buf) { STACK_UNWIND_STRICT (fstat, frame, op_ret, op_errno, buf); return 0; @@ -1195,7 +1195,7 @@ out: int32_t qr_fsetattr_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) { STACK_UNWIND_STRICT (fsetattr, frame, op_ret, op_errno, preop, postop); return 0; @@ -1204,7 +1204,7 @@ qr_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t qr_fsetattr_helper (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { STACK_WIND(frame, qr_fsetattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsetattr, fd, stbuf, @@ -1215,7 +1215,7 @@ qr_fsetattr_helper (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t qr_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { uint64_t value = 0; int flags = 0; @@ -1765,7 +1765,7 @@ out: int32_t qr_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_errno, struct iatt *prebuf, struct iatt *postbuf) { STACK_UNWIND_STRICT (fsync, frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -1859,8 +1859,8 @@ out: int32_t qr_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) { int32_t ret = 0; uint64_t value = 0; @@ -1886,7 +1886,7 @@ qr_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (qr_file) { LOCK (&qr_file->lock); { - if (qr_file->stbuf.st_size != postbuf->st_size) + if (qr_file->stbuf.ia_size != postbuf->ia_size) { dict_unref (qr_file->xattr); qr_file->xattr = NULL; diff --git a/xlators/performance/quick-read/src/quick-read.h b/xlators/performance/quick-read/src/quick-read.h index 5ced44e1d..e5bca6376 100644 --- a/xlators/performance/quick-read/src/quick-read.h +++ b/xlators/performance/quick-read/src/quick-read.h @@ -66,7 +66,7 @@ typedef struct qr_local qr_local_t; struct qr_file { dict_t *xattr; - struct stat stbuf; + struct iatt stbuf; struct timeval tv; gf_lock_t lock; }; diff --git a/xlators/performance/read-ahead/src/page.c b/xlators/performance/read-ahead/src/page.c index 07ab84ed8..063258c8f 100644 --- a/xlators/performance/read-ahead/src/page.c +++ b/xlators/performance/read-ahead/src/page.c @@ -131,7 +131,7 @@ ra_waitq_return (ra_waitq_t *waitq) int ra_fault_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) { ra_local_t *local = NULL; off_t pending_offset = 0; diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c index 8e140d821..c0a432582 100644 --- a/xlators/performance/read-ahead/src/read-ahead.c +++ b/xlators/performance/read-ahead/src/read-ahead.c @@ -70,12 +70,6 @@ ra_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, ret = fd_ctx_set (fd, this, (uint64_t)(long)file); - /* If mandatory locking has been enabled on this file, - we disable caching on it */ - - if ((fd->inode->st_mode & S_ISGID) && !(fd->inode->st_mode & S_IXGRP)) - file->disabled = 1; - /* If O_DIRECT open, we disable caching on it */ if ((fd->flags & O_DIRECT) || ((fd->flags & O_ACCMODE) == O_WRONLY)) @@ -122,8 +116,8 @@ unwind: int ra_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) + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent) { ra_conf_t *conf = NULL; ra_file_t *file = NULL; @@ -146,19 +140,13 @@ ra_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, ret = fd_ctx_set (fd, this, (uint64_t)(long)file); - /* If mandatory locking has been enabled on this file, - we disable caching on it */ - - if ((fd->inode->st_mode & S_ISGID) && !(fd->inode->st_mode & S_IXGRP)) - file->disabled = 1; - /* If O_DIRECT open, we disable caching on it */ if ((fd->flags & O_DIRECT) || ((fd->flags & O_ACCMODE) == O_WRONLY)) file->disabled = 1; file->offset = (unsigned long long) 0; - //file->size = fd->inode->buf.st_size; + //file->size = fd->inode->buf.ia_size; file->conf = conf; file->pages.next = &file->pages; file->pages.prev = &file->pages; @@ -330,7 +318,7 @@ read_ahead (call_frame_t *frame, ra_file_t *file) int ra_need_atime_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) { STACK_DESTROY (frame->root); return 0; @@ -425,7 +413,7 @@ out: int ra_readv_disabled_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) { STACK_UNWIND_STRICT (readv, frame, op_ret, op_errno, vector, count, stbuf, iobref); @@ -543,7 +531,7 @@ ra_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int ra_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_errno, struct iatt *prebuf, struct iatt *postbuf) { STACK_UNWIND_STRICT (fsync, frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -616,8 +604,8 @@ unwind: int ra_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) { fd_t *fd = NULL; ra_file_t *file = NULL; @@ -677,8 +665,8 @@ unwind: int ra_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) { STACK_UNWIND_STRICT (truncate, frame, op_ret, op_errno, prebuf, postbuf); @@ -688,7 +676,7 @@ ra_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int ra_attr_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_STRICT (stat, frame, op_ret, op_errno, buf); return 0; diff --git a/xlators/performance/read-ahead/src/read-ahead.h b/xlators/performance/read-ahead/src/read-ahead.h index d11143551..0ad47fc75 100644 --- a/xlators/performance/read-ahead/src/read-ahead.h +++ b/xlators/performance/read-ahead/src/read-ahead.h @@ -98,7 +98,7 @@ struct ra_file { size_t size; int32_t refcount; pthread_mutex_t file_lock; - struct stat stbuf; + struct iatt stbuf; uint64_t page_size; uint32_t page_count; }; diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index ef2fc43b2..b3777cb76 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -87,7 +87,7 @@ out: int sp_update_inode_ctx (xlator_t *this, inode_t *inode, int32_t *op_ret, int32_t *op_errno, char *lookup_in_progress, - char *looked_up, struct stat *stbuf, + char *looked_up, struct iatt *stbuf, struct list_head *waiting_ops, int32_t *error) { int32_t ret = 0; @@ -127,7 +127,7 @@ sp_update_inode_ctx (xlator_t *this, inode_t *inode, int32_t *op_ret, } if ((op_ret == 0) && (stbuf != NULL) - && S_ISDIR (stbuf->st_mode)) { + && IA_ISDIR (stbuf->ia_type)) { memcpy (&inode_ctx->stbuf, stbuf, sizeof (*stbuf)); } @@ -695,7 +695,7 @@ sp_cache_add_entries (sp_cache_t *cache, gf_dirent_t *entries) LOCK (&cache->lock); { list_for_each_entry (entry, &entries->list, list) { - if (S_ISDIR (entry->d_stat.st_mode)) { + if (IA_ISDIR (entry->d_stat.ia_type)) { continue; } @@ -734,7 +734,7 @@ unlock: int32_t sp_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) { int ret = 0; struct list_head waiting_ops = {0, }; @@ -972,7 +972,7 @@ sp_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req) uint64_t value = 0; char xattr_req_empty = 1, can_wind = 0; sp_cache_t *cache = NULL; - struct stat postparent = {0, }, buf = {0, }; + struct iatt postparent = {0, }, buf = {0, }; int32_t ret = -1, op_ret = -1, op_errno = EINVAL; sp_inode_ctx_t *inode_ctx = NULL, *parent_inode_ctx = NULL; sp_local_t *local = NULL; @@ -1017,7 +1017,7 @@ sp_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req) FREE (dirent); } - } else if (S_ISDIR (loc->inode->st_mode)) { + } else if (IA_ISDIR (loc->inode->ia_type)) { cache = sp_get_cache_inode (this, loc->inode, frame->root->pid); if (cache) { ret = sp_cache_get_entry (cache, ".", &dirent); @@ -1230,8 +1230,8 @@ unwind: int32_t sp_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) { SP_STACK_UNWIND (truncate, frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -1241,9 +1241,9 @@ sp_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t sp_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) { SP_STACK_UNWIND (rename, frame, op_ret, op_errno, buf, preoldparent, postoldparent, prenewparent, postnewparent); @@ -1381,8 +1381,8 @@ out: static int32_t sp_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) + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent) { sp_local_t *local = NULL; sp_fd_ctx_t *fd_ctx = NULL; @@ -1582,8 +1582,8 @@ out: int32_t sp_new_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) { sp_local_t *local = NULL; char lookup_in_progress = 0, looked_up = 0; @@ -1807,8 +1807,8 @@ out: int32_t sp_link_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) { SP_STACK_UNWIND (link, frame, op_ret, op_errno, inode, buf, preparent, postparent); @@ -2049,7 +2049,7 @@ unwind: int32_t sp_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *prestat, struct stat *poststat) + struct iatt *prestat, struct iatt *poststat) { SP_STACK_UNWIND (setattr, frame, op_ret, op_errno, prestat, poststat); return 0; @@ -2058,7 +2058,7 @@ sp_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int sp_setattr_helper (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) { uint64_t value = 0; sp_inode_ctx_t *inode_ctx = NULL; @@ -2100,7 +2100,7 @@ unwind: int sp_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) { sp_cache_t *cache = NULL; int32_t op_errno = -1; @@ -2149,7 +2149,7 @@ out: int32_t sp_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, const char *path, - struct stat *buf) + struct iatt *buf) { SP_STACK_UNWIND (readlink, frame, op_ret, op_errno, path, buf); return 0; @@ -2247,8 +2247,8 @@ out: int32_t sp_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) { SP_STACK_UNWIND (unlink, frame, op_ret, op_errno, preparent, postparent); @@ -2487,7 +2487,7 @@ out: int32_t sp_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) { SP_STACK_UNWIND (readv, frame, op_ret, op_errno, vector, count, stbuf, iobref); @@ -2754,7 +2754,7 @@ sp_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc,loc_t *newloc) goto out; } - if (S_ISDIR (oldloc->inode->st_mode)) { + if (IA_ISDIR (oldloc->inode->ia_type)) { sp_remove_caches_from_all_fds_opened (this, oldloc->inode); } @@ -3178,7 +3178,7 @@ sp_getdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this, cache = sp_get_cache_fd (this, local->fd); if (cache) { for (trav = entries->next; trav; trav = trav->next) { - if (S_ISLNK (trav->buf.st_mode)) { + if (IA_ISLNK (trav->buf.ia_type)) { sp_cache_remove_entry (cache, trav->name, 0); } } @@ -3476,7 +3476,7 @@ unwind: int32_t sp_stbuf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno, struct stat *buf) + int32_t op_errno, struct iatt *buf) { STACK_UNWIND (frame, op_ret, op_errno, buf); return 0; @@ -3812,7 +3812,7 @@ out: int32_t sp_forget (xlator_t *this, inode_t *inode) { - struct stat *buf = NULL; + struct iatt *buf = NULL; uint64_t value = 0; inode_ctx_del (inode, this, &value); diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.h b/xlators/performance/stat-prefetch/src/stat-prefetch.h index 3fcf4a0a6..9ff2899a9 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.h +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.h @@ -73,7 +73,7 @@ struct sp_inode_ctx { char need_unwind; int32_t op_ret; int32_t op_errno; - struct stat stbuf; + struct iatt stbuf; gf_lock_t lock; struct list_head waiting_ops; }; diff --git a/xlators/performance/symlink-cache/src/symlink-cache.c b/xlators/performance/symlink-cache/src/symlink-cache.c index 22b1c5482..a8c89b864 100644 --- a/xlators/performance/symlink-cache/src/symlink-cache.c +++ b/xlators/performance/symlink-cache/src/symlink-cache.c @@ -90,7 +90,7 @@ sc_cache_update (xlator_t *this, inode_t *inode, const char *link) int -sc_cache_set (xlator_t *this, inode_t *inode, struct stat *buf, +sc_cache_set (xlator_t *this, inode_t *inode, struct iatt *buf, const char *link) { struct symlink_cache *sc = NULL; @@ -126,7 +126,7 @@ sc_cache_set (xlator_t *this, inode_t *inode, struct stat *buf, } } - sc->ctime = buf->st_ctime; + sc->ctime = buf->ia_ctime; gf_log (this->name, GF_LOG_DEBUG, "setting symlink cache: %s", link); @@ -180,12 +180,12 @@ sc_cache_flush (xlator_t *this, inode_t *inode) int -sc_cache_validate (xlator_t *this, inode_t *inode, struct stat *buf) +sc_cache_validate (xlator_t *this, inode_t *inode, struct iatt *buf) { struct symlink_cache *sc = NULL; uint64_t tmp_sc = 0; - if (!S_ISLNK (buf->st_mode)) { + if (!IA_ISLNK (buf->ia_type)) { sc_cache_flush (this, inode); return 0; } @@ -204,7 +204,7 @@ sc_cache_validate (xlator_t *this, inode_t *inode, struct stat *buf) sc = (struct symlink_cache *)(long)tmp_sc; } - if (sc->ctime == buf->st_ctime) + if (sc->ctime == buf->ia_ctime) return 0; /* STALE */ @@ -216,7 +216,7 @@ sc_cache_validate (xlator_t *this, inode_t *inode, struct stat *buf) sc->readlink = NULL; } - sc->ctime = buf->st_ctime; + sc->ctime = buf->ia_ctime; return 0; } @@ -242,7 +242,7 @@ sc_cache_get (xlator_t *this, inode_t *inode, char **link) int sc_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - const char *link, struct stat *sbuf) + const char *link, struct iatt *sbuf) { if (op_ret > 0) sc_cache_update (this, frame->local, link); @@ -260,7 +260,7 @@ sc_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size) { char *link = NULL; - struct stat buf = {0, }; + struct iatt buf = {0, }; sc_cache_get (this, loc->inode, &link); @@ -294,8 +294,8 @@ sc_readlink (call_frame_t *frame, xlator_t *this, int sc_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int 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) { if (op_ret == 0) { if (frame->local) { @@ -327,8 +327,8 @@ sc_symlink (call_frame_t *frame, xlator_t *this, int sc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int 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) { if (op_ret == 0) sc_cache_validate (this, inode, buf); diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index 91651b805..8b627a548 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -316,7 +316,7 @@ wb_file_destroy (wb_file_t *file) int32_t wb_sync_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_errno, struct iatt *prebuf, struct iatt *postbuf) { wb_local_t *local = NULL; list_head_t *winds = NULL; @@ -522,7 +522,7 @@ out: int32_t wb_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno, struct stat *buf) + int32_t op_errno, struct iatt *buf) { wb_local_t *local = NULL; wb_request_t *request = NULL; @@ -666,7 +666,7 @@ unwind: int32_t wb_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno, struct stat *buf) + int32_t op_errno, struct iatt *buf) { wb_local_t *local = NULL; wb_request_t *request = NULL; @@ -715,7 +715,7 @@ wb_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd) int32_t ret = -1; int op_errno = EINVAL; - if ((!S_ISDIR (fd->inode->st_mode)) + if ((!IA_ISDIR (fd->inode->ia_type)) && fd_ctx_get (fd, this, &tmp_file)) { gf_log (this->name, GF_LOG_DEBUG, "write behind file pointer is" " not stored in context of fd(%p), returning EBADFD", @@ -779,8 +779,8 @@ unwind: int32_t wb_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) { wb_local_t *local = NULL; wb_request_t *request = NULL; @@ -929,8 +929,8 @@ unwind: int32_t wb_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) { wb_local_t *local = NULL; wb_request_t *request = NULL; @@ -981,7 +981,7 @@ wb_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset) int32_t ret = -1; int op_errno = EINVAL; - if ((!S_ISDIR (fd->inode->st_mode)) + if ((!IA_ISDIR (fd->inode->ia_type)) && fd_ctx_get (fd, this, &tmp_file)) { gf_log (this->name, GF_LOG_DEBUG, "write behind file pointer is" " not stored in context of fd(%p), returning EBADFD", @@ -1048,7 +1048,7 @@ unwind: int32_t wb_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) { wb_local_t *local = NULL; wb_request_t *request = NULL; @@ -1105,7 +1105,7 @@ wb_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, static int32_t wb_setattr_helper (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { STACK_WIND (frame, wb_setattr_cbk, @@ -1121,7 +1121,7 @@ wb_setattr_helper (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t wb_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { wb_file_t *file = NULL; fd_t *iter_fd = NULL; @@ -1235,15 +1235,6 @@ wb_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, goto out; } - /* - If mandatory locking has been enabled on this file, - we disable caching on it - */ - - if ((fd->inode->st_mode & S_ISGID) - && !(fd->inode->st_mode & S_IXGRP)) - file->disabled = 1; - /* If O_DIRECT then, we disable chaching */ if (((flags & O_DIRECT) == O_DIRECT) || ((flags & O_ACCMODE) == O_RDONLY) @@ -1299,8 +1290,8 @@ unwind: int32_t wb_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) + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent) { long flags = 0; wb_file_t *file = NULL; @@ -1313,13 +1304,6 @@ wb_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_errno = ENOMEM; goto out; } - /* - * If mandatory locking has been enabled on this file, - * we disable caching on it - */ - if ((fd->inode->st_mode & S_ISGID) - && !(fd->inode->st_mode & S_IXGRP)) - file->disabled = 1; /* If O_DIRECT then, we disable chaching */ if (frame->local) { @@ -1571,7 +1555,7 @@ __wb_get_other_requests (list_head_t *list, list_head_t *other_requests) int32_t wb_stack_unwind (list_head_t *unwinds) { - struct stat buf = {0,}; + struct iatt buf = {0,}; wb_request_t *request = NULL, *dummy = NULL; call_frame_t *frame = NULL; wb_local_t *local = NULL; @@ -1826,8 +1810,8 @@ out: int32_t wb_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) { STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, prebuf, postbuf); return 0; @@ -1852,7 +1836,7 @@ wb_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, if (vector != NULL) size = iov_length (vector, count); - if ((!S_ISDIR (fd->inode->st_mode)) + if ((!IA_ISDIR (fd->inode->ia_type)) && fd_ctx_get (fd, this, &tmp_file)) { gf_log (this->name, GF_LOG_DEBUG, "write behind file pointer is" " not stored in context of fd(%p), returning EBADFD", @@ -1863,7 +1847,7 @@ wb_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, } file = (wb_file_t *)(long)tmp_file; - if ((!S_ISDIR (fd->inode->st_mode)) && (file == NULL)) { + if ((!IA_ISDIR (fd->inode->ia_type)) && (file == NULL)) { gf_log (this->name, GF_LOG_DEBUG, "wb_file not found for fd %p", fd); op_errno = EBADFD; @@ -1964,7 +1948,7 @@ unwind: int32_t wb_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) { wb_local_t *local = NULL; wb_file_t *file = NULL; @@ -2016,7 +2000,7 @@ wb_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, int32_t ret = -1; wb_request_t *request = NULL; - if ((!S_ISDIR (fd->inode->st_mode)) + if ((!IA_ISDIR (fd->inode->ia_type)) && fd_ctx_get (fd, this, &tmp_file)) { gf_log (this->name, GF_LOG_DEBUG, "write behind file pointer is" " not stored in context of fd(%p), returning EBADFD", @@ -2171,7 +2155,7 @@ wb_flush (call_frame_t *frame, xlator_t *this, fd_t *fd) conf = this->private; - if ((!S_ISDIR (fd->inode->st_mode)) + if ((!IA_ISDIR (fd->inode->ia_type)) && fd_ctx_get (fd, this, &tmp_file)) { gf_log (this->name, GF_LOG_DEBUG, "write behind file pointer is" " not stored in context of fd(%p), returning EBADFD", @@ -2281,7 +2265,7 @@ wb_flush (call_frame_t *frame, xlator_t *this, fd_t *fd) static int32_t wb_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_errno, struct iatt *prebuf, struct iatt *postbuf) { wb_local_t *local = NULL; wb_file_t *file = NULL; @@ -2344,7 +2328,7 @@ wb_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t datasync) wb_request_t *request = NULL; int32_t ret = -1; - if ((!S_ISDIR (fd->inode->st_mode)) + if ((!IA_ISDIR (fd->inode->ia_type)) && fd_ctx_get (fd, this, &tmp_file)) { gf_log (this->name, GF_LOG_DEBUG, "write behind file pointer is" " not stored in context of fd(%p), returning EBADFD", diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c index 3adfbd79b..f50182a6b 100644 --- a/xlators/protocol/client/src/client-protocol.c +++ b/xlators/protocol/client/src/client-protocol.c @@ -3437,27 +3437,27 @@ client_setdents (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, while (trav) { int32_t this_len = 0; char *tmp_buf = NULL; - struct stat *stbuf = &trav->buf; + struct iatt *stbuf = &trav->buf; { /* Convert the stat buf to string */ - uint64_t dev = stbuf->st_dev; - uint64_t ino = stbuf->st_ino; - uint32_t mode = stbuf->st_mode; - uint32_t nlink = stbuf->st_nlink; - uint32_t uid = stbuf->st_uid; - uint32_t gid = stbuf->st_gid; - uint64_t rdev = stbuf->st_rdev; - uint64_t size = stbuf->st_size; - uint32_t blksize = stbuf->st_blksize; - uint64_t blocks = stbuf->st_blocks; - - uint32_t atime = stbuf->st_atime; - uint32_t mtime = stbuf->st_mtime; - uint32_t ctime = stbuf->st_ctime; - - uint32_t atime_nsec = ST_ATIM_NSEC(stbuf); - uint32_t mtime_nsec = ST_MTIM_NSEC(stbuf); - uint32_t ctime_nsec = ST_CTIM_NSEC(stbuf); + uint64_t dev = stbuf->ia_gen; + uint64_t ino = stbuf->ia_ino; + uint32_t mode = st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type); + uint32_t nlink = stbuf->ia_nlink; + uint32_t uid = stbuf->ia_uid; + uint32_t gid = stbuf->ia_gid; + uint64_t rdev = stbuf->ia_rdev; + uint64_t size = stbuf->ia_size; + uint32_t blksize = stbuf->ia_blksize; + uint64_t blocks = stbuf->ia_blocks; + + uint32_t atime = stbuf->ia_atime; + uint32_t mtime = stbuf->ia_mtime; + uint32_t ctime = stbuf->ia_ctime; + + uint32_t atime_nsec = stbuf->ia_atime_nsec; + uint32_t mtime_nsec = stbuf->ia_mtime_nsec; + uint32_t ctime_nsec = stbuf->ia_ctime_nsec; ret = asprintf (&tmp_buf, GF_STAT_PRINT_FMT_STR, dev, ino, mode, nlink, uid, gid, @@ -3520,7 +3520,7 @@ unwind: int client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { gf_hdr_common_t *hdr = NULL; gf_fop_setattr_req_t *req = NULL; @@ -3553,7 +3553,7 @@ client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, req->gen = hton64 (gen); strcpy (req->path, loc->path); - gf_stat_from_stat (&req->stbuf, stbuf); + gf_stat_from_iatt (&req->stbuf, stbuf); req->valid = hton32 (valid); ret = protocol_client_xfer (frame, this, @@ -3570,7 +3570,7 @@ unwind: int client_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct stat *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid) { gf_hdr_common_t *hdr = NULL; gf_fop_fsetattr_req_t *req = NULL; @@ -3616,7 +3616,7 @@ client_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, req->fd = hton64 (remote_fd); - gf_stat_from_stat (&req->stbuf, stbuf); + gf_stat_from_iatt (&req->stbuf, stbuf); req->valid = hton32 (valid); ret = protocol_client_xfer (frame, this, @@ -3940,9 +3940,9 @@ client_create_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, int32_t op_errno = 0; fd_t *fd = NULL; inode_t *inode = NULL; - struct stat stbuf = {0, }; - struct stat preparent = {0, }; - struct stat postparent = {0, }; + struct iatt stbuf = {0, }; + struct iatt preparent = {0, }; + struct iatt postparent = {0, }; int64_t remote_fd = 0; int32_t ret = -1; client_local_t *local = NULL; @@ -3963,13 +3963,13 @@ client_create_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, if (op_ret >= 0) { remote_fd = ntoh64 (rsp->fd); - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); - gf_stat_to_stat (&rsp->preparent, &preparent); - gf_stat_to_stat (&rsp->postparent, &postparent); + gf_stat_to_iatt (&rsp->preparent, &preparent); + gf_stat_to_iatt (&rsp->postparent, &postparent); - ino = stbuf.st_ino; - gen = stbuf.st_dev; + ino = stbuf.ia_ino; + gen = stbuf.ia_gen; } if (op_ret >= 0) { @@ -4106,7 +4106,7 @@ int client_stat_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) { - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; gf_fop_stat_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; @@ -4117,7 +4117,7 @@ client_stat_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); } STACK_UNWIND (frame, op_ret, op_errno, &stbuf); @@ -4141,12 +4141,12 @@ client_mknod_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_mknod_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; inode_t *inode = NULL; client_local_t *local = NULL; int ret = 0; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; local = frame->local; frame->local = NULL; @@ -4158,10 +4158,10 @@ client_mknod_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret >= 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); ret = inode_ctx_put2 (local->loc.inode, frame->this, - stbuf.st_ino, stbuf.st_dev); + stbuf.ia_ino, stbuf.ia_gen); if (ret < 0) { gf_log (frame->this->name, GF_LOG_DEBUG, "MKNOD %"PRId64"/%s (%s): failed to set remote" @@ -4170,8 +4170,8 @@ client_mknod_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, local->loc.path); } - gf_stat_to_stat (&rsp->preparent, &preparent); - gf_stat_to_stat (&rsp->postparent, &postparent); + gf_stat_to_iatt (&rsp->preparent, &preparent); + gf_stat_to_iatt (&rsp->postparent, &postparent); } STACK_UNWIND (frame, op_ret, op_errno, inode, &stbuf, @@ -4197,9 +4197,9 @@ client_symlink_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_symlink_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat stbuf = {0, }; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt stbuf = {0, }; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; inode_t *inode = NULL; client_local_t *local = NULL; int ret = 0; @@ -4214,10 +4214,10 @@ client_symlink_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret >= 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); ret = inode_ctx_put2 (inode, frame->this, - stbuf.st_ino, stbuf.st_dev); + stbuf.ia_ino, stbuf.ia_gen); if (ret < 0) { gf_log (frame->this->name, GF_LOG_DEBUG, "SYMLINK %"PRId64"/%s (%s): failed to set " @@ -4225,8 +4225,8 @@ client_symlink_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, local->loc.parent->ino, local->loc.name, local->loc.path); } - gf_stat_to_stat (&rsp->preparent, &preparent); - gf_stat_to_stat (&rsp->postparent, &postparent); + gf_stat_to_iatt (&rsp->preparent, &preparent); + gf_stat_to_iatt (&rsp->postparent, &postparent); } STACK_UNWIND (frame, op_ret, op_errno, inode, &stbuf, @@ -4252,11 +4252,11 @@ client_link_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_link_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; inode_t *inode = NULL; client_local_t *local = NULL; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; local = frame->local; frame->local = NULL; @@ -4268,10 +4268,10 @@ client_link_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret >= 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); - gf_stat_to_stat (&rsp->preparent, &preparent); - gf_stat_to_stat (&rsp->postparent, &postparent); + gf_stat_to_iatt (&rsp->preparent, &preparent); + gf_stat_to_iatt (&rsp->postparent, &postparent); } STACK_UNWIND (frame, op_ret, op_errno, inode, &stbuf, @@ -4297,8 +4297,8 @@ client_truncate_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_truncate_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat prestat = {0, }; - struct stat poststat = {0, }; + struct iatt prestat = {0, }; + struct iatt poststat = {0, }; rsp = gf_param (hdr); @@ -4306,8 +4306,8 @@ client_truncate_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->prestat, &prestat); - gf_stat_to_stat (&rsp->poststat, &poststat); + gf_stat_to_iatt (&rsp->prestat, &prestat); + gf_stat_to_iatt (&rsp->poststat, &poststat); } STACK_UNWIND (frame, op_ret, op_errno, &prestat, &poststat); @@ -4326,7 +4326,7 @@ int client_fstat_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) { - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; gf_fop_fstat_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; @@ -4337,7 +4337,7 @@ client_fstat_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); } @@ -4360,8 +4360,8 @@ client_ftruncate_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_ftruncate_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat prestat = {0, }; - struct stat poststat = {0, }; + struct iatt prestat = {0, }; + struct iatt poststat = {0, }; rsp = gf_param (hdr); @@ -4369,8 +4369,8 @@ client_ftruncate_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->prestat, &prestat); - gf_stat_to_stat (&rsp->poststat, &poststat); + gf_stat_to_iatt (&rsp->prestat, &prestat); + gf_stat_to_iatt (&rsp->poststat, &poststat); } STACK_UNWIND (frame, op_ret, op_errno, &prestat, &poststat); @@ -4394,7 +4394,7 @@ client_readv_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, int32_t op_ret = 0; int32_t op_errno = 0; struct iovec vector = {0, }; - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; struct iobref *iobref = NULL; rsp = gf_param (hdr); @@ -4404,7 +4404,7 @@ client_readv_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, if (op_ret != -1) { iobref = iobref_new (); - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); vector.iov_len = op_ret; if (op_ret > 0) { @@ -4439,8 +4439,8 @@ client_write_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_write_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat prestat = {0, }; - struct stat poststat = {0, }; + struct iatt prestat = {0, }; + struct iatt poststat = {0, }; rsp = gf_param (hdr); @@ -4448,8 +4448,8 @@ client_write_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret >= 0) { - gf_stat_to_stat (&rsp->prestat, &prestat); - gf_stat_to_stat (&rsp->poststat, &poststat); + gf_stat_to_iatt (&rsp->prestat, &prestat); + gf_stat_to_iatt (&rsp->poststat, &poststat); } STACK_UNWIND (frame, op_ret, op_errno, &prestat, &poststat); @@ -4528,8 +4528,8 @@ int client_fsync_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) { - struct stat prestat = {0, }; - struct stat poststat = {0,}; + struct iatt prestat = {0, }; + struct iatt poststat = {0,}; gf_fop_fsync_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; @@ -4540,8 +4540,8 @@ client_fsync_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->prestat, &prestat); - gf_stat_to_stat (&rsp->poststat, &poststat); + gf_stat_to_iatt (&rsp->prestat, &prestat); + gf_stat_to_iatt (&rsp->poststat, &poststat); } STACK_UNWIND (frame, op_ret, op_errno, &prestat, &poststat); @@ -4564,8 +4564,8 @@ client_unlink_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_unlink_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; rsp = gf_param (hdr); @@ -4573,8 +4573,8 @@ client_unlink_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->preparent, &preparent); - gf_stat_to_stat (&rsp->postparent, &postparent); + gf_stat_to_iatt (&rsp->preparent, &preparent); + gf_stat_to_iatt (&rsp->postparent, &postparent); } STACK_UNWIND (frame, op_ret, op_errno, &preparent, &postparent); @@ -4594,14 +4594,14 @@ int client_rename_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) { - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; gf_fop_rename_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat preoldparent = {0, }; - struct stat postoldparent = {0, }; - struct stat prenewparent = {0, }; - struct stat postnewparent = {0, }; + struct iatt preoldparent = {0, }; + struct iatt postoldparent = {0, }; + struct iatt prenewparent = {0, }; + struct iatt postnewparent = {0, }; rsp = gf_param (hdr); @@ -4609,11 +4609,11 @@ client_rename_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); - gf_stat_to_stat (&rsp->preoldparent, &preoldparent); - gf_stat_to_stat (&rsp->postoldparent, &postoldparent); - gf_stat_to_stat (&rsp->prenewparent, &prenewparent); - gf_stat_to_stat (&rsp->postnewparent, &postnewparent); + gf_stat_to_iatt (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->preoldparent, &preoldparent); + gf_stat_to_iatt (&rsp->postoldparent, &postoldparent); + gf_stat_to_iatt (&rsp->prenewparent, &prenewparent); + gf_stat_to_iatt (&rsp->postnewparent, &postnewparent); } STACK_UNWIND (frame, op_ret, op_errno, &stbuf, &preoldparent, @@ -4639,7 +4639,7 @@ client_readlink_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, int32_t op_ret = 0; int32_t op_errno = 0; char *link = NULL; - struct stat stbuf = {0,}; + struct iatt stbuf = {0,}; rsp = gf_param (hdr); @@ -4648,7 +4648,7 @@ client_readlink_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, if (op_ret > 0) { link = rsp->path; - gf_stat_to_stat (&rsp->buf, &stbuf); + gf_stat_to_iatt (&rsp->buf, &stbuf); } STACK_UNWIND (frame, op_ret, op_errno, link, &stbuf); @@ -4670,12 +4670,12 @@ client_mkdir_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_mkdir_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; inode_t *inode = NULL; client_local_t *local = NULL; int ret = 0; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; local = frame->local; inode = local->loc.inode; @@ -4687,10 +4687,10 @@ client_mkdir_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret >= 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); - ret = inode_ctx_put2 (inode, frame->this, stbuf.st_ino, - stbuf.st_dev); + ret = inode_ctx_put2 (inode, frame->this, stbuf.ia_ino, + stbuf.ia_gen); if (ret < 0) { gf_log (frame->this->name, GF_LOG_DEBUG, "MKDIR %"PRId64"/%s (%s): failed to set " @@ -4699,8 +4699,8 @@ client_mkdir_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, local->loc.path); } - gf_stat_to_stat (&rsp->preparent, &preparent); - gf_stat_to_stat (&rsp->postparent, &postparent); + gf_stat_to_iatt (&rsp->preparent, &preparent); + gf_stat_to_iatt (&rsp->postparent, &postparent); } STACK_UNWIND (frame, op_ret, op_errno, inode, &stbuf, @@ -4829,8 +4829,8 @@ client_rmdir_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, gf_fop_rmdir_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; rsp = gf_param (hdr); @@ -4838,8 +4838,8 @@ client_rmdir_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->preparent, &preparent); - gf_stat_to_stat (&rsp->postparent, &postparent); + gf_stat_to_iatt (&rsp->preparent, &preparent); + gf_stat_to_iatt (&rsp->postparent, &postparent); } STACK_UNWIND (frame, op_ret, op_errno, &preparent, &postparent); @@ -4886,8 +4886,8 @@ int client_lookup_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) { - struct stat stbuf = {0, }; - struct stat postparent = {0, }; + struct iatt stbuf = {0, }; + struct iatt postparent = {0, }; inode_t *inode = NULL; dict_t *xattr = NULL; gf_fop_lookup_rsp_t *rsp = NULL; @@ -4909,14 +4909,14 @@ client_lookup_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_ret = ntoh32 (hdr->rsp.op_ret); - gf_stat_to_stat (&rsp->postparent, &postparent); + gf_stat_to_iatt (&rsp->postparent, &postparent); if (op_ret == 0) { op_ret = -1; - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_iatt (&rsp->stat, &stbuf); ret = inode_ctx_get2 (inode, frame->this, &oldino, &oldgen); - if (oldino != stbuf.st_ino || oldgen != stbuf.st_dev) { + if (oldino != stbuf.ia_ino || oldgen != stbuf.ia_gen) { if (oldino) { gf_log (frame->this->name, GF_LOG_DEBUG, "LOOKUP %"PRId64"/%s (%s): " @@ -4926,13 +4926,13 @@ client_lookup_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, local->loc.parent->ino : (uint64_t) 0, local->loc.name, local->loc.path, - oldgen, oldino, stbuf.st_dev, stbuf.st_ino); + oldgen, oldino, stbuf.ia_gen, stbuf.ia_ino); op_errno = ESTALE; goto fail; } ret = inode_ctx_put2 (inode, frame->this, - stbuf.st_ino, stbuf.st_dev); + stbuf.ia_ino, stbuf.ia_gen); if (ret < 0) { gf_log (frame->this->name, GF_LOG_DEBUG, "LOOKUP %"PRId64"/%s (%s) : " @@ -4990,8 +4990,8 @@ static int32_t client_setattr_cbk (call_frame_t *frame,gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) { - struct stat statpre = {0, }; - struct stat statpost = {0, }; + struct iatt statpre = {0, }; + struct iatt statpost = {0, }; gf_fop_setattr_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; @@ -5002,8 +5002,8 @@ client_setattr_cbk (call_frame_t *frame,gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->statpre, &statpre); - gf_stat_to_stat (&rsp->statpost, &statpost); + gf_stat_to_iatt (&rsp->statpre, &statpre); + gf_stat_to_iatt (&rsp->statpost, &statpost); } STACK_UNWIND (frame, op_ret, op_errno, &statpre, &statpost); @@ -5015,8 +5015,8 @@ static int32_t client_fsetattr_cbk (call_frame_t *frame,gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) { - struct stat statpre = {0, }; - struct stat statpost = {0, }; + struct iatt statpre = {0, }; + struct iatt statpost = {0, }; gf_fop_setattr_rsp_t *rsp = NULL; int32_t op_ret = 0; int32_t op_errno = 0; @@ -5027,8 +5027,8 @@ client_fsetattr_cbk (call_frame_t *frame,gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->statpre, &statpre); - gf_stat_to_stat (&rsp->statpost, &statpost); + gf_stat_to_iatt (&rsp->statpre, &statpre); + gf_stat_to_iatt (&rsp->statpost, &statpost); } STACK_UNWIND (frame, op_ret, op_errno, &statpre, &statpost); @@ -5087,7 +5087,7 @@ gf_bin_to_direntry (char *buf, size_t count) break; rcount = ender - buffer; *ender = '\0'; - if (S_ISLNK (trav->buf.st_mode)) + if (IA_ISLNK (trav->buf.ia_type)) trav->link = strdup (buffer); else trav->link = ""; @@ -5118,7 +5118,7 @@ gf_free_direntry (dir_entry_t *head) 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/protocol/client/src/client-protocol.h b/xlators/protocol/client/src/client-protocol.h index 273486902..ae65fb5fe 100644 --- a/xlators/protocol/client/src/client-protocol.h +++ b/xlators/protocol/client/src/client-protocol.h @@ -117,7 +117,7 @@ typedef struct { static inline void -gf_string_to_stat(char *string, struct stat *stbuf) +gf_string_to_stat(char *string, struct iatt *stbuf) { uint64_t dev = 0; uint64_t ino = 0; @@ -154,25 +154,25 @@ gf_string_to_stat(char *string, struct stat *stbuf) &ctime, &ctime_nsec); - stbuf->st_dev = dev; - stbuf->st_ino = ino; - stbuf->st_mode = mode; - stbuf->st_nlink = nlink; - stbuf->st_uid = uid; - stbuf->st_gid = gid; - stbuf->st_rdev = rdev; - stbuf->st_size = size; - stbuf->st_blksize = blksize; - stbuf->st_blocks = blocks; - - stbuf->st_atime = atime; - stbuf->st_mtime = mtime; - stbuf->st_ctime = ctime; - - ST_ATIM_NSEC_SET(stbuf, atime_nsec); - ST_MTIM_NSEC_SET(stbuf, mtime_nsec); - ST_CTIM_NSEC_SET(stbuf, ctime_nsec); - + stbuf->ia_gen = dev; + stbuf->ia_ino = ino; + stbuf->ia_prot = ia_prot_from_st_mode (mode); + stbuf->ia_type = ia_type_from_st_mode (mode); + stbuf->ia_nlink = nlink; + stbuf->ia_uid = uid; + stbuf->ia_gid = gid; + stbuf->ia_rdev = rdev; + stbuf->ia_size = size; + stbuf->ia_blksize = blksize; + stbuf->ia_blocks = blocks; + + stbuf->ia_atime = atime; + stbuf->ia_mtime = mtime; + stbuf->ia_ctime = ctime; + + stbuf->ia_atime_nsec = atime_nsec; + stbuf->ia_mtime_nsec = mtime_nsec; + stbuf->ia_ctime_nsec = ctime_nsec; } #endif diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index f627b6b53..dc2620c90 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -112,34 +112,34 @@ out: } /* - * stat_to_str - convert struct stat to a ASCII string - * @stbuf: struct stat pointer + * stat_to_str - convert struct iatt to a ASCII string + * @stbuf: struct iatt pointer * * not for external reference */ char * -stat_to_str (struct stat *stbuf) +stat_to_str (struct iatt *stbuf) { int ret = 0; char *tmp_buf = NULL; - uint64_t dev = stbuf->st_dev; - uint64_t ino = stbuf->st_ino; - uint32_t mode = stbuf->st_mode; - uint32_t nlink = stbuf->st_nlink; - uint32_t uid = stbuf->st_uid; - uint32_t gid = stbuf->st_gid; - uint64_t rdev = stbuf->st_rdev; - uint64_t size = stbuf->st_size; - uint32_t blksize = stbuf->st_blksize; - uint64_t blocks = stbuf->st_blocks; - uint32_t atime = stbuf->st_atime; - uint32_t mtime = stbuf->st_mtime; - uint32_t ctime = stbuf->st_ctime; - - uint32_t atime_nsec = ST_ATIM_NSEC(stbuf); - uint32_t mtime_nsec = ST_MTIM_NSEC(stbuf); - uint32_t ctime_nsec = ST_CTIM_NSEC(stbuf); + uint64_t dev = stbuf->ia_gen; + uint64_t ino = stbuf->ia_ino; + uint32_t mode = st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type); + uint32_t nlink = stbuf->ia_nlink; + uint32_t uid = stbuf->ia_uid; + uint32_t gid = stbuf->ia_gid; + uint64_t rdev = stbuf->ia_rdev; + uint64_t size = stbuf->ia_size; + uint32_t blksize = stbuf->ia_blksize; + uint64_t blocks = stbuf->ia_blocks; + uint32_t atime = stbuf->ia_atime; + uint32_t mtime = stbuf->ia_mtime; + uint32_t ctime = stbuf->ia_ctime; + + uint32_t atime_nsec = stbuf->ia_atime_nsec; + uint32_t mtime_nsec = stbuf->ia_mtime_nsec; + uint32_t ctime_nsec = stbuf->ia_ctime_nsec; ret = asprintf (&tmp_buf, @@ -307,10 +307,10 @@ gf_add_locker (struct _lock_table *table, const char *volume, if (fd == NULL) { loc_copy (&new->loc, loc); - dir = S_ISDIR (new->loc.inode->st_mode); + dir = IA_ISDIR (new->loc.inode->ia_type); } else { new->fd = fd_ref (fd); - dir = S_ISDIR (fd->inode->st_mode); + dir = IA_ISDIR (fd->inode->ia_type); } new->pid = pid; @@ -342,9 +342,9 @@ gf_del_locker (struct _lock_table *table, const char *volume, INIT_LIST_HEAD (&del); if (fd) { - dir = S_ISDIR (fd->inode->st_mode); + dir = IA_ISDIR (fd->inode->ia_type); } else { - dir = S_ISDIR (loc->inode->st_mode); + dir = IA_ISDIR (loc->inode->ia_type); } LOCK (&table->lock); diff --git a/xlators/protocol/server/src/server-helpers.h b/xlators/protocol/server/src/server-helpers.h index 867035d33..cbf57ae44 100644 --- a/xlators/protocol/server/src/server-helpers.h +++ b/xlators/protocol/server/src/server-helpers.h @@ -42,7 +42,7 @@ #define IS_NOT_ROOT(pathlen) ((pathlen > 2)? 1 : 0) char * -stat_to_str (struct stat *stbuf); +stat_to_str (struct iatt *stbuf); call_frame_t * server_copy_frame (call_frame_t *frame); diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c index 4562eaea3..57e320393 100644 --- a/xlators/protocol/server/src/server-protocol.c +++ b/xlators/protocol/server/src/server-protocol.c @@ -668,8 +668,8 @@ server_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_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) { gf_hdr_common_t *hdr = NULL; gf_fop_rmdir_rsp_t *rsp = NULL; @@ -705,8 +705,8 @@ server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - gf_stat_from_stat (&rsp->preparent, preparent); - gf_stat_from_stat (&rsp->postparent, postparent); + gf_stat_from_iatt (&rsp->preparent, preparent); + gf_stat_from_iatt (&rsp->postparent, postparent); } protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_RMDIR, @@ -729,8 +729,8 @@ server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_mkdir_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) + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_mkdir_rsp_t *rsp = NULL; @@ -750,9 +750,9 @@ server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret >= 0) { - gf_stat_from_stat (&rsp->stat, stbuf); - gf_stat_from_stat (&rsp->preparent, preparent); - gf_stat_from_stat (&rsp->postparent, postparent); + gf_stat_from_iatt (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->preparent, preparent); + gf_stat_from_iatt (&rsp->postparent, postparent); link_inode = inode_link (inode, state->loc.parent, state->loc.name, stbuf); @@ -785,8 +785,8 @@ server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_mknod_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) { gf_hdr_common_t *hdr = NULL; gf_fop_mknod_rsp_t *rsp = NULL; @@ -806,9 +806,9 @@ server_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret >= 0) { - gf_stat_from_stat (&rsp->stat, stbuf); - gf_stat_from_stat (&rsp->preparent, preparent); - gf_stat_from_stat (&rsp->postparent, postparent); + gf_stat_from_iatt (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->preparent, preparent); + gf_stat_from_iatt (&rsp->postparent, postparent); link_inode = inode_link (inode, state->loc.parent, state->loc.name, stbuf); @@ -1383,9 +1383,9 @@ server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_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) { gf_hdr_common_t *hdr = NULL; gf_fop_rename_rsp_t *rsp = NULL; @@ -1404,8 +1404,8 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - stbuf->st_ino = state->loc.inode->ino; - stbuf->st_mode = state->loc.inode->st_mode; + stbuf->ia_ino = state->loc.inode->ino; + stbuf->ia_type = state->loc.inode->ia_type; gf_log (state->bound_xl->name, GF_LOG_TRACE, "%"PRId64": RENAME_CBK (%"PRId64") %"PRId64"/%s " @@ -1418,13 +1418,13 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->loc.parent, state->loc.name, state->loc2.parent, state->loc2.name, state->loc.inode, stbuf); - gf_stat_from_stat (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->stat, stbuf); - gf_stat_from_stat (&rsp->preoldparent, preoldparent); - gf_stat_from_stat (&rsp->postoldparent, postoldparent); + gf_stat_from_iatt (&rsp->preoldparent, preoldparent); + gf_stat_from_iatt (&rsp->postoldparent, postoldparent); - gf_stat_from_stat (&rsp->prenewparent, prenewparent); - gf_stat_from_stat (&rsp->postnewparent, postnewparent); + gf_stat_from_iatt (&rsp->prenewparent, prenewparent); + gf_stat_from_iatt (&rsp->postnewparent, postnewparent); } protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_RENAME, @@ -1446,8 +1446,8 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_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) { gf_hdr_common_t *hdr = NULL; gf_fop_unlink_rsp_t *rsp = NULL; @@ -1489,8 +1489,8 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - gf_stat_from_stat (&rsp->preparent, preparent); - gf_stat_from_stat (&rsp->postparent, postparent); + gf_stat_from_iatt (&rsp->preparent, preparent); + gf_stat_from_iatt (&rsp->postparent, postparent); } protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_UNLINK, @@ -1512,8 +1512,8 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_symlink_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) + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_symlink_rsp_t *rsp = NULL; @@ -1533,9 +1533,9 @@ server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno_to_error (op_errno)); if (op_ret >= 0) { - gf_stat_from_stat (&rsp->stat, stbuf); - gf_stat_from_stat (&rsp->preparent, preparent); - gf_stat_from_stat (&rsp->postparent, postparent); + gf_stat_from_iatt (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->preparent, preparent); + gf_stat_from_iatt (&rsp->postparent, postparent); link_inode = inode_link (inode, state->loc.parent, state->loc.name, stbuf); @@ -1569,8 +1569,8 @@ server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_link_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) + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_link_rsp_t *rsp = NULL; @@ -1590,11 +1590,11 @@ server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - stbuf->st_ino = state->loc.inode->ino; + stbuf->ia_ino = state->loc.inode->ino; - gf_stat_from_stat (&rsp->stat, stbuf); - gf_stat_from_stat (&rsp->preparent, preparent); - gf_stat_from_stat (&rsp->postparent, postparent); + gf_stat_from_iatt (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->preparent, preparent); + gf_stat_from_iatt (&rsp->postparent, postparent); gf_log (state->bound_xl->name, GF_LOG_TRACE, "%"PRId64": LINK (%"PRId64") %"PRId64"/%s ==> %"PRId64"/%s", @@ -1637,8 +1637,8 @@ server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_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) { gf_hdr_common_t *hdr = NULL; gf_fop_truncate_rsp_t *rsp = NULL; @@ -1657,8 +1657,8 @@ server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - gf_stat_from_stat (&rsp->prestat, prebuf); - gf_stat_from_stat (&rsp->poststat, postbuf); + gf_stat_from_iatt (&rsp->prestat, prebuf); + gf_stat_from_iatt (&rsp->poststat, postbuf); } else { gf_log (this->name, GF_LOG_DEBUG, "%"PRId64": TRUNCATE %s (%"PRId64") ==> %"PRId32" (%s)", @@ -1686,7 +1686,7 @@ server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_fstat_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) { gf_hdr_common_t *hdr = NULL; gf_fop_fstat_rsp_t *rsp = NULL; @@ -1703,7 +1703,7 @@ server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - gf_stat_from_stat (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->stat, stbuf); } else { state = CALL_STATE(frame); @@ -1733,8 +1733,8 @@ server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_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) { gf_hdr_common_t *hdr = NULL; gf_fop_ftruncate_rsp_t *rsp = NULL; @@ -1751,8 +1751,8 @@ server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - gf_stat_from_stat (&rsp->prestat, prebuf); - gf_stat_from_stat (&rsp->poststat, postbuf); + gf_stat_from_iatt (&rsp->prestat, prebuf); + gf_stat_from_iatt (&rsp->poststat, postbuf); } else { state = CALL_STATE (frame); @@ -1825,8 +1825,8 @@ server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_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) { gf_hdr_common_t *hdr = NULL; gf_fop_fsync_rsp_t *rsp = NULL; @@ -1853,8 +1853,8 @@ server_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret >= 0) { - gf_stat_from_stat (&(rsp->prestat), prebuf); - gf_stat_from_stat (&(rsp->poststat), postbuf); + gf_stat_from_iatt (&(rsp->prestat), prebuf); + gf_stat_from_iatt (&(rsp->poststat), postbuf); } protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_FSYNC, @@ -1909,8 +1909,8 @@ server_release_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_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) { gf_hdr_common_t *hdr = NULL; gf_fop_write_rsp_t *rsp = NULL; @@ -1927,8 +1927,8 @@ server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno_to_error (op_errno)); if (op_ret >= 0) { - gf_stat_from_stat (&rsp->prestat, prebuf); - gf_stat_from_stat (&rsp->poststat, postbuf); + gf_stat_from_iatt (&rsp->prestat, prebuf); + gf_stat_from_iatt (&rsp->poststat, postbuf); } else { state = CALL_STATE(frame); @@ -1962,7 +1962,7 @@ int server_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) { gf_hdr_common_t *hdr = NULL; gf_fop_read_rsp_t *rsp = NULL; @@ -1979,7 +1979,7 @@ server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret >= 0) { - gf_stat_from_stat (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->stat, stbuf); } else { state = CALL_STATE(frame); @@ -2062,15 +2062,15 @@ server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * @op_errno: * @fd: file descriptor * @inode: inode structure - * @stbuf: struct stat of created file + * @stbuf: struct iatt of created file * * not for external reference */ int server_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 *stbuf, - struct stat *preparent, struct stat *postparent) + fd_t *fd, inode_t *inode, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent) { server_connection_t *conn = NULL; gf_hdr_common_t *hdr = NULL; @@ -2089,7 +2089,7 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_log (state->bound_xl->name, GF_LOG_TRACE, "%"PRId64": CREATE %"PRId64"/%s (%"PRId64")", frame->root->unique, state->loc.parent->ino, - state->loc.name, stbuf->st_ino); + state->loc.name, stbuf->ia_ino); link_inode = inode_link (inode, state->loc.parent, state->loc.name, stbuf); @@ -2142,9 +2142,9 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, rsp->fd = hton64 (fd_no); if (op_ret >= 0) { - gf_stat_from_stat (&rsp->stat, stbuf); - gf_stat_from_stat (&rsp->preparent, preparent); - gf_stat_from_stat (&rsp->postparent, postparent); + gf_stat_from_iatt (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->preparent, preparent); + gf_stat_from_iatt (&rsp->postparent, postparent); } protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_CREATE, @@ -2167,7 +2167,7 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_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) + struct iatt *sbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_readlink_rsp_t *rsp = NULL; @@ -2197,7 +2197,7 @@ server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno_to_error (op_errno)); if (op_ret >= 0) { - gf_stat_from_stat (&(rsp->buf), sbuf); + gf_stat_from_iatt (&(rsp->buf), sbuf); strcpy (rsp->path, buf); } @@ -2220,7 +2220,7 @@ server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_stat_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) { gf_hdr_common_t *hdr = NULL; gf_fop_stat_rsp_t *rsp = NULL; @@ -2239,7 +2239,7 @@ server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno_to_error (op_errno)); if (op_ret == 0) { - gf_stat_from_stat (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->stat, stbuf); } else { gf_log (this->name, GF_LOG_DEBUG, "%"PRId64": STAT %s (%"PRId64") ==> %"PRId32" (%s)", @@ -2269,7 +2269,7 @@ server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_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) + struct iatt *statpre, struct iatt *statpost) { gf_hdr_common_t *hdr = NULL; gf_fop_setattr_rsp_t *rsp = NULL; @@ -2288,8 +2288,8 @@ server_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno_to_error (op_errno)); if (op_ret == 0) { - gf_stat_from_stat (&rsp->statpre, statpre); - gf_stat_from_stat (&rsp->statpost, statpost); + gf_stat_from_iatt (&rsp->statpre, statpre); + gf_stat_from_iatt (&rsp->statpost, statpost); } else { gf_log (this->name, GF_LOG_DEBUG, "%"PRId64": SETATTR %s (%"PRId64") ==> %"PRId32" (%s)", @@ -2318,7 +2318,7 @@ server_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *statpre, struct stat *statpost) + struct iatt *statpre, struct iatt *statpost) { gf_hdr_common_t *hdr = NULL; gf_fop_fsetattr_rsp_t *rsp = NULL; @@ -2337,8 +2337,8 @@ server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno_to_error (op_errno)); if (op_ret == 0) { - gf_stat_from_stat (&rsp->statpre, statpre); - gf_stat_from_stat (&rsp->statpost, statpost); + gf_stat_from_iatt (&rsp->statpre, statpre); + gf_stat_from_iatt (&rsp->statpost, statpost); } else { gf_log (this->name, GF_LOG_DEBUG, "%"PRId64": FSETATTR %"PRId64" (%"PRId64") ==> " @@ -2370,8 +2370,8 @@ server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf, dict_t *dict, - struct stat *postparent) + inode_t *inode, struct iatt *stbuf, dict_t *dict, + struct iatt *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_lookup_rsp_t *rsp = NULL; @@ -2435,18 +2435,18 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (postparent) - gf_stat_from_stat (&rsp->postparent, postparent); + gf_stat_from_iatt (&rsp->postparent, postparent); if (op_ret == 0) { root_inode = BOUND_XL(frame)->itable->root; if (inode == root_inode) { /* we just looked up root ("/") */ - stbuf->st_ino = 1; - if (inode->st_mode == 0) - inode->st_mode = stbuf->st_mode; + stbuf->ia_ino = 1; + if (inode->ia_type == 0) + inode->ia_type = stbuf->ia_type; } - gf_stat_from_stat (&rsp->stat, stbuf); + gf_stat_from_iatt (&rsp->stat, stbuf); if (inode->ino != 1) { link_inode = inode_link (inode, state->loc.parent, @@ -2802,7 +2802,7 @@ server_setattr (call_frame_t *frame, xlator_t *bound_xl, state->resolve.gen = ntoh64 (req->gen); state->resolve.path = strdup (req->path); - gf_stat_to_stat (&req->stbuf, &state->stbuf); + gf_stat_to_iatt (&req->stbuf, &state->stbuf); state->valid = ntoh32 (req->valid); resolve_and_resume (frame, server_setattr_resume); @@ -2848,7 +2848,7 @@ server_fsetattr (call_frame_t *frame, xlator_t *bound_xl, state->resolve.type = RESOLVE_MUST; state->resolve.fd_no = ntoh64 (req->fd); - gf_stat_to_stat (&req->stbuf, &state->stbuf); + gf_stat_to_iatt (&req->stbuf, &state->stbuf); state->valid = ntoh32 (req->valid); resolve_and_resume (frame, server_fsetattr_resume); @@ -5084,25 +5084,25 @@ server_setdents (call_frame_t *frame, xlator_t *bound_xl, &size, &blksize, &blocks, &atime, &atime_nsec, &mtime, &mtime_nsec, &ctime, &ctime_nsec); - trav->buf.st_dev = dev; - trav->buf.st_ino = ino; - trav->buf.st_mode = mode; - trav->buf.st_nlink = nlink; - trav->buf.st_uid = uid; - trav->buf.st_gid = gid; - trav->buf.st_rdev = rdev; - trav->buf.st_size = size; - trav->buf.st_blksize = blksize; - trav->buf.st_blocks = blocks; - - trav->buf.st_atime = atime; - trav->buf.st_mtime = mtime; - trav->buf.st_ctime = ctime; - - ST_ATIM_NSEC_SET(&trav->buf, atime_nsec); - ST_MTIM_NSEC_SET(&trav->buf, mtime_nsec); - ST_CTIM_NSEC_SET(&trav->buf, ctime_nsec); - + trav->buf.ia_gen = dev; + trav->buf.ia_ino = ino; + trav->buf.ia_prot = ia_prot_from_st_mode (mode); + trav->buf.ia_type = ia_type_from_st_mode (mode); + trav->buf.ia_nlink = nlink; + trav->buf.ia_uid = uid; + trav->buf.ia_gid = gid; + trav->buf.ia_rdev = rdev; + trav->buf.ia_size = size; + trav->buf.ia_blksize = blksize; + trav->buf.ia_blocks = blocks; + + trav->buf.ia_atime = atime; + trav->buf.ia_mtime = mtime; + trav->buf.ia_ctime = ctime; + + trav->buf.ia_atime_nsec = atime_nsec; + trav->buf.ia_mtime_nsec = mtime_nsec; + trav->buf.ia_ctime_nsec = ctime_nsec; } ender = strchr (buffer_ptr, '\n'); @@ -5110,7 +5110,7 @@ server_setdents (call_frame_t *frame, xlator_t *bound_xl, break; count = ender - buffer_ptr; *ender = '\0'; - if (S_ISLNK (trav->buf.st_mode)) { + if (IA_ISLNK (trav->buf.ia_type)) { trav->link = strdup (buffer_ptr); } else trav->link = ""; @@ -5131,7 +5131,7 @@ server_setdents (call_frame_t *frame, xlator_t *bound_xl, 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/protocol/server/src/server-protocol.h b/xlators/protocol/server/src/server-protocol.h index 78bc13827..61fcb877e 100644 --- a/xlators/protocol/server/src/server-protocol.h +++ b/xlators/protocol/server/src/server-protocol.h @@ -165,7 +165,7 @@ struct _server_state { loc_t *loc_now; server_resolve_t *resolve_now; - struct stat stbuf; + struct iatt stbuf; int valid; fd_t *fd; diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c index 2eb95e6a4..f4c9ebad7 100644 --- a/xlators/protocol/server/src/server-resolve.c +++ b/xlators/protocol/server/src/server-resolve.c @@ -165,8 +165,8 @@ resolve_deep_continue (call_frame_t *frame) int resolve_deep_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, inode_t *inode, struct stat *buf, - dict_t *xattr, struct stat *postparent) + int op_ret, int op_errno, inode_t *inode, struct iatt *buf, + dict_t *xattr, struct iatt *postparent) { server_state_t *state = NULL; server_resolve_t *resolve = NULL; diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index f1541a2da..330fe80fa 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -80,7 +80,7 @@ typedef struct { xlator_t *this; const char *real_path; dict_t *xattr; - struct stat *stbuf; + struct iatt *stbuf; loc_t *loc; } posix_xattr_filler_t; @@ -112,11 +112,11 @@ _posix_xattr_get_set (dict_t *xattr_req, /* should size be put into the data_t ? */ if (!strcmp (key, "glusterfs.content") - && S_ISREG (filler->stbuf->st_mode)) { + && IA_ISREG (filler->stbuf->ia_type)) { /* file content request */ req_size = data_to_uint64 (data); - if (req_size >= filler->stbuf->st_size) { + if (req_size >= filler->stbuf->ia_size) { _fd = open (filler->real_path, O_RDONLY); if (_fd == -1) { @@ -126,7 +126,7 @@ _posix_xattr_get_set (dict_t *xattr_req, goto err; } - databuf = calloc (1, filler->stbuf->st_size); + databuf = calloc (1, filler->stbuf->ia_size); if (!databuf) { gf_log (filler->this->name, GF_LOG_ERROR, @@ -134,7 +134,7 @@ _posix_xattr_get_set (dict_t *xattr_req, goto err; } - ret = read (_fd, databuf, filler->stbuf->st_size); + ret = read (_fd, databuf, filler->stbuf->ia_size); if (ret == -1) { gf_log (filler->this->name, GF_LOG_ERROR, "Read on file %s failed: %s", @@ -152,7 +152,7 @@ _posix_xattr_get_set (dict_t *xattr_req, } ret = dict_set_bin (filler->xattr, key, - databuf, filler->stbuf->st_size); + databuf, filler->stbuf->ia_size); if (ret < 0) { goto err; } @@ -194,27 +194,29 @@ _posix_xattr_get_set (dict_t *xattr_req, static int -posix_scale_st_ino (struct posix_private *priv, struct stat *buf) +posix_scale_ia_ino (struct posix_private *priv, struct iatt *buf) { int i = 0; int ret = -1; ino_t temp_ino = 0; int r; - struct stat export_buf; + struct stat lstatbuf; + struct iatt export_buf; for (i = 0; i < priv->num_devices_to_span; i++) { - if (buf->st_dev == priv->st_device[i]) { + if (buf->ia_dev == priv->st_device[i]) { break; } if (priv->st_device[i] == 0) { - priv->st_device[i] = buf->st_dev; + priv->st_device[i] = buf->ia_dev; break; } } if (i == priv->num_devices_to_span) { - r = lstat (priv->base_path, &export_buf); - if ((r != 0) || (buf->st_dev != export_buf.st_dev)) { + r = lstat (priv->base_path, &lstatbuf); + iatt_from_stat (&export_buf, &lstatbuf); + if ((r != 0) || (buf->ia_gen != export_buf.ia_gen)) { goto out; } @@ -223,12 +225,12 @@ posix_scale_st_ino (struct posix_private *priv, struct stat *buf) "since init --- assuming done by automount", priv->base_path); - priv->st_device[0] = export_buf.st_dev; + priv->st_device[0] = export_buf.ia_dev; } - temp_ino = (buf->st_ino * priv->num_devices_to_span) + i; + temp_ino = (buf->ia_ino * priv->num_devices_to_span) + i; - buf->st_ino = temp_ino; + buf->ia_ino = temp_ino; ret = 0; out: @@ -237,29 +239,32 @@ out: int -posix_lstat_with_gen (xlator_t *this, const char *path, struct stat *stbuf_p) +posix_lstat_with_gen (xlator_t *this, const char *path, struct iatt *stbuf_p) { struct posix_private *priv = NULL; int ret = 0; char gen_key[1024] = {0, }; uint64_t gen_val_be = 0; uint64_t gen_val = 0; - struct stat stbuf = {0, }; + struct stat lstatbuf = {0, }; + struct iatt stbuf = {0, }; priv = this->private; - ret = lstat (path, &stbuf); + ret = lstat (path, &lstatbuf); if (ret == -1) return -1; - ret = posix_scale_st_ino (priv, &stbuf); + iatt_from_stat (&stbuf, &lstatbuf); + + ret = posix_scale_ia_ino (priv, &stbuf); if ((ret == -1) && !strcmp (path, "..")) { /* stat on ../ might land us outside the export directory, so don't panic */ gf_log (this->name, GF_LOG_WARNING, "Access to %s (on dev %lld) is crossing device (%lld)", - path, (unsigned long long) stbuf.st_dev, + path, (unsigned long long) stbuf.ia_dev, (unsigned long long) priv->st_device[0]); errno = EXDEV; return -1; @@ -267,7 +272,7 @@ posix_lstat_with_gen (xlator_t *this, const char *path, struct stat *stbuf_p) #ifndef GF_LINUX_HOST_OS if (!S_ISDIR (stbuf.st_mode) && !S_ISREG (stbuf.st_mode)) { - stbuf.st_dev = (typeof(stbuf.st_dev))stbuf.st_mtime; + stbuf.ia_gen = (typeof(stbuf.ia_gen))stbuf.ia_mtime; if (stbuf_p) *stbuf_p = stbuf; return 0; @@ -298,7 +303,7 @@ posix_lstat_with_gen (xlator_t *this, const char *path, struct stat *stbuf_p) if (ret >= 0) { ret = 0; - stbuf.st_dev = (typeof(stbuf.st_dev))gen_val; + stbuf.ia_gen = (typeof(stbuf.ia_gen))gen_val; if (stbuf_p) *stbuf_p = stbuf; } @@ -308,26 +313,29 @@ posix_lstat_with_gen (xlator_t *this, const char *path, struct stat *stbuf_p) int -posix_fstat_with_gen (xlator_t *this, int fd, struct stat *stbuf_p) +posix_fstat_with_gen (xlator_t *this, int fd, struct iatt *stbuf_p) { struct posix_private *priv = NULL; int ret = 0; char gen_key[1024] = {0, }; uint64_t gen_val_be = 0; uint64_t gen_val = 0; - struct stat stbuf = {0, }; + struct stat fstatbuf = {0, }; + struct iatt stbuf = {0, }; priv = this->private; - ret = fstat (fd, &stbuf); + ret = fstat (fd, &fstatbuf); if (ret == -1) return -1; - ret = posix_scale_st_ino (priv, &stbuf); + iatt_from_stat (&stbuf, &fstatbuf); + + ret = posix_scale_ia_ino (priv, &stbuf); if (ret == -1) { gf_log (this->name, GF_LOG_WARNING, "Access to fd %d (on dev %lld) is crossing device (%lld)", - fd, (unsigned long long) stbuf.st_dev, + fd, (unsigned long long) stbuf.ia_dev, (unsigned long long) priv->st_device[0]); errno = EXDEV; return -1; @@ -335,7 +343,7 @@ posix_fstat_with_gen (xlator_t *this, int fd, struct stat *stbuf_p) #ifndef GF_LINUX_HOST_OS if (!S_ISDIR (stbuf.st_mode) && !S_ISREG (stbuf.st_mode)) { - stbuf.st_dev = (typeof(stbuf.st_dev))stbuf.st_mtime; + stbuf.ia_gen = (typeof(stbuf.ia_gen))stbuf.ia_mtime; return 0; } #endif /* !GF_LINUX_HOST_OS */ @@ -364,7 +372,7 @@ posix_fstat_with_gen (xlator_t *this, int fd, struct stat *stbuf_p) if (ret >= 0) { ret = 0; - stbuf.st_dev = (typeof(stbuf.st_dev))gen_val; + stbuf.ia_gen = (typeof(stbuf.ia_gen))gen_val; if (stbuf_p) *stbuf_p = stbuf; } @@ -375,7 +383,7 @@ posix_fstat_with_gen (xlator_t *this, int fd, struct stat *stbuf_p) dict_t * posix_lookup_xattr_fill (xlator_t *this, const char *real_path, loc_t *loc, - dict_t *xattr_req, struct stat *buf) + dict_t *xattr_req, struct iatt *buf) { dict_t *xattr = NULL; posix_xattr_filler_t filler = {0, }; @@ -410,7 +418,7 @@ setgid_override (xlator_t *this, char *real_path, gid_t *gid) { char * tmp_path = NULL; char * parent_path = NULL; - struct stat parent_stbuf; + struct iatt parent_stbuf; int op_ret = 0; @@ -434,13 +442,13 @@ setgid_override (xlator_t *this, char *real_path, gid_t *gid) goto out; } - if (parent_stbuf.st_mode & S_ISGID) { + if (parent_stbuf.ia_prot.sgid) { /* Entries created inside a setgid directory should inherit the gid from the parent */ - *gid = parent_stbuf.st_gid; + *gid = parent_stbuf.ia_gid; } out: @@ -455,7 +463,7 @@ int32_t posix_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req) { - struct stat buf = {0, }; + struct iatt buf = {0, }; char * real_path = NULL; int32_t op_ret = -1; int32_t entry_ret = 0; @@ -463,7 +471,7 @@ posix_lookup (call_frame_t *frame, xlator_t *this, dict_t * xattr = NULL; char * pathdup = NULL; char * parentpath = NULL; - struct stat postparent = {0,}; + struct iatt postparent = {0,}; struct posix_private *priv = NULL; VALIDATE_OR_GOTO (frame, out); @@ -534,7 +542,7 @@ posix_stat (call_frame_t *frame, xlator_t *this, loc_t *loc) { - struct stat buf = {0,}; + struct iatt buf = {0,}; char * real_path = NULL; int32_t op_ret = -1; int32_t op_errno = 0; @@ -573,13 +581,15 @@ posix_stat (call_frame_t *frame, static int posix_do_chmod (xlator_t *this, const char *path, - struct stat *stbuf) + struct iatt *stbuf) { int32_t ret = -1; + mode_t mode = 0; - ret = lchmod (path, stbuf->st_mode); + mode = st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type); + ret = lchmod (path, mode); if ((ret == -1) && (errno == ENOSYS)) { - ret = chmod (path, stbuf->st_mode); + ret = chmod (path, mode); } return ret; @@ -588,7 +598,7 @@ posix_do_chmod (xlator_t *this, static int posix_do_chown (xlator_t *this, const char *path, - struct stat *stbuf, + struct iatt *stbuf, int32_t valid) { int32_t ret = -1; @@ -596,10 +606,10 @@ posix_do_chown (xlator_t *this, gid_t gid = -1; if (valid & GF_SET_ATTR_UID) - uid = stbuf->st_uid; + uid = stbuf->ia_uid; if (valid & GF_SET_ATTR_GID) - gid = stbuf->st_gid; + gid = stbuf->ia_gid; ret = lchown (path, uid, gid); @@ -609,15 +619,15 @@ posix_do_chown (xlator_t *this, static int posix_do_utimes (xlator_t *this, const char *path, - struct stat *stbuf) + struct iatt *stbuf) { int32_t ret = -1; struct timeval tv[2] = {{0,},{0,}}; - tv[0].tv_sec = stbuf->st_atime; - tv[0].tv_usec = ST_ATIM_NSEC (stbuf) / 1000; - tv[1].tv_sec = stbuf->st_mtime; - tv[1].tv_usec = ST_MTIM_NSEC (stbuf) / 1000; + tv[0].tv_sec = stbuf->ia_atime; + tv[0].tv_usec = stbuf->ia_atime_nsec / 1000; + tv[1].tv_sec = stbuf->ia_mtime; + tv[1].tv_usec = stbuf->ia_mtime_nsec / 1000; ret = utimes (path, tv); @@ -626,13 +636,13 @@ posix_do_utimes (xlator_t *this, int posix_setattr (call_frame_t *frame, xlator_t *this, - loc_t *loc, struct stat *stbuf, int32_t valid) + loc_t *loc, struct iatt *stbuf, int32_t valid) { int32_t op_ret = -1; int32_t op_errno = 0; char * real_path = 0; - struct stat statpre = {0,}; - struct stat statpost = {0,}; + struct iatt statpre = {0,}; + struct iatt statpost = {0,}; DECLARE_OLD_FS_ID_VAR; @@ -720,7 +730,7 @@ out: int32_t posix_do_fchown (xlator_t *this, int fd, - struct stat *stbuf, + struct iatt *stbuf, int32_t valid) { int ret = -1; @@ -728,10 +738,10 @@ posix_do_fchown (xlator_t *this, gid_t gid = -1; if (valid & GF_SET_ATTR_UID) - uid = stbuf->st_uid; + uid = stbuf->ia_uid; if (valid & GF_SET_ATTR_GID) - gid = stbuf->st_gid; + gid = stbuf->ia_gid; ret = fchown (fd, uid, gid); @@ -741,15 +751,18 @@ posix_do_fchown (xlator_t *this, int32_t posix_do_fchmod (xlator_t *this, - int fd, struct stat *stbuf) + int fd, struct iatt *stbuf) { - return fchmod (fd, stbuf->st_mode); + mode_t mode = 0; + + mode = st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type); + return fchmod (fd, mode); } static int posix_do_futimes (xlator_t *this, int fd, - struct stat *stbuf) + struct iatt *stbuf) { errno = ENOSYS; return -1; @@ -757,12 +770,12 @@ posix_do_futimes (xlator_t *this, int posix_fsetattr (call_frame_t *frame, xlator_t *this, - fd_t *fd, struct stat *stbuf, int32_t valid) + fd_t *fd, struct iatt *stbuf, int32_t valid) { int32_t op_ret = -1; int32_t op_errno = 0; - struct stat statpre = {0,}; - struct stat statpost = {0,}; + struct iatt statpre = {0,}; + struct iatt statpost = {0,}; struct posix_fd *pfd = NULL; uint64_t tmp_pfd = 0; int32_t ret = -1; @@ -940,185 +953,11 @@ posix_opendir (call_frame_t *frame, xlator_t *this, } -int32_t +int posix_getdents (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t off, int32_t flag) { - int32_t op_ret = -1; - int32_t op_errno = 0; - char *real_path = NULL; - dir_entry_t entries = {0, }; - dir_entry_t *tmp = NULL; - DIR *dir = NULL; - struct dirent *dirent = NULL; - int real_path_len = -1; - int entry_path_len = -1; - char *entry_path = NULL; - int count = 0; - struct posix_fd *pfd = NULL; - uint64_t tmp_pfd = 0; - struct stat buf = {0,}; - int ret = -1; - char tmp_real_path[ZR_PATH_MAX]; - char linkpath[ZR_PATH_MAX]; - struct posix_private *priv = NULL; - - DECLARE_OLD_FS_ID_VAR ; - - VALIDATE_OR_GOTO (frame, out); - VALIDATE_OR_GOTO (this, out); - VALIDATE_OR_GOTO (fd, out); - - priv = this->private; - VALIDATE_OR_GOTO (priv, out); - - SET_FS_ID (frame->root->uid, frame->root->gid); - - ret = fd_ctx_get (fd, this, &tmp_pfd); - if (ret < 0) { - op_errno = -ret; - gf_log (this->name, GF_LOG_DEBUG, - "fd %p does not have context in %s", - fd, this->name); - goto out; - } - pfd = (struct posix_fd *)(long)tmp_pfd; - if (!pfd->path) { - op_errno = EBADFD; - gf_log (this->name, GF_LOG_DEBUG, - "pfd does not have path set (possibly file " - "fd, fd=%p)", fd); - goto out; - } - - real_path = pfd->path; - real_path_len = strlen (real_path); - - entry_path_len = real_path_len + NAME_MAX; - entry_path = CALLOC (1, entry_path_len); - - if (!entry_path) { - op_errno = errno; - gf_log (this->name, GF_LOG_ERROR, - "Out of memory."); - goto out; - } - - strncpy (entry_path, real_path, entry_path_len); - entry_path[real_path_len] = '/'; - - dir = pfd->dir; - - if (!dir) { - op_errno = EBADFD; - gf_log (this->name, GF_LOG_DEBUG, - "pfd does not have dir set (possibly file fd, " - "fd=%p, path=`%s'", - fd, real_path); - goto out; - } - - /* TODO: check for all the type of flag, and behave appropriately */ - - while ((dirent = readdir (dir))) { - if (!dirent) - break; - - /* This helps in self-heal, when only directories - needs to be replicated */ - - /* This is to reduce the network traffic, in case only - directory is needed from posix */ - - strncpy (tmp_real_path, real_path, ZR_PATH_MAX); - strncat (tmp_real_path, "/", - ZR_PATH_MAX - strlen (tmp_real_path)); - - strncat (tmp_real_path, dirent->d_name, - ZR_PATH_MAX - (strlen (tmp_real_path) + 1)); - - ret = posix_lstat_with_gen (this, tmp_real_path, &buf); - - if ((flag == GF_GET_DIR_ONLY) - && (ret != -1 && !S_ISDIR(buf.st_mode))) { - continue; - } - - tmp = CALLOC (1, sizeof (*tmp)); - - if (!tmp) { - op_errno = errno; - gf_log (this->name, GF_LOG_ERROR, - "Out of memory."); - goto out; - } - - tmp->name = strdup (dirent->d_name); - if (!tmp->name) { - op_errno = errno; - gf_log (this->name, GF_LOG_ERROR, - "Out of memory."); - goto out; - } - - if (entry_path_len < - (real_path_len + 1 + strlen (tmp->name) + 1)) { - entry_path_len = (real_path_len + - strlen (tmp->name) + 1024); - - entry_path = realloc (entry_path, entry_path_len); - } - - strcpy (&entry_path[real_path_len+1], tmp->name); - - tmp->buf = buf; - - if (S_ISLNK(tmp->buf.st_mode)) { - - ret = readlink (entry_path, linkpath, ZR_PATH_MAX); - if (ret != -1) { - linkpath[ret] = '\0'; - tmp->link = strdup (linkpath); - } - } else { - tmp->link = ""; - } - - count++; - - tmp->next = entries.next; - entries.next = tmp; - - /* if size is 0, count can never be = size, so entire - dir is read */ - if (count == size) - break; - } - - FREE (entry_path); - - op_ret = 0; - - out: - SET_TO_OLD_FS_ID (); - - if (op_ret == -1) { - if (entry_path) - FREE (entry_path); - } - - STACK_UNWIND_STRICT (getdents, frame, op_ret, op_errno, - &entries, count); - - if (op_ret == 0) { - while (entries.next) { - tmp = entries.next; - entries.next = entries.next->next; - FREE (tmp->name); - FREE (tmp); - } - } - + STACK_UNWIND_STRICT (getdents, frame, -1, ENOSYS, NULL, 0); return 0; } @@ -1188,7 +1027,7 @@ posix_readlink (call_frame_t *frame, xlator_t *this, int32_t lstat_ret = -1; int32_t op_errno = 0; char * real_path = NULL; - struct stat stbuf = {0,}; + struct iatt stbuf = {0,}; DECLARE_OLD_FS_ID_VAR; @@ -1237,13 +1076,13 @@ posix_mknod (call_frame_t *frame, xlator_t *this, int32_t op_ret = -1; int32_t op_errno = 0; char *real_path = 0; - struct stat stbuf = { 0, }; + struct iatt stbuf = { 0, }; char was_present = 1; struct posix_private *priv = NULL; gid_t gid = 0; char *pathdup = NULL; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; char *parentpath = NULL; DECLARE_OLD_FS_ID_VAR; @@ -1503,14 +1342,14 @@ posix_mkdir (call_frame_t *frame, xlator_t *this, int32_t op_ret = -1; int32_t op_errno = 0; char *real_path = NULL; - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; char was_present = 1; struct posix_private *priv = NULL; gid_t gid = 0; char *pathdup = NULL; char *parentpath = NULL; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; DECLARE_OLD_FS_ID_VAR; @@ -1617,8 +1456,8 @@ posix_unlink (call_frame_t *frame, xlator_t *this, char *parentpath = NULL; int32_t fd = -1; struct posix_private *priv = NULL; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; DECLARE_OLD_FS_ID_VAR; @@ -1645,7 +1484,7 @@ posix_unlink (call_frame_t *frame, xlator_t *this, priv = this->private; if (priv->background_unlink) { - if (S_ISREG (loc->inode->st_mode)) { + if (IA_ISREG (loc->inode->ia_type)) { fd = open (real_path, O_RDONLY); if (fd == -1) { op_ret = -1; @@ -1703,8 +1542,8 @@ posix_rmdir (call_frame_t *frame, xlator_t *this, char * real_path = NULL; char * pathdup = NULL; char * parentpath = NULL; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; DECLARE_OLD_FS_ID_VAR; @@ -1774,14 +1613,14 @@ posix_symlink (call_frame_t *frame, xlator_t *this, int32_t op_ret = -1; int32_t op_errno = 0; char * real_path = 0; - struct stat stbuf = { 0, }; + struct iatt stbuf = { 0, }; struct posix_private *priv = NULL; gid_t gid = 0; char was_present = 1; char *pathdup = NULL; char *parentpath = NULL; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; DECLARE_OLD_FS_ID_VAR; @@ -1886,17 +1725,17 @@ posix_rename (call_frame_t *frame, xlator_t *this, int32_t op_errno = 0; char *real_oldpath = NULL; char *real_newpath = NULL; - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; struct posix_private *priv = NULL; char was_present = 1; char *oldpathdup = NULL; char *oldparentpath = NULL; char *newpathdup = NULL; char *newparentpath = NULL; - struct stat preoldparent = {0, }; - struct stat postoldparent = {0, }; - struct stat prenewparent = {0, }; - struct stat postnewparent = {0, }; + struct iatt preoldparent = {0, }; + struct iatt postoldparent = {0, }; + struct iatt prenewparent = {0, }; + struct iatt postnewparent = {0, }; DECLARE_OLD_FS_ID_VAR; @@ -2014,13 +1853,13 @@ posix_link (call_frame_t *frame, xlator_t *this, int32_t op_errno = 0; char *real_oldpath = 0; char *real_newpath = 0; - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; struct posix_private *priv = NULL; char was_present = 1; char *newpathdup = NULL; char *newparentpath = NULL; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; DECLARE_OLD_FS_ID_VAR; @@ -2111,8 +1950,8 @@ posix_truncate (call_frame_t *frame, int32_t op_errno = 0; char *real_path = 0; struct posix_private *priv = NULL; - struct stat prebuf = {0,}; - struct stat postbuf = {0,}; + struct iatt prebuf = {0,}; + struct iatt postbuf = {0,}; DECLARE_OLD_FS_ID_VAR; @@ -2174,7 +2013,7 @@ posix_create (call_frame_t *frame, xlator_t *this, int32_t _fd = -1; int _flags = 0; char * real_path = NULL; - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; struct posix_fd * pfd = NULL; struct posix_private * priv = NULL; char was_present = 1; @@ -2182,8 +2021,8 @@ posix_create (call_frame_t *frame, xlator_t *this, gid_t gid = 0; char *pathdup = NULL; char *parentpath = NULL; - struct stat preparent = {0,}; - struct stat postparent = {0,}; + struct iatt preparent = {0,}; + struct iatt postparent = {0,}; DECLARE_OLD_FS_ID_VAR; @@ -2327,7 +2166,7 @@ posix_open (call_frame_t *frame, xlator_t *this, struct posix_private *priv = NULL; char was_present = 1; gid_t gid = 0; - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; DECLARE_OLD_FS_ID_VAR; @@ -2443,7 +2282,7 @@ posix_readv (call_frame_t *frame, xlator_t *this, struct iobref * iobref = NULL; struct iovec vec = {0,}; struct posix_fd * pfd = NULL; - struct stat stbuf = {0,}; + struct iatt stbuf = {0,}; int align = 1; int ret = -1; @@ -2531,9 +2370,9 @@ posix_readv (call_frame_t *frame, xlator_t *this, } /* Hack to notify higher layers of EOF. */ - if (stbuf.st_size == 0) + if (stbuf.ia_size == 0) op_errno = ENOENT; - else if ((offset + vec.iov_len) == stbuf.st_size) + else if ((offset + vec.iov_len) == stbuf.ia_size) op_errno = ENOENT; op_ret = vec.iov_len; @@ -2561,8 +2400,8 @@ posix_writev (call_frame_t *frame, xlator_t *this, int _fd = -1; struct posix_private * priv = NULL; struct posix_fd * pfd = NULL; - struct stat preop = {0,}; - struct stat postop = {0,}; + struct iatt preop = {0,}; + struct iatt postop = {0,}; int ret = -1; int idx = 0; @@ -2859,8 +2698,8 @@ posix_fsync (call_frame_t *frame, xlator_t *this, struct posix_fd * pfd = NULL; int ret = -1; uint64_t tmp_pfd = 0; - struct stat preop = {0,}; - struct stat postop = {0,}; + struct iatt preop = {0,}; + struct iatt postop = {0,}; DECLARE_OLD_FS_ID_VAR; @@ -3111,7 +2950,7 @@ get_file_contents (xlator_t *this, char *real_path, char real_filepath[ZR_PATH_MAX] = {0,}; char * key = NULL; int32_t file_fd = -1; - struct stat stbuf = {0,}; + struct iatt stbuf = {0,}; int op_ret = 0; int ret = -1; @@ -3135,7 +2974,7 @@ get_file_contents (xlator_t *this, char *real_path, goto out; } - *contents = CALLOC (stbuf.st_size + 1, sizeof(char)); + *contents = CALLOC (stbuf.ia_size + 1, sizeof(char)); if (! *contents) { op_ret = -errno; @@ -3143,7 +2982,7 @@ get_file_contents (xlator_t *this, char *real_path, goto out; } - ret = read (file_fd, *contents, stbuf.st_size); + ret = read (file_fd, *contents, stbuf.ia_size); if (ret <= 0) { op_ret = -1; gf_log (this->name, GF_LOG_ERROR, "read on %s failed: %s", @@ -3151,7 +2990,7 @@ get_file_contents (xlator_t *this, char *real_path, goto out; } - *contents[stbuf.st_size] = '\0'; + *contents[stbuf.ia_size] = '\0'; op_ret = close (file_fd); file_fd = -1; @@ -3208,7 +3047,7 @@ posix_getxattr (call_frame_t *frame, xlator_t *this, priv = this->private; - if (loc->inode && S_ISDIR(loc->inode->st_mode) && name && + if (loc->inode && IA_ISDIR(loc->inode->ia_type) && name && ZR_FILE_CONTENT_REQUEST(name)) { ret = get_file_contents (this, real_path, name, &file_contents); @@ -3228,7 +3067,7 @@ posix_getxattr (call_frame_t *frame, xlator_t *this, goto out; } - if (loc->inode && S_ISREG (loc->inode->st_mode) && name && + if (loc->inode && IA_ISREG (loc->inode->ia_type) && name && (strcmp (name, "trusted.glusterfs.location") == 0)) { ret = dict_set_static_ptr (dict, "trusted.glusterfs.location", @@ -3884,8 +3723,8 @@ posix_ftruncate (call_frame_t *frame, xlator_t *this, int32_t op_ret = -1; int32_t op_errno = 0; int _fd = -1; - struct stat preop = {0,}; - struct stat postop = {0,}; + struct iatt preop = {0,}; + struct iatt postop = {0,}; struct posix_fd *pfd = NULL; int ret = -1; uint64_t tmp_pfd = 0; @@ -3951,300 +3790,17 @@ posix_ftruncate (call_frame_t *frame, xlator_t *this, } -static int -same_file_type (mode_t m1, mode_t m2) -{ - return ((S_IFMT & (m1 ^ m2)) == 0); -} - - -static int -ensure_file_type (xlator_t *this, char *pathname, mode_t mode) -{ - struct stat stbuf = {0,}; - int op_ret = 0; - int ret = -1; - - ret = posix_lstat_with_gen (this, pathname, &stbuf); - if (ret == -1) { - op_ret = -errno; - gf_log (this->name, GF_LOG_ERROR, - "stat failed while trying to make sure entry %s " - "is a directory: %s", pathname, strerror (errno)); - goto out; - } - - if (!same_file_type (mode, stbuf.st_mode)) { - op_ret = -EEXIST; - gf_log (this->name, GF_LOG_ERROR, - "entry %s is a different type of file " - "than expected", pathname); - goto out; - } - out: - return op_ret; -} - -static int -create_entry (xlator_t *this, int32_t flags, - dir_entry_t *entry, char *pathname) -{ - int op_ret = 0; - int ret = -1; - struct timeval tv[2] = {{0,0},{0,0}}; - - if (S_ISDIR (entry->buf.st_mode)) { - /* - * If the entry is directory, create it by - * calling 'mkdir'. If the entry is already - * present, check if it is a directory, - * and issue a warning if otherwise. - */ - - ret = mkdir (pathname, entry->buf.st_mode); - if (ret == -1) { - if (errno == EEXIST) { - op_ret = ensure_file_type (this, pathname, - entry->buf.st_mode); - } - else { - op_ret = -errno; - gf_log (this->name, GF_LOG_ERROR, - "mkdir %s with mode (0%o) failed: %s", - pathname, entry->buf.st_mode, - strerror (errno)); - goto out; - } - } - - } else if ((flags & GF_SET_IF_NOT_PRESENT) - || !(flags & GF_SET_DIR_ONLY)) { - - /* create a 0-byte file here */ - - if (S_ISREG (entry->buf.st_mode)) { - ret = open (pathname, O_CREAT|O_EXCL, - entry->buf.st_mode); - - if (ret == -1) { - if (errno == EEXIST) { - op_ret = ensure_file_type (this, - pathname, - entry->buf.st_mode); - } - else { - op_ret = -errno; - gf_log (this->name, GF_LOG_ERROR, - "Error creating file %s with " - "mode (0%o): %s", - pathname, entry->buf.st_mode, - strerror (errno)); - goto out; - } - } - - close (ret); - - } else if (S_ISLNK (entry->buf.st_mode)) { - ret = symlink (entry->link, pathname); - - if (ret == -1) { - if (errno == EEXIST) { - op_ret = ensure_file_type (this, - pathname, - entry->buf.st_mode); - } - else { - op_ret = -errno; - gf_log (this->name, GF_LOG_ERROR, - "error creating symlink %s: %s" - , pathname, strerror (errno)); - goto out; - } - } - - } else if (S_ISBLK (entry->buf.st_mode) || - S_ISCHR (entry->buf.st_mode) || - S_ISFIFO (entry->buf.st_mode) || - S_ISSOCK (entry->buf.st_mode)) { - - ret = mknod (pathname, entry->buf.st_mode, - entry->buf.st_dev); - - if (ret == -1) { - if (errno == EEXIST) { - op_ret = ensure_file_type (this, - pathname, - entry->buf.st_mode); - } else { - op_ret = -errno; - gf_log (this->name, GF_LOG_ERROR, - "error creating device file " - "%s: %s", - pathname, strerror (errno)); - goto out; - } - } - } else { - gf_log (this->name, GF_LOG_ERROR, - "invalid mode 0%o for %s", entry->buf.st_mode, - pathname); - op_ret = -EINVAL; - goto out; - } - } - - /* - * Preserve atime and mtime - */ - - if (!S_ISLNK (entry->buf.st_mode)) { - tv[0].tv_sec = entry->buf.st_atime; - tv[1].tv_sec = entry->buf.st_mtime; - ret = utimes (pathname, tv); - if (ret == -1) { - op_ret = -errno; - gf_log (this->name, GF_LOG_ERROR, - "utimes %s failed: %s", - pathname, strerror (errno)); - goto out; - } - } - -out: - return op_ret; - -} - - int posix_setdents (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, dir_entry_t *entries, int32_t count) { - char * real_path = NULL; - char * entry_path = NULL; - int32_t real_path_len = -1; - int32_t entry_path_len = -1; - int32_t ret = 0; - int32_t op_ret = -1; - int32_t op_errno = 0; - struct posix_fd * pfd = {0, }; - struct timeval tv[2] = {{0, }, {0, }}; - uint64_t tmp_pfd = 0; - char pathname[ZR_PATH_MAX] = {0,}; - dir_entry_t * trav = NULL; - - VALIDATE_OR_GOTO (frame, out); - VALIDATE_OR_GOTO (this, out); - VALIDATE_OR_GOTO (fd, out); - VALIDATE_OR_GOTO (entries, out); - - tv[0].tv_sec = tv[0].tv_usec = 0; - tv[1].tv_sec = tv[1].tv_usec = 0; - - ret = fd_ctx_get (fd, this, &tmp_pfd); - if (ret < 0) { - op_errno = -ret; - gf_log (this->name, GF_LOG_DEBUG, - "fd's ctx not found on fd=%p for %s", - fd, this->name); - goto out; - } - pfd = (struct posix_fd *)(long)tmp_pfd; - - real_path = pfd->path; - - if (!real_path) { - op_errno = EINVAL; - gf_log (this->name, GF_LOG_DEBUG, - "path is NULL on pfd=%p fd=%p", pfd, fd); - goto out; - } - - real_path_len = strlen (real_path); - entry_path_len = real_path_len + 256; - entry_path = CALLOC (1, entry_path_len); - - if (!entry_path) { - op_errno = errno; - gf_log (this->name, GF_LOG_ERROR, "Out of memory."); - goto out; - } - - strcpy (entry_path, real_path); - entry_path[real_path_len] = '/'; - - /* fd exists, and everything looks fine */ - /** - * create an entry for each one present in '@entries' - * - if flag is set (ie, if its namespace), create both directories - * and files - * - if not set, create only directories. - * - * after the entry is created, change the mode and ownership of the - * entry according to the stat present in entries->buf. - */ - - trav = entries->next; - while (trav) { - strcpy (pathname, entry_path); - strcat (pathname, trav->name); - - ret = create_entry (this, flags, trav, pathname); - if (ret < 0) { - op_errno = -ret; - goto out; - } - - /* TODO: handle another flag, GF_SET_OVERWRITE */ - - /* Change the mode */ - if (!S_ISLNK (trav->buf.st_mode)) { - ret = chmod (pathname, trav->buf.st_mode); - if (ret == -1) { - op_errno = errno; - gf_log (this->name, GF_LOG_ERROR, - "chmod on %s failed: %s", pathname, - strerror (op_errno)); - goto out; - } - } - - /* change the ownership */ - ret = lchown (pathname, trav->buf.st_uid, trav->buf.st_gid); - if (ret == -1) { - op_errno = errno; - gf_log (this->name, GF_LOG_ERROR, - "chmod on %s failed: %s", pathname, - strerror (op_errno)); - goto out; - } - - if (flags & GF_SET_EPOCH_TIME) { - ret = utimes (pathname, tv); - if (ret == -1) { - op_errno = errno; - gf_log (this->name, GF_LOG_ERROR, - "utimes on %s failed: %s", pathname, - strerror (op_errno)); - goto out; - } - } - - /* consider the next entry */ - trav = trav->next; - } - - op_ret = 0; - out: - STACK_UNWIND_STRICT (setdents, frame, op_ret, op_errno); - if (entry_path) - FREE (entry_path); + STACK_UNWIND_STRICT (setdents, frame, -1, ENOSYS); return 0; } + int32_t posix_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd) @@ -4252,7 +3808,7 @@ posix_fstat (call_frame_t *frame, xlator_t *this, int _fd = -1; int32_t op_ret = -1; int32_t op_errno = 0; - struct stat buf = {0,}; + struct iatt buf = {0,}; struct posix_fd *pfd = NULL; uint64_t tmp_pfd = 0; int ret = -1; @@ -4389,7 +3945,7 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this, char *entry_path = NULL; int entry_path_len = -1; struct posix_private *priv = NULL; - struct stat stbuf = {0, }; + struct iatt stbuf = {0, }; VALIDATE_OR_GOTO (frame, out); VALIDATE_OR_GOTO (this, out); @@ -4489,7 +4045,7 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this, if (-1 == op_ret) continue; } else - stbuf.st_ino = entry->d_ino; + stbuf.ia_ino = entry->d_ino; /* So at this point stbuf ino is either: * a. the original inode number got from entry, in case this @@ -4498,7 +4054,7 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this, * b. the scaled inode number, if device spanning was enabled * or this was a readdirp fop. */ - entry->d_ino = stbuf.st_ino; + entry->d_ino = stbuf.ia_ino; this_entry = gf_dirent_for_name (entry->d_name); @@ -4665,7 +4221,7 @@ posix_checksum (call_frame_t *frame, xlator_t *this, int i = 0; int length = 0; - struct stat buf = {0,}; + struct iatt buf = {0,}; char tmp_real_path[ZR_PATH_MAX] = {0,}; int ret = -1; @@ -4704,7 +4260,7 @@ posix_checksum (call_frame_t *frame, xlator_t *this, if (ret == -1) continue; - if (S_ISDIR (buf.st_mode)) { + if (IA_ISDIR (buf.ia_type)) { for (i = 0; i < length; i++) dir_checksum[i] ^= dirent->d_name[i]; } else { -- cgit