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/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 +++++++++++++++-------------- 6 files changed, 209 insertions(+), 202 deletions(-) (limited to 'xlators/features') diff --git a/xlators/features/filter/src/filter.c b/xlators/features/filter/src/filter.c index 1d50991137a..0f5e67fb0fd 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 3df1312e55e..83800ff5aeb 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 06f4de17dff..2e6afd9fca6 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 d58f0f3cb59..3589e1485c7 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 1936818211c..822c29bd375 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 aa5cea0d156..3d41ab798ee 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; } -- cgit