diff options
Diffstat (limited to 'xlators/performance/decompounder/src/decompounder.c')
-rw-r--r-- | xlators/performance/decompounder/src/decompounder.c | 179 |
1 files changed, 89 insertions, 90 deletions
diff --git a/xlators/performance/decompounder/src/decompounder.c b/xlators/performance/decompounder/src/decompounder.c index 3009fcdd4b1..cd353b78ec3 100644 --- a/xlators/performance/decompounder/src/decompounder.c +++ b/xlators/performance/decompounder/src/decompounder.c @@ -10,17 +10,14 @@ #include "decompounder.h" #include "mem-types.h" +#include "compound-fop-utils.h" void dc_local_cleanup (dc_local_t *local) { int i = 0; - for (i = 0; i < local->length; i++) - args_cbk_wipe (&local->compound_rsp->rsp_list[i]); - - GF_FREE (local->compound_rsp->rsp_list); - GF_FREE (local->compound_rsp); + compound_args_cbk_cleanup (local->compound_rsp); return; } @@ -551,290 +548,292 @@ dc_compound_fop_wind (call_frame_t *frame, xlator_t *this) compound_args_t *c_req = local->compound_req; compound_args_cbk_t *c_rsp = local->compound_rsp; int counter = local->counter; - default_args_t curr_fop = c_req->req_list[counter]; + default_args_t *curr_fop = &c_req->req_list[counter]; int op_ret = 0; int op_errno = ENOMEM; if (local->counter == local->length) goto done; + c_rsp->enum_list[counter] = c_req->enum_list[counter]; + switch (c_req->enum_list[counter]) { case GF_FOP_STAT: STACK_WIND (frame, dc_stat_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->stat, - &curr_fop.loc, curr_fop.xdata); + &curr_fop->loc, curr_fop->xdata); break; case GF_FOP_READLINK: STACK_WIND (frame, dc_readlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readlink, - &curr_fop.loc, curr_fop.size, - curr_fop.xdata); + &curr_fop->loc, curr_fop->size, + curr_fop->xdata); break; case GF_FOP_MKNOD: STACK_WIND (frame, dc_mknod_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->mknod, - &curr_fop.loc, curr_fop.mode, curr_fop.rdev, - curr_fop.umask, curr_fop.xdata); + &curr_fop->loc, curr_fop->mode, curr_fop->rdev, + curr_fop->umask, curr_fop->xdata); break; case GF_FOP_MKDIR: STACK_WIND (frame, dc_mkdir_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->mkdir, - &curr_fop.loc, curr_fop.mode, - curr_fop.umask, curr_fop.xdata); + &curr_fop->loc, curr_fop->mode, + curr_fop->umask, curr_fop->xdata); break; case GF_FOP_UNLINK: STACK_WIND (frame, dc_unlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->unlink, - &curr_fop.loc, curr_fop.xflag, curr_fop.xdata); + &curr_fop->loc, curr_fop->xflag, curr_fop->xdata); break; case GF_FOP_RMDIR: STACK_WIND (frame, dc_rmdir_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rmdir, - &curr_fop.loc, curr_fop.flags, curr_fop.xdata); + &curr_fop->loc, curr_fop->flags, curr_fop->xdata); break; case GF_FOP_SYMLINK: STACK_WIND (frame, dc_symlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->symlink, - curr_fop.linkname, &curr_fop.loc, - curr_fop.umask, curr_fop.xdata); + curr_fop->linkname, &curr_fop->loc, + curr_fop->umask, curr_fop->xdata); break; case GF_FOP_RENAME: STACK_WIND (frame, dc_rename_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rename, - &curr_fop.loc, &curr_fop.loc2, curr_fop.xdata); + &curr_fop->loc, &curr_fop->loc2, curr_fop->xdata); break; case GF_FOP_LINK: STACK_WIND (frame, dc_link_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->link, - &curr_fop.loc, &curr_fop.loc2, curr_fop.xdata); + &curr_fop->loc, &curr_fop->loc2, curr_fop->xdata); break; case GF_FOP_TRUNCATE: STACK_WIND (frame, dc_truncate_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->truncate, - &curr_fop.loc, curr_fop.offset, curr_fop.xdata); + &curr_fop->loc, curr_fop->offset, curr_fop->xdata); break; case GF_FOP_OPEN: STACK_WIND (frame, dc_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - &curr_fop.loc, curr_fop.flags, curr_fop.fd, - curr_fop.xdata); + &curr_fop->loc, curr_fop->flags, curr_fop->fd, + curr_fop->xdata); break; case GF_FOP_READ: STACK_WIND (frame, dc_readv_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readv, - curr_fop.fd, curr_fop.size, curr_fop.offset, - curr_fop.flags, curr_fop.xdata); + curr_fop->fd, curr_fop->size, curr_fop->offset, + curr_fop->flags, curr_fop->xdata); break; case GF_FOP_WRITE: STACK_WIND (frame, dc_writev_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->writev, - curr_fop.fd, curr_fop.vector, curr_fop.count, - curr_fop.offset, curr_fop.flags, curr_fop.iobref, - curr_fop.xdata); + curr_fop->fd, curr_fop->vector, curr_fop->count, + curr_fop->offset, curr_fop->flags, curr_fop->iobref, + curr_fop->xdata); break; case GF_FOP_STATFS: STACK_WIND (frame, dc_statfs_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->statfs, - &curr_fop.loc, curr_fop.xdata); + &curr_fop->loc, curr_fop->xdata); break; case GF_FOP_FLUSH: STACK_WIND (frame, dc_flush_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->flush, - curr_fop.fd, curr_fop.xdata); + curr_fop->fd, curr_fop->xdata); break; case GF_FOP_FSYNC: STACK_WIND (frame, dc_fsync_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsync, - curr_fop.fd, curr_fop.datasync, curr_fop.xdata); + curr_fop->fd, curr_fop->datasync, curr_fop->xdata); break; case GF_FOP_SETXATTR: STACK_WIND (frame, dc_setxattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->setxattr, - &curr_fop.loc, curr_fop.xattr, curr_fop.flags, - curr_fop.xdata); + &curr_fop->loc, curr_fop->xattr, curr_fop->flags, + curr_fop->xdata); break; case GF_FOP_GETXATTR: STACK_WIND (frame, dc_getxattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->getxattr, - &curr_fop.loc, curr_fop.name, curr_fop.xdata); + &curr_fop->loc, curr_fop->name, curr_fop->xdata); break; case GF_FOP_REMOVEXATTR: STACK_WIND (frame, dc_removexattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->removexattr, - &curr_fop.loc, curr_fop.name, curr_fop.xdata); + &curr_fop->loc, curr_fop->name, curr_fop->xdata); break; case GF_FOP_OPENDIR: STACK_WIND (frame, dc_opendir_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->opendir, - &curr_fop.loc, curr_fop.fd, curr_fop.xdata); + &curr_fop->loc, curr_fop->fd, curr_fop->xdata); break; case GF_FOP_FSYNCDIR: STACK_WIND (frame, dc_fsyncdir_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsyncdir, - curr_fop.fd, curr_fop.datasync, curr_fop.xdata); + curr_fop->fd, curr_fop->datasync, curr_fop->xdata); break; case GF_FOP_ACCESS: STACK_WIND (frame, dc_access_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->access, - &curr_fop.loc, curr_fop.mask, curr_fop.xdata); + &curr_fop->loc, curr_fop->mask, curr_fop->xdata); break; case GF_FOP_CREATE: STACK_WIND (frame, dc_create_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->create, - &curr_fop.loc, curr_fop.flags, curr_fop.mode, - curr_fop.umask, curr_fop.fd, curr_fop.xdata); + &curr_fop->loc, curr_fop->flags, curr_fop->mode, + curr_fop->umask, curr_fop->fd, curr_fop->xdata); break; case GF_FOP_FTRUNCATE: STACK_WIND (frame, dc_ftruncate_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->ftruncate, - curr_fop.fd, curr_fop.offset, curr_fop.xdata); + curr_fop->fd, curr_fop->offset, curr_fop->xdata); break; case GF_FOP_FSTAT: STACK_WIND (frame, dc_fstat_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fstat, - curr_fop.fd, curr_fop.xdata); + curr_fop->fd, curr_fop->xdata); break; case GF_FOP_LK: STACK_WIND (frame, dc_lk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->lk, - curr_fop.fd, - curr_fop.cmd, &curr_fop.lock, curr_fop.xdata); + curr_fop->fd, + curr_fop->cmd, &curr_fop->lock, curr_fop->xdata); break; case GF_FOP_LOOKUP: STACK_WIND (frame, dc_lookup_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->lookup, - &curr_fop.loc, curr_fop.xdata); + &curr_fop->loc, curr_fop->xdata); break; case GF_FOP_READDIR: STACK_WIND (frame, dc_readdir_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readdir, - curr_fop.fd, curr_fop.size, curr_fop.offset, - curr_fop.xdata); + curr_fop->fd, curr_fop->size, curr_fop->offset, + curr_fop->xdata); break; case GF_FOP_INODELK: STACK_WIND (frame, dc_inodelk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->inodelk, - curr_fop.volume, &curr_fop.loc, - curr_fop.cmd, &curr_fop.lock, curr_fop.xdata); + curr_fop->volume, &curr_fop->loc, + curr_fop->cmd, &curr_fop->lock, curr_fop->xdata); break; case GF_FOP_FINODELK: STACK_WIND (frame, dc_finodelk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->finodelk, - curr_fop.volume, curr_fop.fd, - curr_fop.cmd, &curr_fop.lock, curr_fop.xdata); + curr_fop->volume, curr_fop->fd, + curr_fop->cmd, &curr_fop->lock, curr_fop->xdata); break; case GF_FOP_ENTRYLK: STACK_WIND (frame, dc_entrylk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->entrylk, - curr_fop.volume, &curr_fop.loc, - curr_fop.name, curr_fop.entrylkcmd, - curr_fop.entrylktype, curr_fop.xdata); + curr_fop->volume, &curr_fop->loc, + curr_fop->name, curr_fop->entrylkcmd, + curr_fop->entrylktype, curr_fop->xdata); break; case GF_FOP_FENTRYLK: STACK_WIND (frame, dc_fentrylk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fentrylk, - curr_fop.volume, curr_fop.fd, - curr_fop.name, curr_fop.entrylkcmd, - curr_fop.entrylktype, curr_fop.xdata); + curr_fop->volume, curr_fop->fd, + curr_fop->name, curr_fop->entrylkcmd, + curr_fop->entrylktype, curr_fop->xdata); break; case GF_FOP_XATTROP: STACK_WIND (frame, dc_xattrop_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->xattrop, - &curr_fop.loc, curr_fop.optype, curr_fop.xattr, - curr_fop.xdata); + &curr_fop->loc, curr_fop->optype, curr_fop->xattr, + curr_fop->xdata); break; case GF_FOP_FXATTROP: STACK_WIND (frame, dc_fxattrop_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fxattrop, - curr_fop.fd, curr_fop.optype, curr_fop.xattr, - curr_fop.xdata); + curr_fop->fd, curr_fop->optype, curr_fop->xattr, + curr_fop->xdata); break; case GF_FOP_FGETXATTR: STACK_WIND (frame, dc_fgetxattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fgetxattr, - curr_fop.fd, curr_fop.name, curr_fop.xdata); + curr_fop->fd, curr_fop->name, curr_fop->xdata); break; case GF_FOP_FSETXATTR: STACK_WIND (frame, dc_fsetxattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsetxattr, - curr_fop.fd, curr_fop.xattr, curr_fop.flags, - curr_fop.xdata); + curr_fop->fd, curr_fop->xattr, curr_fop->flags, + curr_fop->xdata); break; case GF_FOP_RCHECKSUM: STACK_WIND (frame, dc_rchecksum_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rchecksum, - curr_fop.fd, curr_fop.offset, curr_fop.size, - curr_fop.xdata); + curr_fop->fd, curr_fop->offset, curr_fop->size, + curr_fop->xdata); break; case GF_FOP_SETATTR: STACK_WIND (frame, dc_setattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->setattr, - &curr_fop.loc, &curr_fop.stat, curr_fop.valid, - curr_fop.xdata); + &curr_fop->loc, &curr_fop->stat, curr_fop->valid, + curr_fop->xdata); break; case GF_FOP_FSETATTR: STACK_WIND (frame, dc_fsetattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsetattr, - curr_fop.fd, &curr_fop.stat, curr_fop.valid, - curr_fop.xdata); + curr_fop->fd, &curr_fop->stat, curr_fop->valid, + curr_fop->xdata); break; case GF_FOP_READDIRP: STACK_WIND (frame, dc_readdirp_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readdirp, - curr_fop.fd, curr_fop.size, curr_fop.offset, - curr_fop.xdata); + curr_fop->fd, curr_fop->size, curr_fop->offset, + curr_fop->xdata); break; case GF_FOP_FREMOVEXATTR: STACK_WIND (frame, dc_fremovexattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fremovexattr, - curr_fop.fd, curr_fop.name, curr_fop.xdata); + curr_fop->fd, curr_fop->name, curr_fop->xdata); break; case GF_FOP_FALLOCATE: STACK_WIND (frame, dc_fallocate_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fallocate, - curr_fop.fd, curr_fop.flags, curr_fop.offset, - curr_fop.size, curr_fop.xdata); + curr_fop->fd, curr_fop->flags, curr_fop->offset, + curr_fop->size, curr_fop->xdata); break; case GF_FOP_DISCARD: STACK_WIND (frame, dc_discard_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->discard, - curr_fop.fd, curr_fop.offset, curr_fop.size, - curr_fop.xdata); + curr_fop->fd, curr_fop->offset, curr_fop->size, + curr_fop->xdata); break; case GF_FOP_ZEROFILL: STACK_WIND (frame, dc_zerofill_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->zerofill, - curr_fop.fd, curr_fop.offset, curr_fop.size, - curr_fop.xdata); + curr_fop->fd, curr_fop->offset, curr_fop->size, + curr_fop->xdata); break; case GF_FOP_IPC: STACK_WIND (frame, dc_ipc_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->ipc, - curr_fop.cmd, curr_fop.xdata); + curr_fop->cmd, curr_fop->xdata); break; case GF_FOP_SEEK: STACK_WIND (frame, dc_seek_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->seek, - curr_fop.fd, curr_fop.offset, curr_fop.what, - curr_fop.xdata); + curr_fop->fd, curr_fop->offset, curr_fop->what, + curr_fop->xdata); break; default: return -ENOTSUP; @@ -865,20 +864,13 @@ dc_compound (call_frame_t *frame, xlator_t *this, void *data, dict_t *xdata) frame->local = local; - local->compound_rsp = GF_CALLOC (1, sizeof (local->compound_rsp), - gf_dc_mt_rsp_t); + local->compound_rsp = compound_args_cbk_alloc (compound_req->fop_length, + NULL); if (!local->compound_rsp) goto out; compound_rsp = local->compound_rsp; - compound_rsp->fop_length = compound_req->fop_length; - compound_rsp->rsp_list = GF_CALLOC (compound_rsp->fop_length, - sizeof (default_args_cbk_t), - gf_mt_default_args_cbk_t); - if (!compound_rsp->rsp_list) - goto out; - local->length = compound_req->fop_length; local->counter = 0; local->compound_req = compound_req; @@ -941,6 +933,13 @@ init (xlator_t *this) ret = -1; goto out; } + + this->local_pool = mem_pool_new (dc_local_t, 128); + if (!this->local_pool) { + ret = -1; + goto out; + } + out: return ret; } |