diff options
author | Anuradha Talur <atalur@redhat.com> | 2016-04-21 17:20:09 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2016-04-25 23:47:28 -0700 |
commit | 9996f95b28b3782887b7c233cdc0ba686c38b245 (patch) | |
tree | 5fa681f25b95dd9aeec88f3bf86adbc98bd2c1d3 | |
parent | 2dc22adbf3361bdab10924943371492cc2817d8a (diff) |
performance/decompounder: Introducing decompounder xlator
This xlator decompounds the compound fops received,
and executes them serially.
Change-Id: Ieddcec3c2983dd9ca7919ba9d7ecaa5192a5f489
BUG: 1303829
Signed-off-by: Anuradha Talur <atalur@redhat.com>
Reviewed-on: http://review.gluster.org/13577
Smoke: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | glusterfs.spec.in | 1 | ||||
-rw-r--r-- | libglusterfs/src/call-stub.c | 25 | ||||
-rw-r--r-- | libglusterfs/src/common-utils.c | 5 | ||||
-rw-r--r-- | libglusterfs/src/default-args.c | 34 | ||||
-rw-r--r-- | libglusterfs/src/default-args.h | 3 | ||||
-rw-r--r-- | libglusterfs/src/defaults.h | 16 | ||||
-rw-r--r-- | libglusterfs/src/glfs-message-id.h | 4 | ||||
-rw-r--r-- | libglusterfs/src/globals.c | 1 | ||||
-rw-r--r-- | libglusterfs/src/glusterfs.h | 4 | ||||
-rw-r--r-- | libglusterfs/src/mem-types.h | 5 | ||||
-rw-r--r-- | libglusterfs/src/xlator.h | 8 | ||||
-rw-r--r-- | rpc/rpc-lib/src/protocol-common.h | 1 | ||||
-rw-r--r-- | xlators/performance/Makefile.am | 2 | ||||
-rw-r--r-- | xlators/performance/decompounder/Makefile.am | 1 | ||||
-rw-r--r-- | xlators/performance/decompounder/src/Makefile.am | 16 | ||||
-rw-r--r-- | xlators/performance/decompounder/src/decompounder-mem-types.h | 20 | ||||
-rw-r--r-- | xlators/performance/decompounder/src/decompounder-messages.h | 27 | ||||
-rw-r--r-- | xlators/performance/decompounder/src/decompounder.c | 946 | ||||
-rw-r--r-- | xlators/performance/decompounder/src/decompounder.h | 74 |
20 files changed, 1168 insertions, 27 deletions
diff --git a/configure.ac b/configure.ac index f479dd71138..56f13d5be97 100644 --- a/configure.ac +++ b/configure.ac @@ -97,6 +97,8 @@ AC_CONFIG_FILES([Makefile xlators/performance/open-behind/src/Makefile xlators/performance/md-cache/Makefile xlators/performance/md-cache/src/Makefile + xlators/performance/decompounder/Makefile + xlators/performance/decompounder/src/Makefile xlators/debug/Makefile xlators/debug/trace/Makefile xlators/debug/trace/src/Makefile diff --git a/glusterfs.spec.in b/glusterfs.spec.in index f91b19879a2..fc3e72edb51 100644 --- a/glusterfs.spec.in +++ b/glusterfs.spec.in @@ -1114,6 +1114,7 @@ exit 0 %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/nfs* %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol/server* %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/storage* +%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/performance/decompounder.so %if ( 0%{!?_without_tiering:1} ) %{_libdir}/libgfdb.so.* %endif diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index 42ebca6b3cc..99371ce8ff8 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -2360,32 +2360,9 @@ out: static void call_stub_wipe_args (call_stub_t *stub) { - loc_wipe (&stub->args.loc); - - loc_wipe (&stub->args.loc2); - - if (stub->args.fd) - fd_unref (stub->args.fd); - - GF_FREE ((char *)stub->args.linkname); - - GF_FREE (stub->args.vector); - - if (stub->args.iobref) - iobref_unref (stub->args.iobref); - - if (stub->args.xattr) - dict_unref (stub->args.xattr); - - GF_FREE ((char *)stub->args.name); - - GF_FREE ((char *)stub->args.volume); - - if (stub->args.xdata) - dict_unref (stub->args.xdata); + args_wipe (&stub->args); } - static void call_stub_wipe_args_cbk (call_stub_t *stub) { diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 21fe3841be9..bfddfc3124c 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -4327,8 +4327,9 @@ fop_enum_to_pri_string (glusterfs_fop_t fop) case GF_FOP_MAXVALUE: case GF_FOP_DISCARD: return "LEAST"; + default: + return "UNKNOWN"; } - return "UNKNOWN"; } const char * @@ -4385,6 +4386,8 @@ fop_enum_to_string (glusterfs_fop_t fop) "DISCARD", "ZEROFILL", "IPC", + "SEEK", + "COMPOUND", "MAXVALUE"}; if (fop <= GF_FOP_MAXVALUE) return str_map[fop]; diff --git a/libglusterfs/src/default-args.c b/libglusterfs/src/default-args.c index 29c8aeae9fd..1ce907f6221 100644 --- a/libglusterfs/src/default-args.c +++ b/libglusterfs/src/default-args.c @@ -1486,3 +1486,37 @@ args_cbk_wipe (default_args_cbk_t *args_cbk) if (!list_empty (&args_cbk->entries.list)) gf_dirent_free (&args_cbk->entries); } + +void +args_wipe (default_args_t *args) +{ + if (!args) + return; + + if (&args->loc) + loc_wipe (&args->loc); + + if (&args->loc2) + loc_wipe (&args->loc2); + + if (args->fd) + fd_unref (args->fd); + + GF_FREE ((char *)args->linkname); + + GF_FREE (args->vector); + + if (args->iobref) + iobref_unref (args->iobref); + + if (args->xattr) + dict_unref (args->xattr); + + if (args->xdata) + dict_unref (args->xdata); + + GF_FREE ((char *)args->name); + + GF_FREE ((char *)args->volume); + +} diff --git a/libglusterfs/src/default-args.h b/libglusterfs/src/default-args.h index a6ed0e484da..86dafe63e83 100644 --- a/libglusterfs/src/default-args.h +++ b/libglusterfs/src/default-args.h @@ -276,6 +276,9 @@ args_lease_cbk_store (default_args_cbk_t *args, void args_cbk_wipe (default_args_cbk_t *args_cbk); +void +args_wipe (default_args_t *args); + int args_lookup_store (default_args_t *args, loc_t *loc, dict_t *xdata); diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h index 148dc84b1c5..cae69a536a3 100644 --- a/libglusterfs/src/defaults.h +++ b/libglusterfs/src/defaults.h @@ -78,6 +78,22 @@ typedef struct { struct gf_lease lease; } default_args_t; +typedef struct { + int fop_enum; + int fop_length; + int *enum_list; + default_args_t *req_list; + dict_t *xdata; +} compound_args_t; + +typedef struct { + int fop_enum; + int fop_length; + int *enum_list; + default_args_cbk_t *rsp_list; + dict_t *xdata; +} compound_args_cbk_t; + int32_t default_notify (xlator_t *this, int32_t event, void *data, diff --git a/libglusterfs/src/glfs-message-id.h b/libglusterfs/src/glfs-message-id.h index 18104dab90f..d772dd37983 100644 --- a/libglusterfs/src/glfs-message-id.h +++ b/libglusterfs/src/glfs-message-id.h @@ -170,6 +170,10 @@ GLFS_MSGID_COMP_SYMLINK_CACHE_END #define GLFS_MSGID_COMP_PL GLFS_MSGID_COMP_JBR_END #define GLFS_MSGID_COMP_PL_END (GLFS_MSGID_COMP_PL +\ GLFS_MSGID_SEGMENT) + +#define GLFS_MSGID_COMP_DC GLFS_MSGID_COMP_PL_END +#define GLFS_MSGID_COMP_DC_END (GLFS_MSGID_COMP_PL_END+\ + GLFS_MSGID_SEGMENT) /* --- new segments for messages goes above this line --- */ #endif /* !_GLFS_MESSAGE_ID_H_ */ diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c index 0645ffadb10..997994f049e 100644 --- a/libglusterfs/src/globals.c +++ b/libglusterfs/src/globals.c @@ -70,6 +70,7 @@ const char *gf_fop_list[GF_FOP_MAXVALUE] = { [GF_FOP_IPC] = "IPC", [GF_FOP_SEEK] = "SEEK", [GF_FOP_LEASE] = "LEASE", + [GF_FOP_COMPOUND] = "COMPOUND", }; /* THIS */ diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index 9d077e5ad61..d3be103d074 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -269,7 +269,8 @@ /* NOTE: add members ONLY at the end (just before _MAXVALUE) */ /* - * OTHER NOTE: fop_enum_to_str and fop_enum_to_pri_str (in common-utils.h) also + * OTHER NOTE: fop_enum_to_str and fop_enum_to_pri_str (in common-utils.h) + * and gf_fop_list in globals.c also * contain lists of fops, so if you update this list UPDATE THOSE TOO. */ typedef enum { @@ -325,6 +326,7 @@ typedef enum { GF_FOP_IPC, GF_FOP_SEEK, GF_FOP_LEASE, + GF_FOP_COMPOUND, GF_FOP_MAXVALUE, } glusterfs_fop_t; diff --git a/libglusterfs/src/mem-types.h b/libglusterfs/src/mem-types.h index 639ba3721f1..e185a49ec21 100644 --- a/libglusterfs/src/mem-types.h +++ b/libglusterfs/src/mem-types.h @@ -159,6 +159,11 @@ enum gf_common_mem_types_ { gf_common_mt_syncenv, gf_common_mt_scan_data, gf_common_list_node, + gf_mt_default_args_t, + gf_mt_default_args_cbk_t, + /*used for compound fops*/ + gf_mt_compound_req_t, + gf_mt_compound_rsp_t, gf_common_mt_end }; #endif diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index 84f48edba2c..052dd978a63 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -452,6 +452,10 @@ typedef int32_t (*fop_lease_cbk_t) (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct gf_lease *lease, dict_t *xdata); +typedef int32_t (*fop_compound_cbk_t) (call_frame_t *frame, + void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, + void *data, dict_t *xdata); typedef int32_t (*fop_lookup_t) (call_frame_t *frame, xlator_t *this, @@ -702,6 +706,8 @@ typedef int32_t (*fop_seek_t) (call_frame_t *frame, xlator_t *this, fd_t *fd, typedef int32_t (*fop_lease_t) (call_frame_t *frame, xlator_t *this, loc_t *loc, struct gf_lease *lease, dict_t *xdata); +typedef int32_t (*fop_compound_t) (call_frame_t *frame, xlator_t *this, + void *args, dict_t *xdata); struct xlator_fops { fop_lookup_t lookup; fop_stat_t stat; @@ -751,6 +757,7 @@ struct xlator_fops { fop_ipc_t ipc; fop_seek_t seek; fop_lease_t lease; + fop_compound_t compound; /* these entries are used for a typechecking hack in STACK_WIND _only_ */ fop_lookup_cbk_t lookup_cbk; @@ -801,6 +808,7 @@ struct xlator_fops { fop_ipc_cbk_t ipc_cbk; fop_seek_cbk_t seek_cbk; fop_lease_cbk_t lease_cbk; + fop_compound_cbk_t compound_cbk; }; typedef int32_t (*cbk_forget_t) (xlator_t *this, diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h index 2da9e57bf8b..e5722731d51 100644 --- a/rpc/rpc-lib/src/protocol-common.h +++ b/rpc/rpc-lib/src/protocol-common.h @@ -61,6 +61,7 @@ enum gf_fop_procnum { GFS3_OP_ZEROFILL, GFS3_OP_IPC, GFS3_OP_SEEK, + GFS3_OP_COMPOUND, GFS3_OP_MAXVALUE, } ; diff --git a/xlators/performance/Makefile.am b/xlators/performance/Makefile.am index a494190baac..eb4e32cbb14 100644 --- a/xlators/performance/Makefile.am +++ b/xlators/performance/Makefile.am @@ -1,3 +1,3 @@ -SUBDIRS = write-behind read-ahead readdir-ahead io-threads io-cache symlink-cache quick-read md-cache open-behind +SUBDIRS = write-behind read-ahead readdir-ahead io-threads io-cache symlink-cache quick-read md-cache open-behind decompounder CLEANFILES = diff --git a/xlators/performance/decompounder/Makefile.am b/xlators/performance/decompounder/Makefile.am new file mode 100644 index 00000000000..af437a64d6d --- /dev/null +++ b/xlators/performance/decompounder/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/xlators/performance/decompounder/src/Makefile.am b/xlators/performance/decompounder/src/Makefile.am new file mode 100644 index 00000000000..693fe0aa5c2 --- /dev/null +++ b/xlators/performance/decompounder/src/Makefile.am @@ -0,0 +1,16 @@ +xlator_LTLIBRARIES = decompounder.la +xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/performance + +decompounder_la_LDFLAGS = -module $(GF_XLATOR_DEFAULT_LDFLAGS) + +decompounder_la_SOURCES = decompounder.c +decompounder_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la + +noinst_HEADERS = decompounder-mem-types.h decompounder-messages.h \ + decompounder.h + +AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src + +AM_CFLAGS = -Wall $(GF_CFLAGS) + +CLEANFILES = diff --git a/xlators/performance/decompounder/src/decompounder-mem-types.h b/xlators/performance/decompounder/src/decompounder-mem-types.h new file mode 100644 index 00000000000..5c211c1a907 --- /dev/null +++ b/xlators/performance/decompounder/src/decompounder-mem-types.h @@ -0,0 +1,20 @@ +/* + Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com> + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef __DC_MEM_TYPES_H__ +#define __DC_MEM_TYPES_H__ + +#include "mem-types.h" + +enum gf_dc_mem_types_ { + gf_dc_mt_rsp_t = gf_common_mt_end + 1, + gf_dc_mt_end +}; +#endif diff --git a/xlators/performance/decompounder/src/decompounder-messages.h b/xlators/performance/decompounder/src/decompounder-messages.h new file mode 100644 index 00000000000..825599e9479 --- /dev/null +++ b/xlators/performance/decompounder/src/decompounder-messages.h @@ -0,0 +1,27 @@ +/* + Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com> + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _DC_MESSAGES_H_ +#define _DC_MESSAGES_H_ + +#include "glfs-message-id.h" + +#define GLFS_COMP_BASE_DC GLFS_MSGID_COMP_DC +#define GLFS_NUM_MESSAGES 2 +#define GLFS_MSGID_END (GLFS_COMP_BASE_DC + GLFS_NUM_MESSAGES + 1) + +#define glfs_msg_start_x GLFS_COMP_BASE_DC, "Invalid: Start of messages" + +#define DC_MSG_VOL_MISCONFIGURED (GLFS_COMP_BASE_DC + 1) + +#define DC_MSG_ERROR_RECEIVED (GLFS_COMP_BASE_DC + 2) + +#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages" +#endif /* !_DC_MESSAGES_H_ */ diff --git a/xlators/performance/decompounder/src/decompounder.c b/xlators/performance/decompounder/src/decompounder.c new file mode 100644 index 00000000000..830876ec0bf --- /dev/null +++ b/xlators/performance/decompounder/src/decompounder.c @@ -0,0 +1,946 @@ +/* + Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com> + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#include "decompounder.h" +#include "mem-types.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); + return; +} + +int32_t +dc_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) +{ + + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (stat, frame, op_ret, + op_errno, buf, xdata); + return 0; +} + +int32_t +dc_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, const char *path, + struct iatt *buf, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (readlink, frame, op_ret, op_errno, + path, buf, xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (mknod, frame, op_ret, op_errno, + inode, buf, preparent, + postparent, xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (mkdir, frame, op_ret, op_errno, + inode, buf, preparent, postparent, + xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (unlink, frame, op_ret, op_errno, + preparent, postparent, xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (rmdir, frame, op_ret, op_errno, + preparent, postparent, xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (symlink, frame, op_ret, op_errno, + inode, buf, preparent, postparent, + xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (rename, frame, op_ret, op_errno, + buf, preoldparent, postoldparent, + prenewparent, postnewparent, + xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (link, frame, op_ret, op_errno, + inode, buf, preparent, postparent, + xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (truncate, frame, op_ret, op_errno, + prebuf, postbuf, xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (open, frame, op_ret, op_errno, + fd, xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (readv, frame, op_ret, op_errno, + vector, count, stbuf, iobref, xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (writev, frame, op_ret, op_errno, + prebuf, postbuf, xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (statfs, frame, op_ret, op_errno, + buf, xdata); + return 0; +} + + +int32_t +dc_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (flush, frame, op_ret, op_errno, + xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (fsync, frame, op_ret, op_errno, + prebuf, postbuf, xdata); + return 0; +} + + +int32_t +dc_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (setxattr, frame, op_ret, op_errno, + xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (getxattr, frame, op_ret, op_errno, + dict, xdata); + return 0; +} + + +int32_t +dc_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (removexattr, frame, op_ret, op_errno, + xdata); + return 0; +} + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (opendir, frame, op_ret, op_errno, + fd, xdata); + return 0; +} + + +int32_t +dc_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (fsyncdir, frame, op_ret, op_errno, + xdata); + return 0; +} + + +int32_t +dc_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (access, frame, op_ret, op_errno, + xdata); + return 0; +} + + +int32_t +dc_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 *buf, + struct iatt *preparent, + struct iatt *postparent, + dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (create, frame, op_ret, op_errno, + fd, inode, buf, preparent, + postparent, xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (ftruncate, frame, op_ret, op_errno, + prebuf, postbuf, xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (fstat, frame, op_ret, op_errno, + buf, xdata); + return 0; +} + + +int32_t +dc_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct gf_flock *lock, + dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (lk, frame, op_ret, op_errno, + lock, xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (lookup, frame, op_ret, op_errno, + inode, buf, xdata, postparent); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (readdir, frame, op_ret, op_errno, + entries, xdata); + return 0; +} + + +int32_t +dc_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (inodelk, frame, op_ret, op_errno, + xdata); + return 0; +} + + +int32_t +dc_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (finodelk, frame, op_ret, op_errno, + xdata); + return 0; +} + + +int32_t +dc_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (entrylk, frame, op_ret, op_errno, + xdata); + return 0; +} + + +int32_t +dc_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (fentrylk, frame, op_ret, op_errno, + xdata); + return 0; +} + + +int32_t +dc_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *dict, + dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (xattrop, frame, op_ret, op_errno, + dict, xdata); + return 0; +} + + +int32_t +dc_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *dict, + dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (fxattrop, frame, op_ret, op_errno, + dict, xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (fgetxattr, frame, op_ret, op_errno, + dict, xdata); + return 0; +} + + +int32_t +dc_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (fsetxattr, frame, op_ret, op_errno, + xdata); + return 0; +} + + +int32_t +dc_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, uint32_t weak_cksum, + uint8_t *strong_cksum, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (rchecksum, frame, op_ret, op_errno, + weak_cksum, strong_cksum, xdata); + return 0; +} + + +int32_t +dc_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iatt *statpre, + struct iatt *statpost, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (setattr, frame, op_ret, op_errno, + statpre, statpost, xdata); + return 0; +} + + +int32_t +dc_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iatt *statpre, + struct iatt *statpost, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (fsetattr, frame, op_ret, op_errno, + statpre, statpost, xdata); + return 0; +} + + +int32_t +dc_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) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (readdirp, frame, op_ret, op_errno, + entries, xdata); + return 0; +} + + +int32_t +dc_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (fremovexattr, frame, op_ret, op_errno, + xdata); + return 0; +} + + +int32_t +dc_fallocate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iatt *pre, + struct iatt *post, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (fallocate, frame, op_ret, op_errno, + pre, post, xdata); + return 0; +} + + +int32_t +dc_discard_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iatt *pre, + struct iatt *post, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (discard, frame, op_ret, op_errno, + pre, post, xdata); + return 0; +} + + +int32_t +dc_zerofill_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iatt *pre, + struct iatt *post, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (zerofill, frame, op_ret, op_errno, + pre, post, xdata); + return 0; +} + + +int32_t +dc_ipc_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (ipc, frame, op_ret, op_errno, + xdata); + return 0; +} + + +int32_t +dc_seek_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, off_t offset, dict_t *xdata) +{ + DC_FOP_RESPONSE_STORE_AND_WIND_NEXT (seek, frame, op_ret, op_errno, + offset, xdata); + return 0; +} + +int32_t +dc_compound_fop_wind (call_frame_t *frame, xlator_t *this) +{ + dc_local_t *local = frame->local; + 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]; + int op_ret = 0; + int op_errno = ENOMEM; + + if (local->counter == local->length) + goto done; + + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + break; + default: + return -ENOTSUP; + } + return 0; +done: + DC_STACK_UNWIND (frame, op_ret, op_errno, c_rsp, NULL); + return 0; +} + +int32_t +dc_compound (call_frame_t *frame, xlator_t *this, void *data, dict_t *xdata) +{ + compound_args_t *compound_req = NULL; + compound_args_cbk_t *compound_rsp = NULL; + int ret = 0; + int op_errno = ENOMEM; + dc_local_t *local = NULL; + + compound_req = data; + + GF_ASSERT_AND_GOTO_WITH_ERROR (this, compound_req, out, op_errno, + EINVAL); + + local = mem_get0 (this->local_pool); + if (!local) + goto out; + + frame->local = local; + + local->compound_rsp = GF_CALLOC (1, sizeof (local->compound_rsp), + gf_dc_mt_rsp_t); + 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; + + if (!local->length) { + op_errno = EINVAL; + goto out; + } + + ret = dc_compound_fop_wind (frame, this); + if (ret < 0) { + op_errno = -ret; + goto out; + } + return 0; +out: + DC_STACK_UNWIND (frame, -1, op_errno, compound_rsp, NULL); + return 0; +} + +struct xlator_fops fops = { + .compound = dc_compound, +}; + +int32_t +mem_acct_init (xlator_t *this) +{ + int ret = -1; + + if (!this) + return ret; + + ret = xlator_mem_acct_init (this, gf_dc_mt_end + 1); + + return ret; +} + +int32_t +init (xlator_t *this) +{ + int ret = 0; + + if (!this->children) { + gf_msg (this->name, GF_LOG_WARNING, 0, + DC_MSG_VOL_MISCONFIGURED, "Decompounder must have" + " a subvol."); + ret = -1; + goto out; + } + + if (!this->parents) { + gf_msg (this->name, GF_LOG_WARNING, 0, + DC_MSG_VOL_MISCONFIGURED, "Volume is dangling."); + ret = -1; + goto out; + } +out: + return ret; +} + +int32_t +fini (xlator_t *this) +{ + return 0; +} diff --git a/xlators/performance/decompounder/src/decompounder.h b/xlators/performance/decompounder/src/decompounder.h new file mode 100644 index 00000000000..1b8c1d6d00f --- /dev/null +++ b/xlators/performance/decompounder/src/decompounder.h @@ -0,0 +1,74 @@ +/* + Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com> + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef __DC_H__ +#define __DC_H__ + +#include "defaults.h" +#include "xlator.h" +#include "call-stub.h" +#include "decompounder-mem-types.h" +#include "decompounder-messages.h" + +typedef struct { + compound_args_t *compound_req; + compound_args_cbk_t *compound_rsp; + int counter; + int length; +} dc_local_t; + +#define DC_STACK_UNWIND(frame, op_ret, op_errno, rsp, xdata) do {\ + dc_local_t *__local = NULL; \ + if (frame) { \ + __local = frame->local; \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT (compound, frame, op_ret, op_errno, \ + (void *)rsp, xdata); \ + if (__local) { \ + dc_local_cleanup (__local); \ + mem_put (__local); \ + } \ + } while (0) + +int32_t +dc_compound_fop_wind (call_frame_t *frame, xlator_t *this); + +void +dc_local_cleanup (dc_local_t *local); + +#define DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(fop, frame, op_ret, op_errno, params ...) do { \ + dc_local_t *__local = frame->local; \ + xlator_t *__this = frame->this; \ + int __ret = 0; \ + int __counter = __local->counter; \ + compound_args_cbk_t *__compound_rsp = __local->compound_rsp; \ + default_args_cbk_t *__fop_rsp = &__local->compound_rsp->rsp_list[__counter]; \ + \ + if (op_ret < 0) { \ + gf_msg (__this->name, GF_LOG_ERROR, op_errno, DC_MSG_ERROR_RECEIVED, \ + "fop number %d failed. Unwinding.", __counter+1); \ + args_##fop##_cbk_store (__fop_rsp, \ + op_ret, op_errno, params); \ + /*TODO : Fill the rest of the responses to -1 or NULL*/ \ + DC_STACK_UNWIND (frame, op_ret, op_errno, \ + (void *)__compound_rsp, NULL); \ + } else { \ + args_##fop##_cbk_store (__fop_rsp, \ + op_ret, op_errno, params); \ + __local->counter++; \ + __ret = dc_compound_fop_wind (frame, __this); \ + if (__ret < 0) { \ + DC_STACK_UNWIND (frame, -1, -__ret, \ + (void *)__compound_rsp, NULL); \ + } \ + } \ + } while (0) +#endif /* DC_H__ */ |