From 868287aa5f70bdfcf7f56663e042d74fe1acf0db Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Sat, 15 Feb 2014 17:54:38 +0530 Subject: performance/io-threads: Remove code duplication Change-Id: Ic905cc6074c796efce2972857b79ab53700a2de4 BUG: 1065657 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/7010 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/defaults.c | 346 ++++ libglusterfs/src/defaults.h | 137 ++ xlators/performance/io-threads/src/io-threads.c | 2158 ++--------------------- 3 files changed, 653 insertions(+), 1988 deletions(-) diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c index e6b1287f9..f5fb2aa9d 100644 --- a/libglusterfs/src/defaults.c +++ b/libglusterfs/src/defaults.c @@ -27,6 +27,352 @@ #include "xlator.h" +/* FAILURE_CBK function section */ + +int32_t +default_lookup_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (lookup, frame, -1, op_errno, NULL, NULL, + NULL, NULL); + return 0; +} + +int32_t +default_stat_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (stat, frame, -1, op_errno, NULL, NULL); + return 0; +} + + +int32_t +default_truncate_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (truncate, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_ftruncate_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (ftruncate, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_access_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (access, frame, -1, op_errno, NULL); + return 0; +} + +int32_t +default_readlink_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (readlink, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + + +int32_t +default_mknod_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (mknod, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL); + return 0; +} + +int32_t +default_mkdir_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (mkdir, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL); + return 0; +} + +int32_t +default_unlink_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (unlink, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_rmdir_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (rmdir, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + + +int32_t +default_symlink_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (symlink, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL); + return 0; +} + + +int32_t +default_rename_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (rename, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL, NULL); + return 0; +} + + +int32_t +default_link_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (link, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL); + return 0; +} + + +int32_t +default_create_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (create, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL, NULL); + return 0; +} + +int32_t +default_open_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (open, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_readv_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (readv, frame, -1, op_errno, NULL, -1, NULL, + NULL, NULL); + return 0; +} + +int32_t +default_writev_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (writev, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + + +int32_t +default_flush_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (flush, frame, -1, op_errno, NULL); + return 0; +} + + + +int32_t +default_fsync_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fsync, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_fstat_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fstat, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_opendir_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (opendir, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_fsyncdir_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fsyncdir, frame, -1, op_errno, NULL); + return 0; +} + +int32_t +default_statfs_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (statfs, frame, -1, op_errno, NULL, NULL); + return 0; +} + + +int32_t +default_setxattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (setxattr, frame, -1, op_errno, NULL); + return 0; +} + + +int32_t +default_fsetxattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fsetxattr, frame, -1, op_errno, NULL); + return 0; +} + + + +int32_t +default_fgetxattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fgetxattr, frame, -1, op_errno, NULL, NULL); + return 0; +} + + +int32_t +default_getxattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (getxattr, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_xattrop_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (xattrop, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_fxattrop_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fxattrop, frame, -1, op_errno, NULL, NULL); + return 0; +} + + +int32_t +default_removexattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (removexattr, frame, -1, op_errno, NULL); + return 0; +} + + +int32_t +default_fremovexattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fremovexattr, frame, -1, op_errno, NULL); + return 0; +} + +int32_t +default_lk_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (lk, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_inodelk_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (inodelk, frame, -1, op_errno, NULL); + return 0; +} + + +int32_t +default_finodelk_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (finodelk, frame, -1, op_errno, NULL); + return 0; +} + +int32_t +default_entrylk_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (entrylk, frame, -1, op_errno, NULL); + return 0; +} + +int32_t +default_fentrylk_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fentrylk, frame, -1, op_errno, NULL); + return 0; +} + + +int32_t +default_rchecksum_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (rchecksum, frame, -1, op_errno, -1, NULL, NULL); + return 0; +} + + +int32_t +default_readdir_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (readdir, frame, -1, op_errno, NULL, NULL); + return 0; +} + + +int32_t +default_readdirp_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (readdirp, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_setattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (setattr, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_fsetattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fsetattr, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_fallocate_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT(fallocate, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_discard_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT(discard, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_zerofill_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT(zerofill, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + + +int32_t +default_getspec_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (getspec, frame, -1, op_errno, NULL); + return 0; +} + /* _CBK function section */ int32_t diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h index 0fb5572ac..f0b786ddf 100644 --- a/libglusterfs/src/defaults.h +++ b/libglusterfs/src/defaults.h @@ -717,6 +717,143 @@ int32_t default_getspec_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, char *spec_data); +int32_t +default_lookup_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_stat_failure_cbk (call_frame_t *frame, int32_t op_errno); + + +int32_t +default_truncate_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_ftruncate_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_access_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_readlink_failure_cbk (call_frame_t *frame, int32_t op_errno); + + +int32_t +default_mknod_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_mkdir_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_unlink_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_rmdir_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_symlink_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_rename_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_link_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_create_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_open_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_readv_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_writev_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_flush_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fsync_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fstat_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_opendir_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fsyncdir_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_statfs_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_setxattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fsetxattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fgetxattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_getxattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_xattrop_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fxattrop_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_removexattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fremovexattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_lk_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_inodelk_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_finodelk_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_entrylk_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fentrylk_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_rchecksum_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_readdir_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_readdirp_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_setattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fsetattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fallocate_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_discard_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_zerofill_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_getspec_failure_cbk (call_frame_t *frame, int32_t op_errno); + int32_t default_mem_acct_init (xlator_t *this); diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index 4dd7a9973..8201a95a4 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -14,6 +14,7 @@ #endif #include "call-stub.h" +#include "defaults.h" #include "glusterfs.h" #include "logging.h" #include "dict.h" @@ -29,6 +30,28 @@ int iot_workers_scale (iot_conf_t *conf); int __iot_workers_scale (iot_conf_t *conf); struct volume_options options[]; +#define IOT_FOP(name, frame, this, args ...) \ + do { \ + call_stub_t *__stub = NULL; \ + int __ret = -1; \ + \ + __stub = fop_##name##_stub(frame, default_##name##_resume, args); \ + if (!__stub) { \ + __ret = -ENOMEM; \ + goto out; \ + } \ + \ + __ret = iot_schedule (frame, this, __stub); \ + \ + out: \ + if (__ret < 0) { \ + default_##name##_failure_cbk (frame, -__ret); \ + if (__stub != NULL) { \ + call_stub_destroy (__stub); \ + } \ + } \ + } while (0) + call_stub_t * __iot_dequeue (iot_conf_t *conf, int *pri, struct timespec *sleep) { @@ -331,2230 +354,389 @@ out: } 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 iatt *buf, dict_t *xdata, - struct iatt *postparent) +iot_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) { - STACK_UNWIND_STRICT (lookup, frame, op_ret, op_errno, inode, buf, xdata, - postparent); + IOT_FOP (lookup, frame, this, loc, xdata); return 0; } int -iot_lookup_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) +iot_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, + struct iatt *stbuf, int32_t valid, dict_t *xdata) { - STACK_WIND (frame, iot_lookup_cbk, - FIRST_CHILD (this), - FIRST_CHILD (this)->fops->lookup, - loc, xdata); + IOT_FOP (setattr, frame, this, loc, stbuf, valid, xdata); return 0; } int -iot_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) +iot_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, + struct iatt *stbuf, int32_t valid, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_lookup_stub (frame, iot_lookup_wrapper, loc, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create lookup stub (out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - if (stub != NULL) { - call_stub_destroy (stub); - } - STACK_UNWIND_STRICT (lookup, frame, -1, -ret, NULL, NULL, NULL, - NULL); - } - + IOT_FOP (fsetattr, frame, this, fd, stbuf, valid, xdata); return 0; } int -iot_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - struct iatt *preop, struct iatt *postop, dict_t *xdata) +iot_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask, + dict_t *xdata) { - STACK_UNWIND_STRICT (setattr, frame, op_ret, op_errno, preop, postop, - xdata); + IOT_FOP (access, frame, this, loc, mask, xdata); return 0; } int -iot_setattr_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct iatt *stbuf, int32_t valid, dict_t *xdata) +iot_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size, dict_t *xdata) { - STACK_WIND (frame, iot_setattr_cbk, - FIRST_CHILD (this), - FIRST_CHILD (this)->fops->setattr, - loc, stbuf, valid, xdata); + IOT_FOP (readlink, frame, this, loc, size, xdata); return 0; } int -iot_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct iatt *stbuf, int32_t valid, dict_t *xdata) +iot_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, + dev_t rdev, mode_t umask, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_setattr_stub (frame, iot_setattr_wrapper, loc, stbuf, valid, - xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "Cannot create setattr stub" - "(Out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - if (stub != NULL) { - call_stub_destroy (stub); - } - - STACK_UNWIND_STRICT (setattr, frame, -1, -ret, NULL, NULL, NULL); - } - + IOT_FOP (mknod, frame, this, loc, mode, rdev, umask, xdata); return 0; } int -iot_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - struct iatt *preop, struct iatt *postop, dict_t *xdata) +iot_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, + mode_t umask, dict_t *xdata) { - STACK_UNWIND_STRICT (fsetattr, frame, op_ret, op_errno, preop, postop, - xdata); + IOT_FOP (mkdir, frame, this, loc, mode, umask, xdata); return 0; } int -iot_fsetattr_wrapper (call_frame_t *frame, xlator_t *this, - fd_t *fd, struct iatt *stbuf, int32_t valid, dict_t *xdata) +iot_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, dict_t *xdata) { - STACK_WIND (frame, iot_fsetattr_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fsetattr, fd, stbuf, valid, - xdata); + IOT_FOP (rmdir, frame, this, loc, flags, xdata); return 0; } int -iot_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct iatt *stbuf, int32_t valid, dict_t *xdata) +iot_symlink (call_frame_t *frame, xlator_t *this, const char *linkname, + loc_t *loc, mode_t umask, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fsetattr_stub (frame, iot_fsetattr_wrapper, fd, stbuf, - valid, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create fsetattr stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fsetattr, frame, -1, -ret, NULL, NULL, - NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } + IOT_FOP (symlink, frame, this, linkname, loc, umask, xdata); return 0; } int -iot_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) +iot_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, + dict_t *xdata) { - STACK_UNWIND_STRICT (access, frame, op_ret, op_errno, xdata); + IOT_FOP (rename, frame, this, oldloc, newloc, xdata); return 0; } int -iot_access_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t mask, dict_t *xdata) +iot_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + fd_t *fd, dict_t *xdata) { - STACK_WIND (frame, iot_access_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->access, loc, mask, xdata); + IOT_FOP (open, frame, this, loc, flags, fd, xdata); return 0; } int -iot_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask, - dict_t *xdata) +iot_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_access_stub (frame, iot_access_wrapper, loc, mask, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create access stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (access, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } + IOT_FOP (create, frame, this, loc, flags, mode, umask, fd, xdata); return 0; } 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 iatt *stbuf, dict_t *xdata) +iot_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, + off_t offset, uint32_t flags, dict_t *xdata) { - STACK_UNWIND_STRICT (readlink, frame, op_ret, op_errno, path, stbuf, - xdata); + IOT_FOP (readv, frame, this, fd, size, offset, flags, xdata); return 0; } int -iot_readlink_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - size_t size, dict_t *xdata) +iot_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) { - STACK_WIND (frame, iot_readlink_cbk, - FIRST_CHILD (this), - FIRST_CHILD (this)->fops->readlink, - loc, size, xdata); + IOT_FOP (flush, frame, this, fd, xdata); return 0; } int -iot_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size, dict_t *xdata) +iot_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t datasync, + dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_readlink_stub (frame, iot_readlink_wrapper, loc, size, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create readlink stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (readlink, frame, -1, -ret, NULL, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - + IOT_FOP (fsync, frame, this, fd, datasync, xdata); return 0; } 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 iatt *buf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) +iot_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, + struct iovec *vector, int32_t count, off_t offset, + uint32_t flags, struct iobref *iobref, dict_t *xdata) { - STACK_UNWIND_STRICT (mknod, frame, op_ret, op_errno, inode, buf, - preparent, postparent, xdata); + IOT_FOP (writev, frame, this, fd, vector, count, offset, + flags, iobref, xdata); return 0; } int -iot_mknod_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, - dev_t rdev, mode_t umask, dict_t *xdata) +iot_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, + struct gf_flock *flock, dict_t *xdata) { - STACK_WIND (frame, iot_mknod_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->mknod, loc, mode, rdev, umask, - xdata); + IOT_FOP (lk, frame, this, fd, cmd, flock, xdata); return 0; } int -iot_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, - dev_t rdev, mode_t umask, dict_t *xdata) +iot_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_mknod_stub (frame, iot_mknod_wrapper, loc, mode, rdev, - umask, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create mknod stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (mknod, frame, -1, -ret, NULL, NULL, NULL, - NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } + IOT_FOP (stat, frame, this, loc, xdata); return 0; } 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 iatt *buf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) +iot_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) { - STACK_UNWIND_STRICT (mkdir, frame, op_ret, op_errno, inode, buf, - preparent, postparent, xdata); + IOT_FOP (fstat, frame, this, fd, xdata); return 0; } int -iot_mkdir_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, - mode_t umask, dict_t *xdata) +iot_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, + dict_t *xdata) { - STACK_WIND (frame, iot_mkdir_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->mkdir, loc, mode, umask, xdata); + IOT_FOP (truncate, frame, this, loc, offset, xdata); return 0; } int -iot_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, - mode_t umask, dict_t *xdata) +iot_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, + dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_mkdir_stub (frame, iot_mkdir_wrapper, loc, mode, umask, - xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create mkdir stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } + IOT_FOP (ftruncate, frame, this, fd, offset, xdata); + return 0; +} - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (mkdir, frame, -1, -ret, NULL, NULL, NULL, - NULL, NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } +int +iot_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t xflag, + dict_t *xdata) +{ + IOT_FOP (unlink, frame, this, loc, xflag, xdata); return 0; } int -iot_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) +iot_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, + dict_t *xdata) { - STACK_UNWIND_STRICT (rmdir, frame, op_ret, op_errno, preparent, - postparent, xdata); + IOT_FOP (link, frame, this, oldloc, newloc, xdata); return 0; } int -iot_rmdir_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, dict_t *xdata) +iot_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, + dict_t *xdata) { - STACK_WIND (frame, iot_rmdir_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->rmdir, loc, flags, xdata); + IOT_FOP (opendir, frame, this, loc, fd, xdata); return 0; } int -iot_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, dict_t *xdata) +iot_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync, + dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_rmdir_stub (frame, iot_rmdir_wrapper, loc, flags, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create rmdir stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (rmdir, frame, -1, -ret, NULL, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } + IOT_FOP (fsyncdir, frame, this, fd, datasync, xdata); return 0; } 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 iatt *buf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) +iot_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) { - STACK_UNWIND_STRICT (symlink, frame, op_ret, op_errno, inode, buf, - preparent, postparent, xdata); + IOT_FOP (statfs, frame, this, loc, xdata); return 0; } int -iot_symlink_wrapper (call_frame_t *frame, xlator_t *this, const char *linkname, - loc_t *loc, mode_t umask, dict_t *xdata) +iot_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, + int32_t flags, dict_t *xdata) { - STACK_WIND (frame, iot_symlink_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->symlink, linkname, loc, umask, - xdata); + IOT_FOP (setxattr, frame, this, loc, dict, flags, xdata); return 0; } int -iot_symlink (call_frame_t *frame, xlator_t *this, const char *linkname, - loc_t *loc, mode_t umask, dict_t *xdata) +iot_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, + const char *name, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_symlink_stub (frame, iot_symlink_wrapper, linkname, loc, - umask, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create symlink stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (symlink, frame, -1, -ret, NULL, NULL, NULL, - NULL, NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } - + IOT_FOP (getxattr, frame, this, loc, name, xdata); return 0; } int -iot_rename_cbk (call_frame_t *frame, void * cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *buf, - struct iatt *preoldparent, struct iatt *postoldparent, - struct iatt *prenewparent, struct iatt *postnewparent, - dict_t *xdata) +iot_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, + const char *name, dict_t *xdata) { - STACK_UNWIND_STRICT (rename, frame, op_ret, op_errno, buf, preoldparent, - postoldparent, prenewparent, postnewparent, xdata); + IOT_FOP (fgetxattr, frame, this, fd, name, xdata); return 0; } int -iot_rename_wrapper (call_frame_t *frame, xlator_t *this, loc_t *oldloc, - loc_t *newloc, dict_t *xdata) +iot_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict, + int32_t flags, dict_t *xdata) { - STACK_WIND (frame, iot_rename_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->rename, oldloc, newloc, xdata); + IOT_FOP (fsetxattr, frame, this, fd, dict, flags, xdata); return 0; } int -iot_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, - dict_t *xdata) +iot_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, + const char *name, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_rename_stub (frame, iot_rename_wrapper, oldloc, newloc, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_DEBUG, "cannot create rename stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (rename, frame, -1, -ret, NULL, NULL, NULL, - NULL, NULL, NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } - + IOT_FOP (removexattr, frame, this, loc, name, xdata); return 0; } - int -iot_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno, fd_t *fd, dict_t *xdata) +iot_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd, + const char *name, dict_t *xdata) { - STACK_UNWIND_STRICT (open, frame, op_ret, op_errno, fd, xdata); - return 0; + IOT_FOP (fremovexattr, frame, this, fd, name, xdata); + return 0; } int -iot_open_wrapper (call_frame_t * frame, xlator_t * this, loc_t *loc, - int32_t flags, fd_t * fd, dict_t *xdata) +iot_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, + off_t offset, dict_t *xdata) { - STACK_WIND (frame, iot_open_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->open, loc, flags, fd, - xdata); - return 0; + IOT_FOP (readdirp, frame, this, fd, size, offset, xdata); + return 0; } int -iot_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd, dict_t *xdata) +iot_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, + off_t offset, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_open_stub (frame, iot_open_wrapper, loc, flags, fd, - xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create open call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (open, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - - return 0; + IOT_FOP (readdir, frame, this, fd, size, offset, xdata); + return 0; } - 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 iatt *stbuf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) +iot_inodelk (call_frame_t *frame, xlator_t *this, + const char *volume, loc_t *loc, int32_t cmd, struct gf_flock *lock, + dict_t *xdata) { - STACK_UNWIND_STRICT (create, frame, op_ret, op_errno, fd, inode, stbuf, - preparent, postparent, xdata); - return 0; + IOT_FOP (inodelk, frame, this, volume, loc, cmd, lock, xdata); + return 0; } - int -iot_create_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, mode_t mode, mode_t umask, fd_t *fd, - dict_t *xdata) +iot_finodelk (call_frame_t *frame, xlator_t *this, + const char *volume, fd_t *fd, int32_t cmd, struct gf_flock *lock, + dict_t *xdata) { - STACK_WIND (frame, iot_create_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->create, - loc, flags, mode, umask, fd, xdata); - return 0; + IOT_FOP (finodelk, frame, this, volume, fd, cmd, lock, xdata); + return 0; } - int -iot_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata) +iot_entrylk (call_frame_t *frame, xlator_t *this, + const char *volume, loc_t *loc, const char *basename, + entrylk_cmd cmd, entrylk_type type, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_create_stub (frame, iot_create_wrapper, loc, flags, mode, - umask, fd, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create \"create\" call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (create, frame, -1, -ret, NULL, NULL, NULL, - NULL, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - + IOT_FOP (entrylk, frame, this, volume, loc, basename, cmd, type, xdata); return 0; } - 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 iatt *stbuf, struct iobref *iobref, - dict_t *xdata) +iot_fentrylk (call_frame_t *frame, xlator_t *this, + const char *volume, fd_t *fd, const char *basename, + entrylk_cmd cmd, entrylk_type type, dict_t *xdata) { - STACK_UNWIND_STRICT (readv, frame, op_ret, op_errno, vector, count, - stbuf, iobref, xdata); - - return 0; + IOT_FOP (fentrylk, frame, this, volume, fd, basename, cmd, type, xdata); + return 0; } int -iot_readv_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, - off_t offset, uint32_t flags, dict_t *xdata) +iot_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, + gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata) { - STACK_WIND (frame, iot_readv_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->readv, - fd, size, offset, flags, xdata); - return 0; + IOT_FOP (xattrop, frame, this, loc, optype, xattr, xdata); + return 0; } int -iot_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, - off_t offset, uint32_t flags, dict_t *xdata) +iot_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd, + gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_readv_stub (frame, iot_readv_wrapper, fd, size, offset, - flags, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create readv call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } + IOT_FOP (fxattrop, frame, this, fd, optype, xattr, xdata); + return 0; +} - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (readv, frame, -1, -ret, NULL, -1, NULL, - NULL, NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; +int32_t +iot_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, + int32_t len, dict_t *xdata) +{ + IOT_FOP (rchecksum, frame, this, fd, offset, len, xdata); + return 0; } - int -iot_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) +iot_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, + off_t offset, size_t len, dict_t *xdata) { - STACK_UNWIND_STRICT (flush, frame, op_ret, op_errno, xdata); - return 0; + IOT_FOP (fallocate, frame, this, fd, mode, offset, len, xdata); + return 0; } - int -iot_flush_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) +iot_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, + size_t len, dict_t *xdata) { - STACK_WIND (frame, iot_flush_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->flush, - fd, xdata); - return 0; -} - - -int -iot_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_flush_stub (frame, iot_flush_wrapper, fd, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create flush_cbk call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (flush, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fsync, frame, op_ret, op_errno, prebuf, postbuf, - xdata); - return 0; -} - - -int -iot_fsync_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - int32_t datasync, dict_t *xdata) -{ - STACK_WIND (frame, iot_fsync_cbk, - FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fsync, - fd, datasync, xdata); - return 0; -} - - -int -iot_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t datasync, - dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fsync_stub (frame, iot_fsync_wrapper, fd, datasync, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create fsync_cbk call stub" - "(out of memory)"); - ret = -1; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fsync, frame, -1, -ret, NULL, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, prebuf, postbuf, - xdata); - return 0; -} - - -int -iot_writev_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct iovec *vector, int32_t count, - off_t offset, uint32_t flags, struct iobref *iobref, - dict_t *xdata) -{ - STACK_WIND (frame, iot_writev_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->writev, - fd, vector, count, offset, flags, iobref, xdata); - return 0; -} - - -int -iot_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct iovec *vector, int32_t count, off_t offset, - uint32_t flags, struct iobref *iobref, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_writev_stub (frame, iot_writev_wrapper, fd, vector, - count, offset, flags, iobref, xdata); - - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create writev call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (writev, frame, -1, -ret, NULL, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - - return 0; -} - - -int32_t -iot_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct gf_flock *flock, - dict_t *xdata) -{ - STACK_UNWIND_STRICT (lk, frame, op_ret, op_errno, flock, xdata); - return 0; -} - - -int -iot_lk_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - int32_t cmd, struct gf_flock *flock, dict_t *xdata) -{ - STACK_WIND (frame, iot_lk_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->lk, - fd, cmd, flock, xdata); - return 0; -} - - -int -iot_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, - struct gf_flock *flock, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_lk_stub (frame, iot_lk_wrapper, fd, cmd, flock, xdata); - - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create fop_lk call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (lk, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (stat, frame, op_ret, op_errno, buf, xdata); - return 0; -} - - -int -iot_stat_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) -{ - STACK_WIND (frame, iot_stat_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->stat, - loc, xdata); - return 0; -} - - -int -iot_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_stat_stub (frame, iot_stat_wrapper, loc, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create fop_stat call stub" - "(out of memory)"); - ret = -1; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (stat, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fstat, frame, op_ret, op_errno, buf, xdata); - return 0; -} - - -int -iot_fstat_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) -{ - STACK_WIND (frame, iot_fstat_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->fstat, - fd, xdata); - return 0; -} - - -int -iot_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fstat_stub (frame, iot_fstat_wrapper, fd, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create fop_fstat call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fstat, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (truncate, frame, op_ret, op_errno, prebuf, - postbuf, xdata); - return 0; -} - - -int -iot_truncate_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - off_t offset, dict_t *xdata) -{ - STACK_WIND (frame, iot_truncate_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->truncate, - loc, offset, xdata); - return 0; -} - - -int -iot_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, - dict_t *xdata) -{ - call_stub_t *stub; - int ret = -1; - - stub = fop_truncate_stub (frame, iot_truncate_wrapper, loc, offset, - xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create fop_stat call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (truncate, frame, -1, -ret, NULL, NULL, - NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - - return 0; -} - - -int -iot_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (ftruncate, frame, op_ret, op_errno, prebuf, - postbuf, xdata); - return 0; -} - - -int -iot_ftruncate_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - off_t offset, dict_t *xdata) -{ - STACK_WIND (frame, iot_ftruncate_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->ftruncate, - fd, offset, xdata); - return 0; -} - - -int -iot_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_ftruncate_stub (frame, iot_ftruncate_wrapper, fd, offset, - xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create fop_ftruncate call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (ftruncate, frame, -1, -ret, NULL, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - - -int -iot_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) -{ - STACK_UNWIND_STRICT (unlink, frame, op_ret, op_errno, preparent, - postparent, xdata); - return 0; -} - - -int -iot_unlink_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t xflag, dict_t *xdata) -{ - STACK_WIND (frame, iot_unlink_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->unlink, - loc, xflag, xdata); - return 0; -} - - -int -iot_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t xflag, - dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_unlink_stub (frame, iot_unlink_wrapper, loc, xflag, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create fop_unlink call stub" - "(out of memory)"); - ret = -1; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (unlink, frame, -1, -ret, NULL, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - - return 0; -} - - -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 iatt *buf, struct iatt *preparent, struct iatt *postparent, - dict_t *xdata) -{ - STACK_UNWIND_STRICT (link, frame, op_ret, op_errno, inode, buf, - preparent, postparent, xdata); - return 0; -} - - -int -iot_link_wrapper (call_frame_t *frame, xlator_t *this, loc_t *old, loc_t *new, - dict_t *xdata) -{ - STACK_WIND (frame, iot_link_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->link, old, new, xdata); - - return 0; -} - - -int -iot_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, - dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_link_stub (frame, iot_link_wrapper, oldloc, newloc, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create link stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (link, frame, -1, -ret, NULL, NULL, NULL, - NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) -{ - STACK_UNWIND_STRICT (opendir, frame, op_ret, op_errno, fd, xdata); - return 0; -} - - -int -iot_opendir_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, - dict_t *xdata) -{ - STACK_WIND (frame, iot_opendir_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->opendir, loc, fd, xdata); - return 0; -} - - -int -iot_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, - dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_opendir_stub (frame, iot_opendir_wrapper, loc, fd, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create opendir stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (opendir, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fsyncdir, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_fsyncdir_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - int datasync, dict_t *xdata) -{ - STACK_WIND (frame, iot_fsyncdir_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fsyncdir, fd, datasync, xdata); - return 0; -} - - -int -iot_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync, - dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fsyncdir_stub (frame, iot_fsyncdir_wrapper, fd, datasync, - xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create fsyncdir stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fsyncdir, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct statvfs *buf, - dict_t *xdata) -{ - STACK_UNWIND_STRICT (statfs, frame, op_ret, op_errno, buf, xdata); - return 0; -} - - -int -iot_statfs_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - STACK_WIND (frame, iot_statfs_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->statfs, loc, xdata); - return 0; -} - - -int -iot_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_statfs_stub (frame, iot_statfs_wrapper, loc, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create statfs stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (statfs, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (setxattr, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_setxattr_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *dict, int32_t flags, dict_t *xdata) -{ - STACK_WIND (frame, iot_setxattr_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->setxattr, loc, dict, flags, xdata); - return 0; -} - - -int -iot_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, - int32_t flags, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_setxattr_stub (frame, iot_setxattr_wrapper, loc, dict, - flags, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create setxattr stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (setxattr, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) -{ - STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict, xdata); - return 0; -} - - -int -iot_getxattr_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - const char *name, dict_t *xdata) -{ - STACK_WIND (frame, iot_getxattr_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->getxattr, loc, name, xdata); - return 0; -} - - -int -iot_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - const char *name, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_getxattr_stub (frame, iot_getxattr_wrapper, loc, name, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create getxattr stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (getxattr, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *dict, - dict_t *xdata) -{ - STACK_UNWIND_STRICT (fgetxattr, frame, op_ret, op_errno, dict, xdata); - return 0; -} - - -int -iot_fgetxattr_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - const char *name, dict_t *xdata) -{ - STACK_WIND (frame, iot_fgetxattr_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fgetxattr, fd, name, xdata); - return 0; -} - - -int -iot_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - const char *name, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fgetxattr_stub (frame, iot_fgetxattr_wrapper, fd, name, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create fgetxattr stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fgetxattr, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fsetxattr, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_fsetxattr_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - dict_t *dict, int32_t flags, dict_t *xdata) -{ - STACK_WIND (frame, iot_fsetxattr_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fsetxattr, fd, dict, flags, - xdata); - return 0; -} - - -int -iot_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict, - int32_t flags, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fsetxattr_stub (frame, iot_fsetxattr_wrapper, fd, dict, - flags, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create fsetxattr stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fsetxattr, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (removexattr, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_removexattr_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - const char *name, dict_t *xdata) -{ - STACK_WIND (frame, iot_removexattr_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->removexattr, loc, name, xdata); - return 0; -} - - -int -iot_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - const char *name, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_removexattr_stub (frame, iot_removexattr_wrapper, loc, - name, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR,"cannot get removexattr fop" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (removexattr, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - -int -iot_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fremovexattr, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_fremovexattr_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - const char *name, dict_t *xdata) -{ - STACK_WIND (frame, iot_fremovexattr_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fremovexattr, fd, name, xdata); - return 0; -} - - -int -iot_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - const char *name, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fremovexattr_stub (frame, iot_fremovexattr_wrapper, fd, - name, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR,"cannot get fremovexattr fop" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fremovexattr, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, - dict_t *xdata) -{ - STACK_UNWIND_STRICT (readdirp, frame, op_ret, op_errno, entries, xdata); - return 0; -} - - -int -iot_readdirp_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - size_t size, off_t offset, dict_t *xdata) -{ - STACK_WIND (frame, iot_readdirp_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->readdirp, fd, size, offset, xdata); - return 0; -} - - -int -iot_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, - off_t offset, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_readdirp_stub (frame, iot_readdirp_wrapper, fd, size, - offset, xdata); - if (!stub) { - gf_log (this->private, GF_LOG_ERROR,"cannot get readdir stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (readdirp, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, - dict_t *xdata) -{ - STACK_UNWIND_STRICT (readdir, frame, op_ret, op_errno, entries, xdata); - return 0; -} - - -int -iot_readdir_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - size_t size, off_t offset, dict_t *xdata) -{ - STACK_WIND (frame, iot_readdir_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->readdir, fd, size, offset, xdata); - return 0; -} - - -int -iot_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, - off_t offset, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_readdir_stub (frame, iot_readdir_wrapper, fd, size, offset, - xdata); - if (!stub) { - gf_log (this->private, GF_LOG_ERROR,"cannot get readdir stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (readdir, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - -int -iot_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (inodelk, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_inodelk_wrapper (call_frame_t *frame, xlator_t *this, const char *volume, - loc_t *loc, int32_t cmd, struct gf_flock *lock, - dict_t *xdata) -{ - STACK_WIND (frame, iot_inodelk_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->inodelk, volume, loc, cmd, lock, - xdata); - return 0; -} - - -int -iot_inodelk (call_frame_t *frame, xlator_t *this, - const char *volume, loc_t *loc, int32_t cmd, struct gf_flock *lock, - dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_inodelk_stub (frame, iot_inodelk_wrapper, - volume, loc, cmd, lock, xdata); - if (!stub) { - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (inodelk, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - -int -iot_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (finodelk, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_finodelk_wrapper (call_frame_t *frame, xlator_t *this, - const char *volume, fd_t *fd, int32_t cmd, - struct gf_flock *lock, dict_t *xdata) -{ - STACK_WIND (frame, iot_finodelk_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->finodelk, volume, fd, cmd, lock, - xdata); - return 0; -} - - -int -iot_finodelk (call_frame_t *frame, xlator_t *this, - const char *volume, fd_t *fd, int32_t cmd, struct gf_flock *lock, - dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_finodelk_stub (frame, iot_finodelk_wrapper, - volume, fd, cmd, lock, xdata); - if (!stub) { - gf_log (this->private, GF_LOG_ERROR,"cannot get finodelk stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (finodelk, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - -int -iot_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (entrylk, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_entrylk_wrapper (call_frame_t *frame, xlator_t *this, - const char *volume, loc_t *loc, const char *basename, - entrylk_cmd cmd, entrylk_type type, dict_t *xdata) -{ - STACK_WIND (frame, iot_entrylk_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->entrylk, - volume, loc, basename, cmd, type, xdata); - return 0; -} - - -int -iot_entrylk (call_frame_t *frame, xlator_t *this, - const char *volume, loc_t *loc, const char *basename, - entrylk_cmd cmd, entrylk_type type, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_entrylk_stub (frame, iot_entrylk_wrapper, - volume, loc, basename, cmd, type, xdata); - if (!stub) { - gf_log (this->private, GF_LOG_ERROR,"cannot get entrylk stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (entrylk, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - -int -iot_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fentrylk, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_fentrylk_wrapper (call_frame_t *frame, xlator_t *this, - const char *volume, fd_t *fd, const char *basename, - entrylk_cmd cmd, entrylk_type type, dict_t *xdata) -{ - STACK_WIND (frame, iot_fentrylk_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fentrylk, - volume, fd, basename, cmd, type, xdata); - return 0; -} - - -int -iot_fentrylk (call_frame_t *frame, xlator_t *this, - const char *volume, fd_t *fd, const char *basename, - entrylk_cmd cmd, entrylk_type type, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fentrylk_stub (frame, iot_fentrylk_wrapper, - volume, fd, basename, cmd, type, xdata); - if (!stub) { - gf_log (this->private, GF_LOG_ERROR,"cannot get fentrylk stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fentrylk, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xattr, dict_t *xdata) -{ - STACK_UNWIND_STRICT (xattrop, frame, op_ret, op_errno, xattr, xdata); - return 0; -} - - -int -iot_xattrop_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata) -{ - STACK_WIND (frame, iot_xattrop_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->xattrop, loc, optype, xattr, xdata); - return 0; -} - - -int -iot_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, - gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_xattrop_stub (frame, iot_xattrop_wrapper, loc, optype, - xattr, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create xattrop stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (xattrop, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xattr, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fxattrop, frame, op_ret, op_errno, xattr, xdata); - return 0; -} - -int -iot_fxattrop_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata) -{ - STACK_WIND (frame, iot_fxattrop_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fxattrop, fd, optype, xattr, xdata); - return 0; -} - - -int -iot_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd, - gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fxattrop_stub (frame, iot_fxattrop_wrapper, fd, optype, - xattr, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create fxattrop stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fxattrop, frame, -1, -ret, NULL, NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int32_t -iot_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, uint32_t weak_checksum, - uint8_t *strong_checksum, dict_t *xdata) -{ - STACK_UNWIND_STRICT (rchecksum, frame, op_ret, op_errno, weak_checksum, - strong_checksum, xdata); - return 0; -} - - -int32_t -iot_rchecksum_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - off_t offset, int32_t len, dict_t *xdata) -{ - STACK_WIND (frame, iot_rchecksum_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->rchecksum, fd, offset, len, xdata); - return 0; -} - - -int32_t -iot_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - int32_t len, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_rchecksum_stub (frame, iot_rchecksum_wrapper, fd, offset, - len, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create rchecksum stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (rchecksum, frame, -1, -ret, -1, NULL, NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } - - return 0; -} - -int -iot_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - struct iatt *preop, struct iatt *postop, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fallocate, frame, op_ret, op_errno, preop, postop, - xdata); - return 0; -} - - -int -iot_fallocate_wrapper(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, - off_t offset, size_t len, dict_t *xdata) -{ - STACK_WIND (frame, iot_fallocate_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fallocate, fd, mode, offset, len, - xdata); - return 0; -} - - -int -iot_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, - off_t offset, size_t len, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fallocate_stub(frame, iot_fallocate_wrapper, fd, mode, offset, - len, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create fallocate stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fallocate, frame, -1, -ret, NULL, NULL, - NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - -int -iot_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - struct iatt *preop, struct iatt *postop, dict_t *xdata) -{ - STACK_UNWIND_STRICT (discard, frame, op_ret, op_errno, preop, postop, - xdata); - return 0; -} - - -int -iot_discard_wrapper(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata) -{ - STACK_WIND (frame, iot_discard_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->discard, fd, offset, len, xdata); - return 0; -} - - -int -iot_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_discard_stub(frame, iot_discard_wrapper, fd, offset, len, - xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create discard stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (discard, frame, -1, -ret, NULL, NULL, - NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - -int -iot_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - struct iatt *preop, struct iatt *postop, dict_t *xdata) -{ - STACK_UNWIND_STRICT (zerofill, frame, op_ret, op_errno, preop, postop, - xdata); - return 0; -} - -int -iot_zerofill_wrapper(call_frame_t *frame, xlator_t *this, fd_t *fd, - off_t offset, off_t len, dict_t *xdata) -{ - STACK_WIND (frame, iot_zerofill_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->zerofill, fd, offset, len, xdata); - return 0; + IOT_FOP (discard, frame, this, fd, offset, len, xdata); + return 0; } int iot_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, off_t len, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_zerofill_stub(frame, iot_zerofill_wrapper, fd, - offset, len, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create zerofill stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (zerofill, frame, -1, -ret, NULL, NULL, - NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } + IOT_FOP (zerofill, frame, this, fd, offset, len, xdata); return 0; } -- cgit