diff options
author | Anand Avati <avati@redhat.com> | 2013-02-15 17:14:50 -0800 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-02-19 16:07:59 -0800 |
commit | f0bfbbd0f260fe898cd901b0ac0a6a805b33800c (patch) | |
tree | eeef2d2842469c80f8bdd0ed1c032559697a8c2d | |
parent | f1ce56daf8dff68dc59a7ad4841e428296157011 (diff) |
call-stub: internal refactor
- re-structure members of call_stub_t with new simpler layout
- easier to inspect call_stub_t contents in gdb now
- fix a bunch of double unrefs and double frees in cbk stub
- change all STACK_UNWIND to STACK_UNWIND_STRICT and thereby fixed
a lot of bad params
- implement new API call_unwind_error() which can even be called on
fop_XXX_stub(), and not necessarily fop_XXX_cbk_stub()
Change-Id: Idf979f14d46256af0afb9658915cc79de157b2d7
BUG: 846240
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4520
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
-rw-r--r-- | libglusterfs/src/call-stub.c | 3323 | ||||
-rw-r--r-- | libglusterfs/src/call-stub.h | 697 | ||||
-rw-r--r-- | xlators/performance/write-behind/src/write-behind.c | 80 |
3 files changed, 1105 insertions, 2995 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index 0ca5bf7f1e4..7bf8613809f 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -37,15 +37,15 @@ stub_new (call_frame_t *frame, new->fop = fop; new->stub_mem_pool = frame->this->ctx->stub_mem_pool; INIT_LIST_HEAD (&new->list); + + INIT_LIST_HEAD (&new->args_cbk.entries); out: return new; } call_stub_t * -fop_lookup_stub (call_frame_t *frame, - fop_lookup_t fn, - loc_t *loc, +fop_lookup_stub (call_frame_t *frame, fop_lookup_t fn, loc_t *loc, dict_t *xdata) { call_stub_t *stub = NULL; @@ -56,11 +56,11 @@ fop_lookup_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_LOOKUP); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.lookup.fn = fn; + stub->fn.lookup = fn; - loc_copy (&stub->args.lookup.loc, loc); + loc_copy (&stub->args.loc, loc); if (xdata) - stub->xdata = dict_ref (xdata); + stub->args.xdata = dict_ref (xdata); out: return stub; @@ -68,14 +68,10 @@ out: call_stub_t * -fop_lookup_cbk_stub (call_frame_t *frame, - fop_lookup_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - inode_t *inode, - struct iatt *buf, - dict_t *xdata, - struct iatt *postparent) +fop_lookup_cbk_stub (call_frame_t *frame, fop_lookup_cbk_t fn, + int32_t op_ret, int32_t op_errno, + inode_t *inode, struct iatt *buf, + dict_t *xdata, struct iatt *postparent) { call_stub_t *stub = NULL; @@ -84,27 +80,24 @@ fop_lookup_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_LOOKUP); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.lookup_cbk.fn = fn; - stub->args.lookup_cbk.op_ret = op_ret; - stub->args.lookup_cbk.op_errno = op_errno; + stub->fn_cbk.lookup = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (inode) - stub->args.lookup_cbk.inode = inode_ref (inode); + stub->args_cbk.inode = inode_ref (inode); if (buf) - stub->args.lookup_cbk.buf = *buf; + stub->args_cbk.stat = *buf; if (postparent) - stub->args.lookup_cbk.postparent = *postparent; + stub->args_cbk.postparent = *postparent; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } - call_stub_t * -fop_stat_stub (call_frame_t *frame, - fop_stat_t fn, +fop_stat_stub (call_frame_t *frame, fop_stat_t fn, loc_t *loc, dict_t *xdata) { call_stub_t *stub = NULL; @@ -115,21 +108,18 @@ fop_stat_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_STAT); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.stat.fn = fn; - loc_copy (&stub->args.stat.loc, loc); + stub->fn.stat = fn; + loc_copy (&stub->args.loc, loc); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_stat_cbk_stub (call_frame_t *frame, - fop_stat_cbk_t fn, - int32_t op_ret, - int32_t op_errno, +fop_stat_cbk_stub (call_frame_t *frame, fop_stat_cbk_t fn, + int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata) { call_stub_t *stub = NULL; @@ -139,22 +129,20 @@ fop_stat_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_STAT); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.stat_cbk.fn = fn; - stub->args.stat_cbk.op_ret = op_ret; - stub->args.stat_cbk.op_errno = op_errno; + stub->fn_cbk.stat = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (op_ret == 0) - stub->args.stat_cbk.buf = *buf; + stub->args_cbk.stat = *buf; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_fstat_stub (call_frame_t *frame, - fop_fstat_t fn, +fop_fstat_stub (call_frame_t *frame, fop_fstat_t fn, fd_t *fd, dict_t *xdata) { call_stub_t *stub = NULL; @@ -164,23 +152,20 @@ fop_fstat_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_FSTAT); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fstat.fn = fn; + stub->fn.fstat = fn; if (fd) - stub->args.fstat.fd = fd_ref (fd); + stub->args.fd = fd_ref (fd); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_fstat_cbk_stub (call_frame_t *frame, - fop_fstat_cbk_t fn, - int32_t op_ret, - int32_t op_errno, +fop_fstat_cbk_stub (call_frame_t *frame, fop_fstat_cbk_t fn, + int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata) { call_stub_t *stub = NULL; @@ -190,26 +175,21 @@ fop_fstat_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_FSTAT); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fstat_cbk.fn = fn; - stub->args.fstat_cbk.op_ret = op_ret; - stub->args.fstat_cbk.op_errno = op_errno; + stub->fn_cbk.fstat = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (buf) - stub->args.fstat_cbk.buf = *buf; + stub->args_cbk.stat = *buf; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } -/* truncate */ - call_stub_t * -fop_truncate_stub (call_frame_t *frame, - fop_truncate_t fn, - loc_t *loc, - off_t off, dict_t *xdata) +fop_truncate_stub (call_frame_t *frame, fop_truncate_t fn, + loc_t *loc, off_t off, dict_t *xdata) { call_stub_t *stub = NULL; @@ -219,24 +199,20 @@ fop_truncate_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_TRUNCATE); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.truncate.fn = fn; - loc_copy (&stub->args.truncate.loc, loc); - stub->args.truncate.off = off; + stub->fn.truncate = fn; + loc_copy (&stub->args.loc, loc); + stub->args.offset = off; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_truncate_cbk_stub (call_frame_t *frame, - fop_truncate_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata) +fop_truncate_cbk_stub (call_frame_t *frame, fop_truncate_cbk_t fn, + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf, dict_t *xdata) { call_stub_t *stub = NULL; @@ -245,26 +221,23 @@ fop_truncate_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_TRUNCATE); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.truncate_cbk.fn = fn; - stub->args.truncate_cbk.op_ret = op_ret; - stub->args.truncate_cbk.op_errno = op_errno; + stub->fn_cbk.truncate = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (prebuf) - stub->args.truncate_cbk.prebuf = *prebuf; + stub->args_cbk.prestat = *prebuf; if (postbuf) - stub->args.truncate_cbk.postbuf = *postbuf; + stub->args_cbk.poststat = *postbuf; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_ftruncate_stub (call_frame_t *frame, - fop_ftruncate_t fn, - fd_t *fd, - off_t off, dict_t *xdata) +fop_ftruncate_stub (call_frame_t *frame, fop_ftruncate_t fn, + fd_t *fd, off_t off, dict_t *xdata) { call_stub_t *stub = NULL; @@ -273,26 +246,22 @@ fop_ftruncate_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_FTRUNCATE); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.ftruncate.fn = fn; + stub->fn.ftruncate = fn; if (fd) - stub->args.ftruncate.fd = fd_ref (fd); + stub->args.fd = fd_ref (fd); - stub->args.ftruncate.off = off; + stub->args.offset = off; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_ftruncate_cbk_stub (call_frame_t *frame, - fop_ftruncate_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata) +fop_ftruncate_cbk_stub (call_frame_t *frame, fop_ftruncate_cbk_t fn, + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf, dict_t *xdata) { call_stub_t *stub = NULL; @@ -301,15 +270,15 @@ fop_ftruncate_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_FTRUNCATE); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.ftruncate_cbk.fn = fn; - stub->args.ftruncate_cbk.op_ret = op_ret; - stub->args.ftruncate_cbk.op_errno = op_errno; + stub->fn_cbk.ftruncate = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (prebuf) - stub->args.ftruncate_cbk.prebuf = *prebuf; + stub->args_cbk.prestat = *prebuf; if (postbuf) - stub->args.ftruncate_cbk.postbuf = *postbuf; + stub->args_cbk.poststat = *postbuf; if (xdata) - stub->xdata = dict_ref (xdata); + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; @@ -317,10 +286,8 @@ out: call_stub_t * -fop_access_stub (call_frame_t *frame, - fop_access_t fn, - loc_t *loc, - int32_t mask, dict_t *xdata) +fop_access_stub (call_frame_t *frame, fop_access_t fn, + loc_t *loc, int32_t mask, dict_t *xdata) { call_stub_t *stub = NULL; @@ -330,22 +297,19 @@ fop_access_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_ACCESS); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.access.fn = fn; - loc_copy (&stub->args.access.loc, loc); - stub->args.access.mask = mask; + stub->fn.access = fn; + loc_copy (&stub->args.loc, loc); + stub->args.mask = mask; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_access_cbk_stub (call_frame_t *frame, - fop_access_cbk_t fn, - int32_t op_ret, - int32_t op_errno, dict_t *xdata) +fop_access_cbk_stub (call_frame_t *frame, fop_access_cbk_t fn, + int32_t op_ret, int32_t op_errno, dict_t *xdata) { call_stub_t *stub = NULL; @@ -354,22 +318,19 @@ fop_access_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_ACCESS); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.access_cbk.fn = fn; - stub->args.access_cbk.op_ret = op_ret; - stub->args.access_cbk.op_errno = op_errno; + stub->fn_cbk.access = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_readlink_stub (call_frame_t *frame, - fop_readlink_t fn, - loc_t *loc, - size_t size, dict_t *xdata) +fop_readlink_stub (call_frame_t *frame, fop_readlink_t fn, + loc_t *loc, size_t size, dict_t *xdata) { call_stub_t *stub = NULL; @@ -379,24 +340,20 @@ fop_readlink_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_READLINK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.readlink.fn = fn; - loc_copy (&stub->args.readlink.loc, loc); - stub->args.readlink.size = size; + stub->fn.readlink = fn; + loc_copy (&stub->args.loc, loc); + stub->args.size = size; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_readlink_cbk_stub (call_frame_t *frame, - fop_readlink_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - const char *path, - struct iatt *sbuf, dict_t *xdata) +fop_readlink_cbk_stub (call_frame_t *frame, fop_readlink_cbk_t fn, + int32_t op_ret, int32_t op_errno, + const char *path, struct iatt *stbuf, dict_t *xdata) { call_stub_t *stub = NULL; @@ -405,16 +362,15 @@ fop_readlink_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_READLINK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.readlink_cbk.fn = fn; - stub->args.readlink_cbk.op_ret = op_ret; - stub->args.readlink_cbk.op_errno = op_errno; + stub->fn_cbk.readlink = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (path) - stub->args.readlink_cbk.buf = gf_strdup (path); - if (sbuf) - stub->args.readlink_cbk.sbuf = *sbuf; + stub->args_cbk.buf = gf_strdup (path); + if (stbuf) + stub->args_cbk.stat = *stbuf; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } @@ -432,28 +388,23 @@ fop_mknod_stub (call_frame_t *frame, fop_mknod_t fn, loc_t *loc, mode_t mode, stub = stub_new (frame, 1, GF_FOP_MKNOD); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.mknod.fn = fn; - loc_copy (&stub->args.mknod.loc, loc); - stub->args.mknod.mode = mode; - stub->args.mknod.rdev = rdev; - stub->args.mknod.umask = umask; + stub->fn.mknod = fn; + loc_copy (&stub->args.loc, loc); + stub->args.mode = mode; + stub->args.rdev = rdev; + stub->args.umask = umask; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_mknod_cbk_stub (call_frame_t *frame, - fop_mknod_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - inode_t *inode, - struct iatt *buf, - struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) +fop_mknod_cbk_stub (call_frame_t *frame, fop_mknod_cbk_t fn, int32_t op_ret, + int32_t op_errno, inode_t *inode, struct iatt *buf, + struct iatt *preparent, struct iatt *postparent, + dict_t *xdata) { call_stub_t *stub = NULL; @@ -462,19 +413,19 @@ fop_mknod_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_MKNOD); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.mknod_cbk.fn = fn; - stub->args.mknod_cbk.op_ret = op_ret; - stub->args.mknod_cbk.op_errno = op_errno; + stub->fn_cbk.mknod = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (inode) - stub->args.mknod_cbk.inode = inode_ref (inode); + stub->args_cbk.inode = inode_ref (inode); if (buf) - stub->args.mknod_cbk.buf = *buf; + stub->args_cbk.stat = *buf; if (preparent) - stub->args.mknod_cbk.preparent = *preparent; + stub->args_cbk.preparent = *preparent; if (postparent) - stub->args.mknod_cbk.postparent = *postparent; + stub->args_cbk.postparent = *postparent; if (xdata) - stub->xdata = dict_ref (xdata); + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; @@ -493,27 +444,22 @@ fop_mkdir_stub (call_frame_t *frame, fop_mkdir_t fn, stub = stub_new (frame, 1, GF_FOP_MKDIR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.mkdir.fn = fn; - loc_copy (&stub->args.mkdir.loc, loc); - stub->args.mkdir.mode = mode; - stub->args.mkdir.umask = umask; + stub->fn.mkdir = fn; + loc_copy (&stub->args.loc, loc); + stub->args.mode = mode; + stub->args.umask = umask; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_mkdir_cbk_stub (call_frame_t *frame, - fop_mkdir_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - inode_t *inode, - struct iatt *buf, - struct iatt *preparent, +fop_mkdir_cbk_stub (call_frame_t *frame, fop_mkdir_cbk_t fn, + int32_t op_ret, int32_t op_errno, inode_t *inode, + struct iatt *buf, struct iatt *preparent, struct iatt *postparent, dict_t *xdata) { call_stub_t *stub = NULL; @@ -523,28 +469,26 @@ fop_mkdir_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_MKDIR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.mkdir_cbk.fn = fn; - stub->args.mkdir_cbk.op_ret = op_ret; - stub->args.mkdir_cbk.op_errno = op_errno; + stub->fn_cbk.mkdir = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (inode) - stub->args.mkdir_cbk.inode = inode_ref (inode); + stub->args_cbk.inode = inode_ref (inode); if (buf) - stub->args.mkdir_cbk.buf = *buf; + stub->args_cbk.stat = *buf; if (preparent) - stub->args.mkdir_cbk.preparent = *preparent; + stub->args_cbk.preparent = *preparent; if (postparent) - stub->args.mkdir_cbk.postparent = *postparent; + stub->args_cbk.postparent = *postparent; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_unlink_stub (call_frame_t *frame, - fop_unlink_t fn, +fop_unlink_stub (call_frame_t *frame, fop_unlink_t fn, loc_t *loc, int xflag, dict_t *xdata) { call_stub_t *stub = NULL; @@ -555,24 +499,21 @@ fop_unlink_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_UNLINK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.unlink.fn = fn; - loc_copy (&stub->args.unlink.loc, loc); - stub->args.unlink.xflag = xflag; + stub->fn.unlink = fn; + loc_copy (&stub->args.loc, loc); + stub->args.xflag = xflag; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_unlink_cbk_stub (call_frame_t *frame, - fop_unlink_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) +fop_unlink_cbk_stub (call_frame_t *frame, fop_unlink_cbk_t fn, + int32_t op_ret, int32_t op_errno, + struct iatt *preparent, struct iatt *postparent, + dict_t *xdata) { call_stub_t *stub = NULL; @@ -581,16 +522,15 @@ fop_unlink_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_UNLINK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.unlink_cbk.fn = fn; - stub->args.unlink_cbk.op_ret = op_ret; - stub->args.unlink_cbk.op_errno = op_errno; + stub->fn_cbk.unlink = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (preparent) - stub->args.unlink_cbk.preparent = *preparent; + stub->args_cbk.preparent = *preparent; if (postparent) - stub->args.unlink_cbk.postparent = *postparent; + stub->args_cbk.postparent = *postparent; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } @@ -609,24 +549,21 @@ fop_rmdir_stub (call_frame_t *frame, fop_rmdir_t fn, stub = stub_new (frame, 1, GF_FOP_RMDIR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.rmdir.fn = fn; - loc_copy (&stub->args.rmdir.loc, loc); - stub->args.rmdir.flags = flags; + stub->fn.rmdir = fn; + loc_copy (&stub->args.loc, loc); + stub->args.flags = flags; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_rmdir_cbk_stub (call_frame_t *frame, - fop_rmdir_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) +fop_rmdir_cbk_stub (call_frame_t *frame, fop_rmdir_cbk_t fn, + int32_t op_ret, int32_t op_errno, + struct iatt *preparent, struct iatt *postparent, + dict_t *xdata) { call_stub_t *stub = NULL; @@ -635,16 +572,15 @@ fop_rmdir_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_RMDIR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.rmdir_cbk.fn = fn; - stub->args.rmdir_cbk.op_ret = op_ret; - stub->args.rmdir_cbk.op_errno = op_errno; + stub->fn_cbk.rmdir = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (preparent) - stub->args.rmdir_cbk.preparent = *preparent; + stub->args_cbk.preparent = *preparent; if (postparent) - stub->args.rmdir_cbk.postparent = *postparent; + stub->args_cbk.postparent = *postparent; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } @@ -663,27 +599,23 @@ fop_symlink_stub (call_frame_t *frame, fop_symlink_t fn, stub = stub_new (frame, 1, GF_FOP_SYMLINK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.symlink.fn = fn; - stub->args.symlink.linkname = gf_strdup (linkname); - stub->args.symlink.umask = umask; - loc_copy (&stub->args.symlink.loc, loc); + stub->fn.symlink = fn; + stub->args.linkname = gf_strdup (linkname); + stub->args.umask = umask; + loc_copy (&stub->args.loc, loc); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_symlink_cbk_stub (call_frame_t *frame, - fop_symlink_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - inode_t *inode, - struct iatt *buf, - struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) +fop_symlink_cbk_stub (call_frame_t *frame, fop_symlink_cbk_t fn, + int32_t op_ret, int32_t op_errno, + inode_t *inode, struct iatt *buf, + struct iatt *preparent, struct iatt *postparent, + dict_t *xdata) { call_stub_t *stub = NULL; @@ -692,30 +624,27 @@ fop_symlink_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_SYMLINK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.symlink_cbk.fn = fn; - stub->args.symlink_cbk.op_ret = op_ret; - stub->args.symlink_cbk.op_errno = op_errno; + stub->fn_cbk.symlink = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (inode) - stub->args.symlink_cbk.inode = inode_ref (inode); + stub->args_cbk.inode = inode_ref (inode); if (buf) - stub->args.symlink_cbk.buf = *buf; + stub->args_cbk.stat = *buf; if (preparent) - stub->args.symlink_cbk.preparent = *preparent; + stub->args_cbk.preparent = *preparent; if (postparent) - stub->args.symlink_cbk.postparent = *postparent; + stub->args_cbk.postparent = *postparent; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_rename_stub (call_frame_t *frame, - fop_rename_t fn, - loc_t *oldloc, - loc_t *newloc, dict_t *xdata) +fop_rename_stub (call_frame_t *frame, fop_rename_t fn, + loc_t *oldloc, loc_t *newloc, dict_t *xdata) { call_stub_t *stub = NULL; @@ -726,27 +655,22 @@ fop_rename_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_RENAME); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.rename.fn = fn; - loc_copy (&stub->args.rename.old, oldloc); - loc_copy (&stub->args.rename.new, newloc); + stub->fn.rename = fn; + loc_copy (&stub->args.loc, oldloc); + loc_copy (&stub->args.loc2, newloc); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_rename_cbk_stub (call_frame_t *frame, - fop_rename_cbk_t fn, - 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) +fop_rename_cbk_stub (call_frame_t *frame, fop_rename_cbk_t fn, + 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) { call_stub_t *stub = NULL; @@ -755,32 +679,29 @@ fop_rename_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_RENAME); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.rename_cbk.fn = fn; - stub->args.rename_cbk.op_ret = op_ret; - stub->args.rename_cbk.op_errno = op_errno; + stub->fn_cbk.rename = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (buf) - stub->args.rename_cbk.buf = *buf; + stub->args_cbk.stat = *buf; if (preoldparent) - stub->args.rename_cbk.preoldparent = *preoldparent; + stub->args_cbk.preparent = *preoldparent; if (postoldparent) - stub->args.rename_cbk.postoldparent = *postoldparent; + stub->args_cbk.postparent = *postoldparent; if (prenewparent) - stub->args.rename_cbk.prenewparent = *prenewparent; + stub->args_cbk.preparent2 = *prenewparent; if (postnewparent) - stub->args.rename_cbk.postnewparent = *postnewparent; + stub->args_cbk.postparent2 = *postnewparent; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_link_stub (call_frame_t *frame, - fop_link_t fn, - loc_t *oldloc, - loc_t *newloc, dict_t *xdata) +fop_link_stub (call_frame_t *frame, fop_link_t fn, + loc_t *oldloc, loc_t *newloc, dict_t *xdata) { call_stub_t *stub = NULL; @@ -791,27 +712,23 @@ fop_link_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_LINK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.link.fn = fn; - loc_copy (&stub->args.link.oldloc, oldloc); - loc_copy (&stub->args.link.newloc, newloc); + stub->fn.link = fn; + loc_copy (&stub->args.loc, oldloc); + loc_copy (&stub->args.loc2, newloc); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_link_cbk_stub (call_frame_t *frame, - fop_link_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - inode_t *inode, - struct iatt *buf, - struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) +fop_link_cbk_stub (call_frame_t *frame, fop_link_cbk_t fn, + int32_t op_ret, int32_t op_errno, + inode_t *inode, struct iatt *buf, + struct iatt *preparent, struct iatt *postparent, + dict_t *xdata) { call_stub_t *stub = NULL; @@ -820,20 +737,19 @@ fop_link_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_LINK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.link_cbk.fn = fn; - stub->args.link_cbk.op_ret = op_ret; - stub->args.link_cbk.op_errno = op_errno; + stub->fn_cbk.link = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (inode) - stub->args.link_cbk.inode = inode_ref (inode); + stub->args_cbk.inode = inode_ref (inode); if (buf) - stub->args.link_cbk.buf = *buf; + stub->args_cbk.stat = *buf; if (preparent) - stub->args.link_cbk.preparent = *preparent; + stub->args_cbk.preparent = *preparent; if (postparent) - stub->args.link_cbk.postparent = *postparent; + stub->args_cbk.postparent = *postparent; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } @@ -852,31 +768,26 @@ fop_create_stub (call_frame_t *frame, fop_create_t fn, stub = stub_new (frame, 1, GF_FOP_CREATE); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.create.fn = fn; - loc_copy (&stub->args.create.loc, loc); - stub->args.create.flags = flags; - stub->args.create.mode = mode; - stub->args.create.umask = umask; + stub->fn.create = fn; + loc_copy (&stub->args.loc, loc); + stub->args.flags = flags; + stub->args.mode = mode; + stub->args.umask = umask; if (fd) - stub->args.create.fd = fd_ref (fd); + stub->args.fd = fd_ref (fd); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_create_cbk_stub (call_frame_t *frame, - fop_create_cbk_t fn, - 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) +fop_create_cbk_stub (call_frame_t *frame, fop_create_cbk_t fn, + 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) { call_stub_t *stub = NULL; @@ -885,33 +796,29 @@ fop_create_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_CREATE); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.create_cbk.fn = fn; - stub->args.create_cbk.op_ret = op_ret; - stub->args.create_cbk.op_errno = op_errno; + stub->fn_cbk.create = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (fd) - stub->args.create_cbk.fd = fd_ref (fd); + stub->args_cbk.fd = fd_ref (fd); if (inode) - stub->args.create_cbk.inode = inode_ref (inode); + stub->args_cbk.inode = inode_ref (inode); if (buf) - stub->args.create_cbk.buf = *buf; + stub->args_cbk.stat = *buf; if (preparent) - stub->args.create_cbk.preparent = *preparent; + stub->args_cbk.preparent = *preparent; if (postparent) - stub->args.create_cbk.postparent = *postparent; + stub->args_cbk.postparent = *postparent; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_open_stub (call_frame_t *frame, - fop_open_t fn, - loc_t *loc, - int32_t flags, fd_t *fd, - dict_t *xdata) +fop_open_stub (call_frame_t *frame, fop_open_t fn, + loc_t *loc, int32_t flags, fd_t *fd, dict_t *xdata) { call_stub_t *stub = NULL; @@ -921,24 +828,21 @@ fop_open_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_OPEN); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.open.fn = fn; - loc_copy (&stub->args.open.loc, loc); - stub->args.open.flags = flags; + stub->fn.open = fn; + loc_copy (&stub->args.loc, loc); + stub->args.flags = flags; if (fd) - stub->args.open.fd = fd_ref (fd); + stub->args.fd = fd_ref (fd); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_open_cbk_stub (call_frame_t *frame, - fop_open_cbk_t fn, - int32_t op_ret, - int32_t op_errno, +fop_open_cbk_stub (call_frame_t *frame, fop_open_cbk_t fn, + int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) { call_stub_t *stub = NULL; @@ -948,25 +852,22 @@ fop_open_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_OPEN); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.open_cbk.fn = fn; - stub->args.open_cbk.op_ret = op_ret; - stub->args.open_cbk.op_errno = op_errno; + stub->fn_cbk.open = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (fd) - stub->args.open_cbk.fd = fd_ref (fd); + stub->args_cbk.fd = fd_ref (fd); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_readv_stub (call_frame_t *frame, - fop_readv_t fn, - fd_t *fd, - size_t size, - off_t off, uint32_t flags, dict_t *xdata) +fop_readv_stub (call_frame_t *frame, fop_readv_t fn, + fd_t *fd, size_t size, off_t off, uint32_t flags, + dict_t *xdata) { call_stub_t *stub = NULL; @@ -975,29 +876,24 @@ fop_readv_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_READ); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.readv.fn = fn; + stub->fn.readv = fn; if (fd) - stub->args.readv.fd = fd_ref (fd); - stub->args.readv.size = size; - stub->args.readv.off = off; - stub->args.readv.flags = flags; + stub->args.fd = fd_ref (fd); + stub->args.size = size; + stub->args.offset = off; + stub->args.flags = flags; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_readv_cbk_stub (call_frame_t *frame, - fop_readv_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct iovec *vector, - int32_t count, - struct iatt *stbuf, +fop_readv_cbk_stub (call_frame_t *frame, fop_readv_cbk_t fn, + int32_t op_ret, int32_t op_errno, struct iovec *vector, + int32_t count, struct iatt *stbuf, struct iobref *iobref, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1007,31 +903,26 @@ fop_readv_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_READ); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.readv_cbk.fn = fn; - stub->args.readv_cbk.op_ret = op_ret; - stub->args.readv_cbk.op_errno = op_errno; + stub->fn_cbk.readv = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (op_ret >= 0) { - stub->args.readv_cbk.vector = iov_dup (vector, count); - stub->args.readv_cbk.count = count; - stub->args.readv_cbk.stbuf = *stbuf; - stub->args.readv_cbk.iobref = iobref_ref (iobref); + stub->args_cbk.vector = iov_dup (vector, count); + stub->args_cbk.count = count; + stub->args_cbk.stat = *stbuf; + stub->args_cbk.iobref = iobref_ref (iobref); } if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_writev_stub (call_frame_t *frame, - fop_writev_t fn, - fd_t *fd, - struct iovec *vector, - int32_t count, - off_t off, uint32_t flags, - struct iobref *iobref, dict_t *xdata) +fop_writev_stub (call_frame_t *frame, fop_writev_t fn, + fd_t *fd, struct iovec *vector, int32_t count, off_t off, + uint32_t flags, struct iobref *iobref, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1041,29 +932,25 @@ fop_writev_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_WRITE); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.writev.fn = fn; + stub->fn.writev = fn; if (fd) - stub->args.writev.fd = fd_ref (fd); - stub->args.writev.vector = iov_dup (vector, count); - stub->args.writev.count = count; - stub->args.writev.off = off; - stub->args.writev.flags = flags; - stub->args.writev.iobref = iobref_ref (iobref); + stub->args.fd = fd_ref (fd); + stub->args.vector = iov_dup (vector, count); + stub->args.count = count; + stub->args.offset = off; + stub->args.flags = flags; + stub->args.iobref = iobref_ref (iobref); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_writev_cbk_stub (call_frame_t *frame, - fop_writev_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata) +fop_writev_cbk_stub (call_frame_t *frame, fop_writev_cbk_t fn, + int32_t op_ret, int32_t op_errno, + struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1072,25 +959,22 @@ fop_writev_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_WRITE); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.writev_cbk.fn = fn; - stub->args.writev_cbk.op_ret = op_ret; - stub->args.writev_cbk.op_errno = op_errno; + stub->fn_cbk.writev = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (op_ret >= 0) - stub->args.writev_cbk.postbuf = *postbuf; + stub->args_cbk.poststat = *postbuf; if (prebuf) - stub->args.writev_cbk.prebuf = *prebuf; + stub->args_cbk.prestat = *prebuf; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } - call_stub_t * -fop_flush_stub (call_frame_t *frame, - fop_flush_t fn, +fop_flush_stub (call_frame_t *frame, fop_flush_t fn, fd_t *fd, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1100,22 +984,19 @@ fop_flush_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_FLUSH); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.flush.fn = fn; + stub->fn.flush = fn; if (fd) - stub->args.flush.fd = fd_ref (fd); + stub->args.fd = fd_ref (fd); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_flush_cbk_stub (call_frame_t *frame, - fop_flush_cbk_t fn, - int32_t op_ret, - int32_t op_errno, dict_t *xdata) +fop_flush_cbk_stub (call_frame_t *frame, fop_flush_cbk_t fn, + int32_t op_ret, int32_t op_errno, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1124,24 +1005,19 @@ fop_flush_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_FLUSH); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.flush_cbk.fn = fn; - stub->args.flush_cbk.op_ret = op_ret; - stub->args.flush_cbk.op_errno = op_errno; + stub->fn_cbk.flush = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } - - call_stub_t * -fop_fsync_stub (call_frame_t *frame, - fop_fsync_t fn, - fd_t *fd, - int32_t datasync, dict_t *xdata) +fop_fsync_stub (call_frame_t *frame, fop_fsync_t fn, + fd_t *fd, int32_t datasync, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1150,25 +1026,21 @@ fop_fsync_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_FSYNC); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fsync.fn = fn; + stub->fn.fsync = fn; if (fd) - stub->args.fsync.fd = fd_ref (fd); - stub->args.fsync.datasync = datasync; + stub->args.fd = fd_ref (fd); + stub->args.datasync = datasync; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_fsync_cbk_stub (call_frame_t *frame, - fop_fsync_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata) +fop_fsync_cbk_stub (call_frame_t *frame, fop_fsync_cbk_t fn, + int32_t op_ret, int32_t op_errno, + struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1177,24 +1049,22 @@ fop_fsync_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_FSYNC); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fsync_cbk.fn = fn; - stub->args.fsync_cbk.op_ret = op_ret; - stub->args.fsync_cbk.op_errno = op_errno; + stub->fn_cbk.fsync = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (prebuf) - stub->args.fsync_cbk.prebuf = *prebuf; + stub->args_cbk.prestat = *prebuf; if (postbuf) - stub->args.fsync_cbk.postbuf = *postbuf; + stub->args_cbk.poststat = *postbuf; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_opendir_stub (call_frame_t *frame, - fop_opendir_t fn, +fop_opendir_stub (call_frame_t *frame, fop_opendir_t fn, loc_t *loc, fd_t *fd, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1205,23 +1075,20 @@ fop_opendir_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_OPENDIR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.opendir.fn = fn; - loc_copy (&stub->args.opendir.loc, loc); + stub->fn.opendir = fn; + loc_copy (&stub->args.loc, loc); if (fd) - stub->args.opendir.fd = fd_ref (fd); + stub->args.fd = fd_ref (fd); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_opendir_cbk_stub (call_frame_t *frame, - fop_opendir_cbk_t fn, - int32_t op_ret, - int32_t op_errno, +fop_opendir_cbk_stub (call_frame_t *frame, fop_opendir_cbk_t fn, + int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1231,25 +1098,22 @@ fop_opendir_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_OPENDIR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.opendir_cbk.fn = fn; - stub->args.opendir_cbk.op_ret = op_ret; - stub->args.opendir_cbk.op_errno = op_errno; + stub->fn_cbk.opendir = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (fd) - stub->args.opendir_cbk.fd = fd_ref (fd); + stub->args_cbk.fd = fd_ref (fd); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_fsyncdir_stub (call_frame_t *frame, - fop_fsyncdir_t fn, - fd_t *fd, - int32_t datasync, dict_t *xdata) +fop_fsyncdir_stub (call_frame_t *frame, fop_fsyncdir_t fn, + fd_t *fd, int32_t datasync, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1258,23 +1122,20 @@ fop_fsyncdir_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_FSYNCDIR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fsyncdir.fn = fn; + stub->fn.fsyncdir = fn; if (fd) - stub->args.fsyncdir.fd = fd_ref (fd); - stub->args.fsyncdir.datasync = datasync; + stub->args.fd = fd_ref (fd); + stub->args.datasync = datasync; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_fsyncdir_cbk_stub (call_frame_t *frame, - fop_fsyncdir_cbk_t fn, - int32_t op_ret, - int32_t op_errno, dict_t *xdata) +fop_fsyncdir_cbk_stub (call_frame_t *frame, fop_fsyncdir_cbk_t fn, + int32_t op_ret, int32_t op_errno, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1283,20 +1144,18 @@ fop_fsyncdir_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_FSYNCDIR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fsyncdir_cbk.fn = fn; - stub->args.fsyncdir_cbk.op_ret = op_ret; - stub->args.fsyncdir_cbk.op_errno = op_errno; + stub->fn_cbk.fsyncdir = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_statfs_stub (call_frame_t *frame, - fop_statfs_t fn, +fop_statfs_stub (call_frame_t *frame, fop_statfs_t fn, loc_t *loc, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1307,21 +1166,18 @@ fop_statfs_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_STATFS); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.statfs.fn = fn; - loc_copy (&stub->args.statfs.loc, loc); + stub->fn.statfs = fn; + loc_copy (&stub->args.loc, loc); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_statfs_cbk_stub (call_frame_t *frame, - fop_statfs_cbk_t fn, - int32_t op_ret, - int32_t op_errno, +fop_statfs_cbk_stub (call_frame_t *frame, fop_statfs_cbk_t fn, + int32_t op_ret, int32_t op_errno, struct statvfs *buf, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1331,24 +1187,21 @@ fop_statfs_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_STATFS); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.statfs_cbk.fn = fn; - stub->args.statfs_cbk.op_ret = op_ret; - stub->args.statfs_cbk.op_errno = op_errno; + stub->fn_cbk.statfs = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (op_ret == 0) - stub->args.statfs_cbk.buf = *buf; + stub->args_cbk.statvfs = *buf; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_setxattr_stub (call_frame_t *frame, - fop_setxattr_t fn, - loc_t *loc, - dict_t *dict, +fop_setxattr_stub (call_frame_t *frame, fop_setxattr_t fn, + loc_t *loc, dict_t *dict, int32_t flags, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1359,15 +1212,14 @@ fop_setxattr_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_SETXATTR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.setxattr.fn = fn; - loc_copy (&stub->args.setxattr.loc, loc); + stub->fn.setxattr = fn; + loc_copy (&stub->args.loc, loc); /* TODO */ if (dict) - stub->args.setxattr.dict = dict_ref (dict); - stub->args.setxattr.flags = flags; + stub->args.xattr = dict_ref (dict); + stub->args.flags = flags; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } @@ -1386,21 +1238,19 @@ fop_setxattr_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_SETXATTR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.setxattr_cbk.fn = fn; - stub->args.setxattr_cbk.op_ret = op_ret; - stub->args.setxattr_cbk.op_errno = op_errno; + stub->fn_cbk.setxattr = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } + call_stub_t * -fop_getxattr_stub (call_frame_t *frame, - fop_getxattr_t fn, - loc_t *loc, - const char *name, dict_t *xdata) +fop_getxattr_stub (call_frame_t *frame, fop_getxattr_t fn, + loc_t *loc, const char *name, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1410,24 +1260,21 @@ fop_getxattr_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_GETXATTR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.getxattr.fn = fn; - loc_copy (&stub->args.getxattr.loc, loc); + stub->fn.getxattr = fn; + loc_copy (&stub->args.loc, loc); if (name) - stub->args.getxattr.name = gf_strdup (name); + stub->args.name = gf_strdup (name); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_getxattr_cbk_stub (call_frame_t *frame, - fop_getxattr_cbk_t fn, - int32_t op_ret, - int32_t op_errno, +fop_getxattr_cbk_stub (call_frame_t *frame, fop_getxattr_cbk_t fn, + int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1437,26 +1284,22 @@ fop_getxattr_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_GETXATTR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.getxattr_cbk.fn = fn; - stub->args.getxattr_cbk.op_ret = op_ret; - stub->args.getxattr_cbk.op_errno = op_errno; + stub->fn_cbk.getxattr = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; /* TODO */ if (dict) - stub->args.getxattr_cbk.dict = dict_ref (dict); + stub->args_cbk.xattr = dict_ref (dict); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_fsetxattr_stub (call_frame_t *frame, - fop_fsetxattr_t fn, - fd_t *fd, - dict_t *dict, - int32_t flags, dict_t *xdata) +fop_fsetxattr_stub (call_frame_t *frame, fop_fsetxattr_t fn, + fd_t *fd, dict_t *dict, int32_t flags, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1466,26 +1309,22 @@ fop_fsetxattr_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_FSETXATTR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fsetxattr.fn = fn; - stub->args.fsetxattr.fd = fd_ref (fd); + stub->fn.fsetxattr = fn; + stub->args.fd = fd_ref (fd); - /* TODO */ if (dict) - stub->args.fsetxattr.dict = dict_ref (dict); - stub->args.fsetxattr.flags = flags; + stub->args.xattr = dict_ref (dict); + stub->args.flags = flags; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_fsetxattr_cbk_stub (call_frame_t *frame, - fop_fsetxattr_cbk_t fn, - int32_t op_ret, - int32_t op_errno, dict_t *xdata) +fop_fsetxattr_cbk_stub (call_frame_t *frame, fop_fsetxattr_cbk_t fn, + int32_t op_ret, int32_t op_errno, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1494,22 +1333,19 @@ fop_fsetxattr_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_FSETXATTR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fsetxattr_cbk.fn = fn; - stub->args.fsetxattr_cbk.op_ret = op_ret; - stub->args.fsetxattr_cbk.op_errno = op_errno; + stub->fn_cbk.fsetxattr = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_fgetxattr_stub (call_frame_t *frame, - fop_fgetxattr_t fn, - fd_t *fd, - const char *name, dict_t *xdata) +fop_fgetxattr_stub (call_frame_t *frame, fop_fgetxattr_t fn, + fd_t *fd, const char *name, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1519,24 +1355,21 @@ fop_fgetxattr_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_FGETXATTR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fgetxattr.fn = fn; - stub->args.fgetxattr.fd = fd_ref (fd); + stub->fn.fgetxattr = fn; + stub->args.fd = fd_ref (fd); if (name) - stub->args.fgetxattr.name = gf_strdup (name); + stub->args.name = gf_strdup (name); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_fgetxattr_cbk_stub (call_frame_t *frame, - fop_fgetxattr_cbk_t fn, - int32_t op_ret, - int32_t op_errno, +fop_fgetxattr_cbk_stub (call_frame_t *frame, fop_fgetxattr_cbk_t fn, + int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1546,26 +1379,22 @@ fop_fgetxattr_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_GETXATTR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fgetxattr_cbk.fn = fn; - stub->args.fgetxattr_cbk.op_ret = op_ret; - stub->args.fgetxattr_cbk.op_errno = op_errno; + stub->fn_cbk.fgetxattr = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; - /* TODO */ if (dict) - stub->args.fgetxattr_cbk.dict = dict_ref (dict); + stub->args_cbk.xattr = dict_ref (dict); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_removexattr_stub (call_frame_t *frame, - fop_removexattr_t fn, - loc_t *loc, - const char *name, dict_t *xdata) +fop_removexattr_stub (call_frame_t *frame, fop_removexattr_t fn, + loc_t *loc, const char *name, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1576,22 +1405,19 @@ fop_removexattr_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_REMOVEXATTR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.removexattr.fn = fn; - loc_copy (&stub->args.removexattr.loc, loc); - stub->args.removexattr.name = gf_strdup (name); + stub->fn.removexattr = fn; + loc_copy (&stub->args.loc, loc); + stub->args.name = gf_strdup (name); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_removexattr_cbk_stub (call_frame_t *frame, - fop_removexattr_cbk_t fn, - int32_t op_ret, - int32_t op_errno, dict_t *xdata) +fop_removexattr_cbk_stub (call_frame_t *frame, fop_removexattr_cbk_t fn, + int32_t op_ret, int32_t op_errno, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1600,21 +1426,19 @@ fop_removexattr_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_REMOVEXATTR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.removexattr_cbk.fn = fn; - stub->args.removexattr_cbk.op_ret = op_ret; - stub->args.removexattr_cbk.op_errno = op_errno; + stub->fn_cbk.removexattr = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } + call_stub_t * -fop_fremovexattr_stub (call_frame_t *frame, - fop_fremovexattr_t fn, - fd_t *fd, - const char *name, dict_t *xdata) +fop_fremovexattr_stub (call_frame_t *frame, fop_fremovexattr_t fn, + fd_t *fd, const char *name, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1625,22 +1449,19 @@ fop_fremovexattr_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_FREMOVEXATTR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fremovexattr.fn = fn; - stub->args.fremovexattr.fd = fd_ref (fd); - stub->args.fremovexattr.name = gf_strdup (name); + stub->fn.fremovexattr = fn; + stub->args.fd = fd_ref (fd); + stub->args.name = gf_strdup (name); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_fremovexattr_cbk_stub (call_frame_t *frame, - fop_fremovexattr_cbk_t fn, - int32_t op_ret, - int32_t op_errno, dict_t *xdata) +fop_fremovexattr_cbk_stub (call_frame_t *frame, fop_fremovexattr_cbk_t fn, + int32_t op_ret, int32_t op_errno, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1649,21 +1470,19 @@ fop_fremovexattr_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_FREMOVEXATTR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fremovexattr_cbk.fn = fn; - stub->args.fremovexattr_cbk.op_ret = op_ret; - stub->args.fremovexattr_cbk.op_errno = op_errno; + stub->fn_cbk.fremovexattr = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } + call_stub_t * -fop_lk_stub (call_frame_t *frame, - fop_lk_t fn, - fd_t *fd, - int32_t cmd, +fop_lk_stub (call_frame_t *frame, fop_lk_t fn, + fd_t *fd, int32_t cmd, struct gf_flock *lock, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1674,24 +1493,21 @@ fop_lk_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_LK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.lk.fn = fn; + stub->fn.lk = fn; if (fd) - stub->args.lk.fd = fd_ref (fd); - stub->args.lk.cmd = cmd; - stub->args.lk.lock = *lock; + stub->args.fd = fd_ref (fd); + stub->args.cmd = cmd; + stub->args.lock = *lock; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_lk_cbk_stub (call_frame_t *frame, - fop_lk_cbk_t fn, - int32_t op_ret, - int32_t op_errno, +fop_lk_cbk_stub (call_frame_t *frame, fop_lk_cbk_t fn, + int32_t op_ret, int32_t op_errno, struct gf_flock *lock, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1701,18 +1517,18 @@ fop_lk_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_LK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.lk_cbk.fn = fn; - stub->args.lk_cbk.op_ret = op_ret; - stub->args.lk_cbk.op_errno = op_errno; + stub->fn_cbk.lk = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (op_ret == 0) - stub->args.lk_cbk.lock = *lock; + stub->args_cbk.lock = *lock; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } + call_stub_t * fop_inodelk_stub (call_frame_t *frame, fop_inodelk_t fn, const char *volume, loc_t *loc, int32_t cmd, @@ -1726,21 +1542,21 @@ fop_inodelk_stub (call_frame_t *frame, fop_inodelk_t fn, stub = stub_new (frame, 1, GF_FOP_INODELK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.inodelk.fn = fn; + stub->fn.inodelk = fn; if (volume) - stub->args.inodelk.volume = gf_strdup (volume); + stub->args.volume = gf_strdup (volume); - loc_copy (&stub->args.inodelk.loc, loc); - stub->args.inodelk.cmd = cmd; - stub->args.inodelk.lock = *lock; + loc_copy (&stub->args.loc, loc); + stub->args.cmd = cmd; + stub->args.lock = *lock; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } + call_stub_t * fop_inodelk_cbk_stub (call_frame_t *frame, fop_inodelk_cbk_t fn, int32_t op_ret, int32_t op_errno, dict_t *xdata) @@ -1752,13 +1568,12 @@ fop_inodelk_cbk_stub (call_frame_t *frame, fop_inodelk_cbk_t fn, stub = stub_new (frame, 0, GF_FOP_INODELK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.inodelk_cbk.fn = fn; - stub->args.inodelk_cbk.op_ret = op_ret; - stub->args.inodelk_cbk.op_errno = op_errno; + stub->fn_cbk.inodelk = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } @@ -1777,20 +1592,19 @@ fop_finodelk_stub (call_frame_t *frame, fop_finodelk_t fn, stub = stub_new (frame, 1, GF_FOP_FINODELK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.finodelk.fn = fn; + stub->fn.finodelk = fn; if (fd) - stub->args.finodelk.fd = fd_ref (fd); + stub->args.fd = fd_ref (fd); if (volume) - stub->args.finodelk.volume = gf_strdup (volume); + stub->args.volume = gf_strdup (volume); - stub->args.finodelk.cmd = cmd; - stub->args.finodelk.lock = *lock; + stub->args.cmd = cmd; + stub->args.lock = *lock; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } @@ -1807,13 +1621,12 @@ fop_finodelk_cbk_stub (call_frame_t *frame, fop_inodelk_cbk_t fn, stub = stub_new (frame, 0, GF_FOP_FINODELK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.finodelk_cbk.fn = fn; - stub->args.finodelk_cbk.op_ret = op_ret; - stub->args.finodelk_cbk.op_errno = op_errno; + stub->fn_cbk.finodelk = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } @@ -1831,25 +1644,26 @@ fop_entrylk_stub (call_frame_t *frame, fop_entrylk_t fn, stub = stub_new (frame, 1, GF_FOP_ENTRYLK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.entrylk.fn = fn; + stub->fn.entrylk = fn; if (volume) - stub->args.entrylk.volume = gf_strdup (volume); + stub->args.volume = gf_strdup (volume); + + loc_copy (&stub->args.loc, loc); - loc_copy (&stub->args.entrylk.loc, loc); + stub->args.entrylkcmd = cmd; + stub->args.entrylktype = type; - stub->args.entrylk.cmd = cmd; - stub->args.entrylk.type = type; if (name) - stub->args.entrylk.name = gf_strdup (name); + stub->args.name = gf_strdup (name); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } + call_stub_t * fop_entrylk_cbk_stub (call_frame_t *frame, fop_entrylk_cbk_t fn, int32_t op_ret, int32_t op_errno, dict_t *xdata) @@ -1861,13 +1675,12 @@ fop_entrylk_cbk_stub (call_frame_t *frame, fop_entrylk_cbk_t fn, stub = stub_new (frame, 0, GF_FOP_ENTRYLK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.entrylk_cbk.fn = fn; - stub->args.entrylk_cbk.op_ret = op_ret; - stub->args.entrylk_cbk.op_errno = op_errno; + stub->fn_cbk.entrylk = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } @@ -1885,25 +1698,25 @@ fop_fentrylk_stub (call_frame_t *frame, fop_fentrylk_t fn, stub = stub_new (frame, 1, GF_FOP_FENTRYLK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fentrylk.fn = fn; + stub->fn.fentrylk = fn; if (volume) - stub->args.fentrylk.volume = gf_strdup (volume); + stub->args.volume = gf_strdup (volume); if (fd) - stub->args.fentrylk.fd = fd_ref (fd); - stub->args.fentrylk.cmd = cmd; - stub->args.fentrylk.type = type; + stub->args.fd = fd_ref (fd); + stub->args.entrylkcmd = cmd; + stub->args.entrylktype = type; if (name) - stub->args.fentrylk.name = gf_strdup (name); + stub->args.name = gf_strdup (name); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } + call_stub_t * fop_fentrylk_cbk_stub (call_frame_t *frame, fop_fentrylk_cbk_t fn, int32_t op_ret, int32_t op_errno, dict_t *xdata) @@ -1915,23 +1728,20 @@ fop_fentrylk_cbk_stub (call_frame_t *frame, fop_fentrylk_cbk_t fn, stub = stub_new (frame, 0, GF_FOP_FENTRYLK); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fentrylk_cbk.fn = fn; - stub->args.fentrylk_cbk.op_ret = op_ret; - stub->args.fentrylk_cbk.op_errno = op_errno; + stub->fn_cbk.fentrylk = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_readdirp_cbk_stub (call_frame_t *frame, - fop_readdirp_cbk_t fn, - int32_t op_ret, - int32_t op_errno, +fop_readdirp_cbk_stub (call_frame_t *frame, fop_readdirp_cbk_t fn, + int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1942,14 +1752,10 @@ fop_readdirp_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_READDIRP); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.readdirp_cbk.fn = fn; - stub->args.readdirp_cbk.op_ret = op_ret; - stub->args.readdirp_cbk.op_errno = op_errno; - INIT_LIST_HEAD (&stub->args.readdirp_cbk.entries.list); + stub->fn_cbk.readdirp = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; - /* This check must come after the init of head above - * so we're sure the list is empty for list_empty. - */ GF_VALIDATE_OR_GOTO ("call-stub", entries, out); if (op_ret > 0) { @@ -1960,23 +1766,22 @@ fop_readdirp_cbk_stub (call_frame_t *frame, stub_entry->d_off = entry->d_off; stub_entry->d_ino = entry->d_ino; stub_entry->d_stat = entry->d_stat; + if (entry->inode) + stub_entry->inode = inode_ref (entry->inode); list_add_tail (&stub_entry->list, - &stub->args.readdirp_cbk.entries.list); + &stub->args_cbk.entries.list); } } if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_readdir_cbk_stub (call_frame_t *frame, - fop_readdir_cbk_t fn, - int32_t op_ret, - int32_t op_errno, +fop_readdir_cbk_stub (call_frame_t *frame, fop_readdir_cbk_t fn, + int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, dict_t *xdata) { call_stub_t *stub = NULL; @@ -1987,14 +1792,10 @@ fop_readdir_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_READDIR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.readdir_cbk.fn = fn; - stub->args.readdir_cbk.op_ret = op_ret; - stub->args.readdir_cbk.op_errno = op_errno; - INIT_LIST_HEAD (&stub->args.readdir_cbk.entries.list); + stub->fn_cbk.readdir = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; - /* This check must come after the init of head above - * so we're sure the list is empty for list_empty. - */ GF_VALIDATE_OR_GOTO ("call-stub", entries, out); if (op_ret > 0) { @@ -2006,21 +1807,19 @@ fop_readdir_cbk_stub (call_frame_t *frame, stub_entry->d_ino = entry->d_ino; list_add_tail (&stub_entry->list, - &stub->args.readdir_cbk.entries.list); + &stub->args_cbk.entries.list); } } if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } + call_stub_t * -fop_readdir_stub (call_frame_t *frame, - fop_readdir_t fn, - fd_t *fd, - size_t size, +fop_readdir_stub (call_frame_t *frame, fop_readdir_t fn, + fd_t *fd, size_t size, off_t off, dict_t *xdata) { call_stub_t *stub = NULL; @@ -2028,47 +1827,41 @@ fop_readdir_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_READDIR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.readdir.fn = fn; - stub->args.readdir.fd = fd_ref (fd); - stub->args.readdir.size = size; - stub->args.readdir.off = off; + stub->fn.readdir = fn; + stub->args.fd = fd_ref (fd); + stub->args.size = size; + stub->args.offset = off; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } + call_stub_t * -fop_readdirp_stub (call_frame_t *frame, - fop_readdirp_t fn, - fd_t *fd, - size_t size, - off_t off, - dict_t *xdata) +fop_readdirp_stub (call_frame_t *frame, fop_readdirp_t fn, + fd_t *fd, size_t size, off_t off, dict_t *xdata) { call_stub_t *stub = NULL; stub = stub_new (frame, 1, GF_FOP_READDIRP); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.readdirp.fn = fn; - stub->args.readdirp.fd = fd_ref (fd); - stub->args.readdirp.size = size; - stub->args.readdirp.off = off; + stub->fn.readdirp = fn; + stub->args.fd = fd_ref (fd); + stub->args.size = size; + stub->args.offset = off; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } + call_stub_t * -fop_rchecksum_stub (call_frame_t *frame, - fop_rchecksum_t fn, - fd_t *fd, off_t offset, - int32_t len, dict_t *xdata) +fop_rchecksum_stub (call_frame_t *frame, fop_rchecksum_t fn, + fd_t *fd, off_t offset, int32_t len, dict_t *xdata) { call_stub_t *stub = NULL; @@ -2078,25 +1871,22 @@ fop_rchecksum_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_RCHECKSUM); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.rchecksum.fn = fn; - stub->args.rchecksum.fd = fd_ref (fd); - stub->args.rchecksum.offset = offset; - stub->args.rchecksum.len = len; + stub->fn.rchecksum = fn; + stub->args.fd = fd_ref (fd); + stub->args.offset = offset; + stub->args.size = len; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_rchecksum_cbk_stub (call_frame_t *frame, - fop_rchecksum_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - uint32_t weak_checksum, - uint8_t *strong_checksum, dict_t *xdata) +fop_rchecksum_cbk_stub (call_frame_t *frame, fop_rchecksum_cbk_t fn, + int32_t op_ret, int32_t op_errno, + uint32_t weak_checksum, uint8_t *strong_checksum, + dict_t *xdata) { call_stub_t *stub = NULL; @@ -2105,31 +1895,27 @@ fop_rchecksum_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_RCHECKSUM); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.rchecksum_cbk.fn = fn; - stub->args.rchecksum_cbk.op_ret = op_ret; - stub->args.rchecksum_cbk.op_errno = op_errno; + stub->fn_cbk.rchecksum = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; - if (op_ret >= 0) - { - stub->args.rchecksum_cbk.weak_checksum = + if (op_ret >= 0) { + stub->args_cbk.weak_checksum = weak_checksum; - - stub->args.rchecksum_cbk.strong_checksum = + stub->args_cbk.strong_checksum = memdup (strong_checksum, MD5_DIGEST_LENGTH); } - if (xdata) - stub->xdata = dict_ref (xdata); + if (xdata) + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_xattrop_cbk_stub (call_frame_t *frame, - fop_xattrop_cbk_t fn, - int32_t op_ret, - int32_t op_errno, dict_t *xdata) +fop_xattrop_cbk_stub (call_frame_t *frame, fop_xattrop_cbk_t fn, + int32_t op_ret, int32_t op_errno, dict_t *xdata) { call_stub_t *stub = NULL; @@ -2138,23 +1924,20 @@ fop_xattrop_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_XATTROP); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.xattrop_cbk.fn = fn; - stub->args.xattrop_cbk.op_ret = op_ret; - stub->args.xattrop_cbk.op_errno = op_errno; + stub->fn_cbk.xattrop = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_fxattrop_cbk_stub (call_frame_t *frame, - fop_fxattrop_cbk_t fn, - int32_t op_ret, - int32_t op_errno, +fop_fxattrop_cbk_stub (call_frame_t *frame, fop_fxattrop_cbk_t fn, + int32_t op_ret, int32_t op_errno, dict_t *xattr, dict_t *xdata) { call_stub_t *stub = NULL; @@ -2163,25 +1946,22 @@ fop_fxattrop_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_FXATTROP); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fxattrop_cbk.fn = fn; - stub->args.fxattrop_cbk.op_ret = op_ret; - stub->args.fxattrop_cbk.op_errno = op_errno; + stub->fn_cbk.fxattrop = fn; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (xattr) - stub->args.fxattrop_cbk.xattr = dict_ref (xattr); + stub->args_cbk.xattr = dict_ref (xattr); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_xattrop_stub (call_frame_t *frame, - fop_xattrop_t fn, - loc_t *loc, - gf_xattrop_flags_t optype, +fop_xattrop_stub (call_frame_t *frame, fop_xattrop_t fn, + loc_t *loc, gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata) { call_stub_t *stub = NULL; @@ -2192,25 +1972,23 @@ fop_xattrop_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_XATTROP); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.xattrop.fn = fn; + stub->fn.xattrop = fn; - loc_copy (&stub->args.xattrop.loc, loc); + loc_copy (&stub->args.loc, loc); - stub->args.xattrop.optype = optype; - stub->args.xattrop.xattr = dict_ref (xattr); + stub->args.optype = optype; + stub->args.xattr = dict_ref (xattr); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } + call_stub_t * -fop_fxattrop_stub (call_frame_t *frame, - fop_fxattrop_t fn, - fd_t *fd, - gf_xattrop_flags_t optype, +fop_fxattrop_stub (call_frame_t *frame, fop_fxattrop_t fn, + fd_t *fd, gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata) { call_stub_t *stub = NULL; @@ -2221,28 +1999,25 @@ fop_fxattrop_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_FXATTROP); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fxattrop.fn = fn; + stub->fn.fxattrop = fn; - stub->args.fxattrop.fd = fd_ref (fd); + stub->args.fd = fd_ref (fd); - stub->args.fxattrop.optype = optype; - stub->args.fxattrop.xattr = dict_ref (xattr); + stub->args.optype = optype; + stub->args.xattr = dict_ref (xattr); if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } call_stub_t * -fop_setattr_cbk_stub (call_frame_t *frame, - fop_setattr_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct iatt *statpre, - struct iatt *statpost, dict_t *xdata) +fop_setattr_cbk_stub (call_frame_t *frame, fop_setattr_cbk_t fn, + int32_t op_ret, int32_t op_errno, + struct iatt *statpre, struct iatt *statpost, + dict_t *xdata) { call_stub_t *stub = NULL; @@ -2251,30 +2026,28 @@ fop_setattr_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_SETATTR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.setattr_cbk.fn = fn; + stub->fn_cbk.setattr = fn; - stub->args.setattr_cbk.op_ret = op_ret; - stub->args.setattr_cbk.op_errno = op_errno; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (statpre) - stub->args.setattr_cbk.statpre = *statpre; + stub->args_cbk.prestat = *statpre; if (statpost) - stub->args.setattr_cbk.statpost = *statpost; + stub->args_cbk.poststat = *statpost; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } + call_stub_t * -fop_fsetattr_cbk_stub (call_frame_t *frame, - fop_setattr_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct iatt *statpre, - struct iatt *statpost, dict_t *xdata) +fop_fsetattr_cbk_stub (call_frame_t *frame, fop_setattr_cbk_t fn, + int32_t op_ret, int32_t op_errno, + struct iatt *statpre, struct iatt *statpost, + dict_t *xdata) { call_stub_t *stub = NULL; @@ -2283,27 +2056,25 @@ fop_fsetattr_cbk_stub (call_frame_t *frame, stub = stub_new (frame, 0, GF_FOP_FSETATTR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fsetattr_cbk.fn = fn; + stub->fn_cbk.fsetattr = fn; - stub->args.fsetattr_cbk.op_ret = op_ret; - stub->args.fsetattr_cbk.op_errno = op_errno; + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; if (statpre) - stub->args.setattr_cbk.statpre = *statpre; + stub->args_cbk.prestat = *statpre; if (statpost) - stub->args.fsetattr_cbk.statpost = *statpost; + stub->args_cbk.poststat = *statpost; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args_cbk.xdata = dict_ref (xdata); out: return stub; } + call_stub_t * -fop_setattr_stub (call_frame_t *frame, - fop_setattr_t fn, - loc_t *loc, - struct iatt *stbuf, +fop_setattr_stub (call_frame_t *frame, fop_setattr_t fn, + loc_t *loc, struct iatt *stbuf, int32_t valid, dict_t *xdata) { call_stub_t *stub = NULL; @@ -2314,27 +2085,25 @@ fop_setattr_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_SETATTR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.setattr.fn = fn; + stub->fn.setattr = fn; - loc_copy (&stub->args.setattr.loc, loc); + loc_copy (&stub->args.loc, loc); if (stbuf) - stub->args.setattr.stbuf = *stbuf; + stub->args.stat = *stbuf; - stub->args.setattr.valid = valid; + stub->args.valid = valid; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } + call_stub_t * -fop_fsetattr_stub (call_frame_t *frame, - fop_fsetattr_t fn, - fd_t *fd, - struct iatt *stbuf, +fop_fsetattr_stub (call_frame_t *frame, fop_fsetattr_t fn, + fd_t *fd, struct iatt *stbuf, int32_t valid, dict_t *xdata) { call_stub_t *stub = NULL; @@ -2345,23 +2114,23 @@ fop_fsetattr_stub (call_frame_t *frame, stub = stub_new (frame, 1, GF_FOP_FSETATTR); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - stub->args.fsetattr.fn = fn; + stub->fn.fsetattr = fn; if (fd) - stub->args.fsetattr.fd = fd_ref (fd); + stub->args.fd = fd_ref (fd); if (stbuf) - stub->args.fsetattr.stbuf = *stbuf; + stub->args.stat = *stbuf; - stub->args.fsetattr.valid = valid; + stub->args.valid = valid; if (xdata) - stub->xdata = dict_ref (xdata); - + stub->args.xdata = dict_ref (xdata); out: return stub; } + static void call_resume_wind (call_stub_t *stub) { @@ -2369,413 +2138,236 @@ call_resume_wind (call_stub_t *stub) switch (stub->fop) { case GF_FOP_OPEN: - { - stub->args.open.fn (stub->frame, - stub->frame->this, - &stub->args.open.loc, - stub->args.open.flags, stub->args.open.fd, - stub->xdata); + stub->fn.open (stub->frame, stub->frame->this, + &stub->args.loc, stub->args.flags, + stub->args.fd, stub->args.xdata); break; - } case GF_FOP_CREATE: - { - stub->args.create.fn (stub->frame, - stub->frame->this, - &stub->args.create.loc, - stub->args.create.flags, - stub->args.create.mode, - stub->args.create.umask, - stub->args.create.fd, - stub->xdata); + stub->fn.create (stub->frame, stub->frame->this, + &stub->args.loc, stub->args.flags, + stub->args.mode, stub->args.umask, + stub->args.fd, stub->args.xdata); break; - } case GF_FOP_STAT: - { - stub->args.stat.fn (stub->frame, - stub->frame->this, - &stub->args.stat.loc, stub->xdata); + stub->fn.stat (stub->frame, stub->frame->this, + &stub->args.loc, stub->args.xdata); break; - } case GF_FOP_READLINK: - { - stub->args.readlink.fn (stub->frame, - stub->frame->this, - &stub->args.readlink.loc, - stub->args.readlink.size, stub->xdata); + stub->fn.readlink (stub->frame, stub->frame->this, + &stub->args.loc, stub->args.size, + stub->args.xdata); break; - } - case GF_FOP_MKNOD: - { - stub->args.mknod.fn (stub->frame, stub->frame->this, - &stub->args.mknod.loc, - stub->args.mknod.mode, - stub->args.mknod.rdev, - stub->args.mknod.umask, stub->xdata); - } - break; - + stub->fn.mknod (stub->frame, stub->frame->this, + &stub->args.loc, stub->args.mode, + stub->args.rdev, stub->args.umask, + stub->args.xdata); + break; case GF_FOP_MKDIR: - { - stub->args.mkdir.fn (stub->frame, stub->frame->this, - &stub->args.mkdir.loc, - stub->args.mkdir.mode, - stub->args.mkdir.umask, stub->xdata); - } - break; - + stub->fn.mkdir (stub->frame, stub->frame->this, + &stub->args.loc, stub->args.mode, + stub->args.umask, stub->args.xdata); + break; case GF_FOP_UNLINK: - { - stub->args.unlink.fn (stub->frame, - stub->frame->this, - &stub->args.unlink.loc, - stub->args.unlink.xflag, stub->xdata); - } - break; - + stub->fn.unlink (stub->frame, stub->frame->this, + &stub->args.loc, stub->args.xflag, + stub->args.xdata); + break; case GF_FOP_RMDIR: - { - stub->args.rmdir.fn (stub->frame, stub->frame->this, - &stub->args.rmdir.loc, - stub->args.rmdir.flags, stub->xdata); - } - break; - + stub->fn.rmdir (stub->frame, stub->frame->this, + &stub->args.loc, stub->args.flags, + stub->args.xdata); + break; case GF_FOP_SYMLINK: - { - stub->args.symlink.fn (stub->frame, - stub->frame->this, - stub->args.symlink.linkname, - &stub->args.symlink.loc, - stub->args.symlink.umask, stub->xdata); - } - break; - + stub->fn.symlink (stub->frame, stub->frame->this, + stub->args.linkname, &stub->args.loc, + stub->args.umask, stub->args.xdata); + break; case GF_FOP_RENAME: - { - stub->args.rename.fn (stub->frame, - stub->frame->this, - &stub->args.rename.old, - &stub->args.rename.new, stub->xdata); - } - break; - + stub->fn.rename (stub->frame, stub->frame->this, + &stub->args.loc, &stub->args.loc2, + stub->args.xdata); + break; case GF_FOP_LINK: - { - stub->args.link.fn (stub->frame, - stub->frame->this, - &stub->args.link.oldloc, - &stub->args.link.newloc, stub->xdata); - } - break; - + stub->fn.link (stub->frame, stub->frame->this, + &stub->args.loc, &stub->args.loc2, + stub->args.xdata); + break; case GF_FOP_TRUNCATE: - { - stub->args.truncate.fn (stub->frame, - stub->frame->this, - &stub->args.truncate.loc, - stub->args.truncate.off, stub->xdata); + stub->fn.truncate (stub->frame, stub->frame->this, + &stub->args.loc, stub->args.offset, + stub->args.xdata); break; - } - case GF_FOP_READ: - { - stub->args.readv.fn (stub->frame, - stub->frame->this, - stub->args.readv.fd, - stub->args.readv.size, - stub->args.readv.off, - stub->args.readv.flags, stub->xdata); + stub->fn.readv (stub->frame, stub->frame->this, + stub->args.fd, stub->args.size, + stub->args.offset, stub->args.flags, + stub->args.xdata); break; - } - case GF_FOP_WRITE: - { - stub->args.writev.fn (stub->frame, - stub->frame->this, - stub->args.writev.fd, - stub->args.writev.vector, - stub->args.writev.count, - stub->args.writev.off, - stub->args.writev.flags, - stub->args.writev.iobref, stub->xdata); + stub->fn.writev (stub->frame, stub->frame->this, + stub->args.fd, stub->args.vector, + stub->args.count, stub->args.offset, + stub->args.flags, stub->args.iobref, + stub->args.xdata); break; - } - case GF_FOP_STATFS: - { - stub->args.statfs.fn (stub->frame, - stub->frame->this, - &stub->args.statfs.loc, stub->xdata); + stub->fn.statfs (stub->frame, stub->frame->this, + &stub->args.loc, stub->args.xdata); break; - } case GF_FOP_FLUSH: - { - stub->args.flush.fn (stub->frame, - stub->frame->this, - stub->args.flush.fd, stub->xdata); + stub->fn.flush (stub->frame, stub->frame->this, + stub->args.fd, stub->args.xdata); break; - } - case GF_FOP_FSYNC: - { - stub->args.fsync.fn (stub->frame, - stub->frame->this, - stub->args.fsync.fd, - stub->args.fsync.datasync, stub->xdata); + stub->fn.fsync (stub->frame, stub->frame->this, + stub->args.fd, stub->args.datasync, + stub->args.xdata); break; - } - case GF_FOP_SETXATTR: - { - stub->args.setxattr.fn (stub->frame, - stub->frame->this, - &stub->args.setxattr.loc, - stub->args.setxattr.dict, - stub->args.setxattr.flags, stub->xdata); + stub->fn.setxattr (stub->frame, stub->frame->this, + &stub->args.loc, stub->args.xattr, + stub->args.flags, stub->args.xdata); break; - } - case GF_FOP_GETXATTR: - { - stub->args.getxattr.fn (stub->frame, - stub->frame->this, - &stub->args.getxattr.loc, - stub->args.getxattr.name, stub->xdata); + stub->fn.getxattr (stub->frame, stub->frame->this, + &stub->args.loc, stub->args.name, + stub->args.xdata); break; - } - case GF_FOP_FSETXATTR: - { - stub->args.fsetxattr.fn (stub->frame, - stub->frame->this, - stub->args.fsetxattr.fd, - stub->args.fsetxattr.dict, - stub->args.fsetxattr.flags, stub->xdata); + stub->fn.fsetxattr (stub->frame, stub->frame->this, + stub->args.fd, stub->args.xattr, + stub->args.flags, stub->args.xdata); break; - } - case GF_FOP_FGETXATTR: - { - stub->args.fgetxattr.fn (stub->frame, - stub->frame->this, - stub->args.fgetxattr.fd, - stub->args.fgetxattr.name, stub->xdata); + stub->fn.fgetxattr (stub->frame, stub->frame->this, + stub->args.fd, stub->args.name, + stub->args.xdata); break; - } - case GF_FOP_REMOVEXATTR: - { - stub->args.removexattr.fn (stub->frame, - stub->frame->this, - &stub->args.removexattr.loc, - stub->args.removexattr.name, stub->xdata); + stub->fn.removexattr (stub->frame, stub->frame->this, + &stub->args.loc, stub->args.name, + stub->args.xdata); break; - } - case GF_FOP_FREMOVEXATTR: - { - stub->args.fremovexattr.fn (stub->frame, - stub->frame->this, - stub->args.fremovexattr.fd, - stub->args.fremovexattr.name, stub->xdata); + stub->fn.fremovexattr (stub->frame, stub->frame->this, + stub->args.fd, stub->args.name, + stub->args.xdata); break; - } - case GF_FOP_OPENDIR: - { - stub->args.opendir.fn (stub->frame, - stub->frame->this, - &stub->args.opendir.loc, - stub->args.opendir.fd, stub->xdata); + stub->fn.opendir (stub->frame, stub->frame->this, + &stub->args.loc, stub->args.fd, + stub->args.xdata); break; - } - case GF_FOP_FSYNCDIR: - { - stub->args.fsyncdir.fn (stub->frame, - stub->frame->this, - stub->args.fsyncdir.fd, - stub->args.fsyncdir.datasync, stub->xdata); + stub->fn.fsyncdir (stub->frame, stub->frame->this, + stub->args.fd, stub->args.datasync, + stub->args.xdata); break; - } - case GF_FOP_ACCESS: - { - stub->args.access.fn (stub->frame, - stub->frame->this, - &stub->args.access.loc, - stub->args.access.mask, stub->xdata); + stub->fn.access (stub->frame, stub->frame->this, + &stub->args.loc, stub->args.mask, + stub->args.xdata); break; - } case GF_FOP_FTRUNCATE: - { - stub->args.ftruncate.fn (stub->frame, - stub->frame->this, - stub->args.ftruncate.fd, - stub->args.ftruncate.off, stub->xdata); + stub->fn.ftruncate (stub->frame, stub->frame->this, + stub->args.fd, stub->args.offset, + stub->args.xdata); break; - } - case GF_FOP_FSTAT: - { - stub->args.fstat.fn (stub->frame, - stub->frame->this, - stub->args.fstat.fd, stub->xdata); + stub->fn.fstat (stub->frame, stub->frame->this, + stub->args.fd, stub->args.xdata); break; - } - case GF_FOP_LK: - { - stub->args.lk.fn (stub->frame, - stub->frame->this, - stub->args.lk.fd, - stub->args.lk.cmd, - &stub->args.lk.lock, stub->xdata); + stub->fn.lk (stub->frame, stub->frame->this, + stub->args.fd, stub->args.cmd, + &stub->args.lock, stub->args.xdata); break; - } - case GF_FOP_INODELK: - { - stub->args.inodelk.fn (stub->frame, - stub->frame->this, - stub->args.inodelk.volume, - &stub->args.inodelk.loc, - stub->args.inodelk.cmd, - &stub->args.inodelk.lock, stub->xdata); + stub->fn.inodelk (stub->frame, stub->frame->this, + stub->args.volume, &stub->args.loc, + stub->args.cmd, &stub->args.lock, + stub->args.xdata); break; - } - case GF_FOP_FINODELK: - { - stub->args.finodelk.fn (stub->frame, - stub->frame->this, - stub->args.finodelk.volume, - stub->args.finodelk.fd, - stub->args.finodelk.cmd, - &stub->args.finodelk.lock, stub->xdata); + stub->fn.finodelk (stub->frame, stub->frame->this, + stub->args.volume, stub->args.fd, + stub->args.cmd, &stub->args.lock, + stub->args.xdata); break; - } - case GF_FOP_ENTRYLK: - { - stub->args.entrylk.fn (stub->frame, - stub->frame->this, - stub->args.entrylk.volume, - &stub->args.entrylk.loc, - stub->args.entrylk.name, - stub->args.entrylk.cmd, - stub->args.entrylk.type, stub->xdata); + stub->fn.entrylk (stub->frame, stub->frame->this, + stub->args.volume, &stub->args.loc, + stub->args.name, stub->args.entrylkcmd, + stub->args.entrylktype, stub->args.xdata); break; - } - case GF_FOP_FENTRYLK: - { - stub->args.fentrylk.fn (stub->frame, - stub->frame->this, - stub->args.fentrylk.volume, - stub->args.fentrylk.fd, - stub->args.fentrylk.name, - stub->args.fentrylk.cmd, - stub->args.fentrylk.type, stub->xdata); - break; - } - - break; - + stub->fn.fentrylk (stub->frame, stub->frame->this, + stub->args.volume, stub->args.fd, + stub->args.name, stub->args.entrylkcmd, + stub->args.entrylktype, stub->args.xdata); + break; case GF_FOP_LOOKUP: - { - stub->args.lookup.fn (stub->frame, - stub->frame->this, - &stub->args.lookup.loc, - stub->xdata); + stub->fn.lookup (stub->frame, stub->frame->this, + &stub->args.loc, stub->args.xdata); break; - } - case GF_FOP_RCHECKSUM: - { - stub->args.rchecksum.fn (stub->frame, - stub->frame->this, - stub->args.rchecksum.fd, - stub->args.rchecksum.offset, - stub->args.rchecksum.len, stub->xdata); + stub->fn.rchecksum (stub->frame, stub->frame->this, + stub->args.fd, stub->args.offset, + stub->args.size, stub->args.xdata); break; - } - case GF_FOP_READDIR: - { - stub->args.readdir.fn (stub->frame, - stub->frame->this, - stub->args.readdir.fd, - stub->args.readdir.size, - stub->args.readdir.off, stub->xdata); + stub->fn.readdir (stub->frame, stub->frame->this, + stub->args.fd, stub->args.size, + stub->args.offset, stub->args.xdata); break; - } - case GF_FOP_READDIRP: - { - stub->args.readdirp.fn (stub->frame, - stub->frame->this, - stub->args.readdirp.fd, - stub->args.readdirp.size, - stub->args.readdirp.off, - stub->xdata); + stub->fn.readdirp (stub->frame, stub->frame->this, + stub->args.fd, stub->args.size, + stub->args.offset, stub->args.xdata); break; - } - case GF_FOP_XATTROP: - { - stub->args.xattrop.fn (stub->frame, - stub->frame->this, - &stub->args.xattrop.loc, - stub->args.xattrop.optype, - stub->args.xattrop.xattr, stub->xdata); - + stub->fn.xattrop (stub->frame, stub->frame->this, + &stub->args.loc, stub->args.optype, + stub->args.xattr, stub->args.xdata); break; - } case GF_FOP_FXATTROP: - { - stub->args.fxattrop.fn (stub->frame, - stub->frame->this, - stub->args.fxattrop.fd, - stub->args.fxattrop.optype, - stub->args.fxattrop.xattr, stub->xdata); - + stub->fn.fxattrop (stub->frame, stub->frame->this, + stub->args.fd, stub->args.optype, + stub->args.xattr, stub->args.xdata); break; - } case GF_FOP_SETATTR: - { - stub->args.setattr.fn (stub->frame, - stub->frame->this, - &stub->args.setattr.loc, - &stub->args.setattr.stbuf, - stub->args.setattr.valid, stub->xdata); + stub->fn.setattr (stub->frame, stub->frame->this, + &stub->args.loc, &stub->args.stat, + stub->args.valid, stub->args.xdata); break; - } case GF_FOP_FSETATTR: - { - stub->args.fsetattr.fn (stub->frame, - stub->frame->this, - stub->args.fsetattr.fd, - &stub->args.fsetattr.stbuf, - stub->args.fsetattr.valid, stub->xdata); + stub->fn.fsetattr (stub->frame, stub->frame->this, + stub->args.fd, &stub->args.stat, + stub->args.valid, stub->args.xdata); break; - } default: - { gf_log_callingfn ("call-stub", GF_LOG_ERROR, "Invalid value of FOP (%d)", stub->fop); break; } - - } out: return; } +#define STUB_UNWIND(stb, fop, args ...) do { \ + if (stb->fn_cbk.fop) \ + stb->fn_cbk.fop (stb->frame, stb->frame->cookie, \ + stb->frame->this, stb->args_cbk.op_ret, \ + stb->args_cbk.op_errno, args); \ + else \ + STACK_UNWIND_STRICT (fop, stb->frame, stb->args_cbk.op_ret, \ + stb->args_cbk.op_errno, args); \ + } while (0) + static void call_resume_unwind (call_stub_t *stub) @@ -2784,1327 +2376,236 @@ call_resume_unwind (call_stub_t *stub) switch (stub->fop) { case GF_FOP_OPEN: - { - if (!stub->args.open_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.open_cbk.op_ret, - stub->args.open_cbk.op_errno, - stub->args.open_cbk.fd, stub->xdata); - else - stub->args.open_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.open_cbk.op_ret, - stub->args.open_cbk.op_errno, - stub->args.open_cbk.fd, stub->xdata); + STUB_UNWIND (stub, open, stub->args_cbk.fd, + stub->args_cbk.xdata); break; - } - case GF_FOP_CREATE: - { - if (!stub->args.create_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.create_cbk.op_ret, - stub->args.create_cbk.op_errno, - stub->args.create_cbk.fd, - stub->args.create_cbk.inode, - &stub->args.create_cbk.buf, - &stub->args.create_cbk.preparent, - &stub->args.create_cbk.postparent, stub->xdata); - else - stub->args.create_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.create_cbk.op_ret, - stub->args.create_cbk.op_errno, - stub->args.create_cbk.fd, - stub->args.create_cbk.inode, - &stub->args.create_cbk.buf, - &stub->args.create_cbk.preparent, - &stub->args.create_cbk.postparent, stub->xdata); - + STUB_UNWIND (stub, create, stub->args_cbk.fd, + stub->args_cbk.inode, &stub->args_cbk.stat, + &stub->args_cbk.preparent, + &stub->args_cbk.postparent, + stub->args_cbk.xdata); break; - } - case GF_FOP_STAT: - { - if (!stub->args.stat_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.stat_cbk.op_ret, - stub->args.stat_cbk.op_errno, - &stub->args.stat_cbk.buf, stub->xdata); - else - stub->args.stat_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.stat_cbk.op_ret, - stub->args.stat_cbk.op_errno, - &stub->args.stat_cbk.buf, stub->xdata); - + STUB_UNWIND (stub, stat, &stub->args_cbk.stat, + stub->args_cbk.xdata); break; - } - case GF_FOP_READLINK: - { - if (!stub->args.readlink_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.readlink_cbk.op_ret, - stub->args.readlink_cbk.op_errno, - stub->args.readlink_cbk.buf, - &stub->args.readlink_cbk.sbuf, stub->xdata); - else - stub->args.readlink_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.readlink_cbk.op_ret, - stub->args.readlink_cbk.op_errno, - stub->args.readlink_cbk.buf, - &stub->args.readlink_cbk.sbuf, stub->xdata); - - break; - } - + STUB_UNWIND (stub, readlink, stub->args_cbk.buf, + &stub->args_cbk.stat, stub->args.xdata); + break; case GF_FOP_MKNOD: - { - if (!stub->args.mknod_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.mknod_cbk.op_ret, - stub->args.mknod_cbk.op_errno, - stub->args.mknod_cbk.inode, - &stub->args.mknod_cbk.buf, - &stub->args.mknod_cbk.preparent, - &stub->args.mknod_cbk.postparent, stub->xdata); - else - stub->args.mknod_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.mknod_cbk.op_ret, - stub->args.mknod_cbk.op_errno, - stub->args.mknod_cbk.inode, - &stub->args.mknod_cbk.buf, - &stub->args.mknod_cbk.preparent, - &stub->args.mknod_cbk.postparent, stub->xdata); - break; - } - + STUB_UNWIND (stub, mknod, stub->args_cbk.inode, + &stub->args_cbk.stat, &stub->args_cbk.preparent, + &stub->args_cbk.postparent, stub->args_cbk.xdata); + break; case GF_FOP_MKDIR: - { - if (!stub->args.mkdir_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.mkdir_cbk.op_ret, - stub->args.mkdir_cbk.op_errno, - stub->args.mkdir_cbk.inode, - &stub->args.mkdir_cbk.buf, - &stub->args.mkdir_cbk.preparent, - &stub->args.mkdir_cbk.postparent, stub->xdata); - else - stub->args.mkdir_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.mkdir_cbk.op_ret, - stub->args.mkdir_cbk.op_errno, - stub->args.mkdir_cbk.inode, - &stub->args.mkdir_cbk.buf, - &stub->args.mkdir_cbk.preparent, - &stub->args.mkdir_cbk.postparent, stub->xdata); - - if (stub->args.mkdir_cbk.inode) - inode_unref (stub->args.mkdir_cbk.inode); - - break; - } - + STUB_UNWIND (stub, mkdir, stub->args_cbk.inode, + &stub->args_cbk.stat, &stub->args_cbk.preparent, + &stub->args_cbk.postparent, stub->args_cbk.xdata); + break; case GF_FOP_UNLINK: - { - if (!stub->args.unlink_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.unlink_cbk.op_ret, - stub->args.unlink_cbk.op_errno, - &stub->args.unlink_cbk.preparent, - &stub->args.unlink_cbk.postparent, stub->xdata); - else - stub->args.unlink_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.unlink_cbk.op_ret, - stub->args.unlink_cbk.op_errno, - &stub->args.unlink_cbk.preparent, - &stub->args.unlink_cbk.postparent, stub->xdata); - break; - } - + STUB_UNWIND (stub, unlink, &stub->args_cbk.preparent, + &stub->args_cbk.postparent, stub->args_cbk.xdata); + break; case GF_FOP_RMDIR: - { - if (!stub->args.rmdir_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.rmdir_cbk.op_ret, - stub->args.rmdir_cbk.op_errno, - &stub->args.rmdir_cbk.preparent, - &stub->args.rmdir_cbk.postparent, stub->xdata); - else - stub->args.rmdir_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.rmdir_cbk.op_ret, - stub->args.rmdir_cbk.op_errno, - &stub->args.rmdir_cbk.preparent, - &stub->args.rmdir_cbk.postparent, stub->xdata); - break; - } - + STUB_UNWIND (stub, rmdir, &stub->args_cbk.preparent, + &stub->args_cbk.postparent, stub->args_cbk.xdata); + break; case GF_FOP_SYMLINK: - { - if (!stub->args.symlink_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.symlink_cbk.op_ret, - stub->args.symlink_cbk.op_errno, - stub->args.symlink_cbk.inode, - &stub->args.symlink_cbk.buf, - &stub->args.symlink_cbk.preparent, - &stub->args.symlink_cbk.postparent, stub->xdata); - else - stub->args.symlink_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.symlink_cbk.op_ret, - stub->args.symlink_cbk.op_errno, - stub->args.symlink_cbk.inode, - &stub->args.symlink_cbk.buf, - &stub->args.symlink_cbk.preparent, - &stub->args.symlink_cbk.postparent, stub->xdata); - } - break; - + STUB_UNWIND (stub, symlink, stub->args_cbk.inode, + &stub->args_cbk.stat, &stub->args_cbk.preparent, + &stub->args_cbk.postparent, stub->args_cbk.xdata); + break; case GF_FOP_RENAME: - { - if (!stub->args.rename_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.rename_cbk.op_ret, - stub->args.rename_cbk.op_errno, - &stub->args.rename_cbk.buf, - &stub->args.rename_cbk.preoldparent, - &stub->args.rename_cbk.postoldparent, - &stub->args.rename_cbk.prenewparent, - &stub->args.rename_cbk.postnewparent, stub->xdata); - else - stub->args.rename_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.rename_cbk.op_ret, - stub->args.rename_cbk.op_errno, - &stub->args.rename_cbk.buf, - &stub->args.rename_cbk.preoldparent, - &stub->args.rename_cbk.postoldparent, - &stub->args.rename_cbk.prenewparent, - &stub->args.rename_cbk.postnewparent, stub->xdata); - break; - } - + STUB_UNWIND (stub, rename, &stub->args_cbk.stat, + &stub->args_cbk.preparent, + &stub->args_cbk.postparent, + &stub->args_cbk.preparent2, + &stub->args_cbk.postparent2, + stub->args_cbk.xdata); + break; case GF_FOP_LINK: - { - if (!stub->args.link_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.link_cbk.op_ret, - stub->args.link_cbk.op_errno, - stub->args.link_cbk.inode, - &stub->args.link_cbk.buf, stub->xdata); - else - stub->args.link_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.link_cbk.op_ret, - stub->args.link_cbk.op_errno, - stub->args.link_cbk.inode, - &stub->args.link_cbk.buf, - &stub->args.link_cbk.preparent, - &stub->args.link_cbk.postparent, stub->xdata); - break; - } - + STUB_UNWIND (stub, link, stub->args_cbk.inode, + &stub->args_cbk.stat, &stub->args_cbk.preparent, + &stub->args_cbk.postparent, stub->args_cbk.xdata); + break; case GF_FOP_TRUNCATE: - { - if (!stub->args.truncate_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.truncate_cbk.op_ret, - stub->args.truncate_cbk.op_errno, - &stub->args.truncate_cbk.prebuf, - &stub->args.truncate_cbk.postbuf, stub->xdata); - else - stub->args.truncate_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.truncate_cbk.op_ret, - stub->args.truncate_cbk.op_errno, - &stub->args.truncate_cbk.prebuf, - &stub->args.truncate_cbk.postbuf, stub->xdata); - break; - } - + STUB_UNWIND (stub, truncate, &stub->args_cbk.prestat, + &stub->args_cbk.poststat, stub->args_cbk.xdata); + break; case GF_FOP_READ: - { - if (!stub->args.readv_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.readv_cbk.op_ret, - stub->args.readv_cbk.op_errno, - stub->args.readv_cbk.vector, - stub->args.readv_cbk.count, - &stub->args.readv_cbk.stbuf, - stub->args.readv_cbk.iobref, stub->xdata); - else - stub->args.readv_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.readv_cbk.op_ret, - stub->args.readv_cbk.op_errno, - stub->args.readv_cbk.vector, - stub->args.readv_cbk.count, - &stub->args.readv_cbk.stbuf, - stub->args.readv_cbk.iobref, stub->xdata); - } - break; - + STUB_UNWIND (stub, readv, stub->args_cbk.vector, + stub->args_cbk.count, &stub->args_cbk.stat, + stub->args_cbk.iobref, stub->args_cbk.xdata); + break; case GF_FOP_WRITE: - { - if (!stub->args.writev_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.writev_cbk.op_ret, - stub->args.writev_cbk.op_errno, - &stub->args.writev_cbk.prebuf, - &stub->args.writev_cbk.postbuf, stub->xdata); - else - stub->args.writev_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.writev_cbk.op_ret, - stub->args.writev_cbk.op_errno, - &stub->args.writev_cbk.prebuf, - &stub->args.writev_cbk.postbuf, stub->xdata); - break; - } - + STUB_UNWIND (stub, writev, &stub->args_cbk.prestat, + &stub->args_cbk.poststat, stub->args_cbk.xdata); + break; case GF_FOP_STATFS: - { - if (!stub->args.statfs_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.statfs_cbk.op_ret, - stub->args.statfs_cbk.op_errno, - &(stub->args.statfs_cbk.buf), stub->xdata); - else - stub->args.statfs_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.statfs_cbk.op_ret, - stub->args.statfs_cbk.op_errno, - &(stub->args.statfs_cbk.buf), stub->xdata); - } - break; - + STUB_UNWIND (stub, statfs, &stub->args_cbk.statvfs, + stub->args_cbk.xdata); + break; case GF_FOP_FLUSH: - { - if (!stub->args.flush_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.flush_cbk.op_ret, - stub->args.flush_cbk.op_errno, stub->xdata); - else - stub->args.flush_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.flush_cbk.op_ret, - stub->args.flush_cbk.op_errno, stub->xdata); - - break; - } - + STUB_UNWIND (stub, flush, stub->args_cbk.xdata); + break; case GF_FOP_FSYNC: - { - if (!stub->args.fsync_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.fsync_cbk.op_ret, - stub->args.fsync_cbk.op_errno, - &stub->args.fsync_cbk.prebuf, - &stub->args.fsync_cbk.postbuf, stub->xdata); - else - stub->args.fsync_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.fsync_cbk.op_ret, - stub->args.fsync_cbk.op_errno, - &stub->args.fsync_cbk.prebuf, - &stub->args.fsync_cbk.postbuf, stub->xdata); - break; - } - + STUB_UNWIND (stub, fsync, &stub->args_cbk.prestat, + &stub->args_cbk.poststat, stub->args_cbk.xdata); + break; case GF_FOP_SETXATTR: - { - if (!stub->args.setxattr_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.setxattr_cbk.op_ret, - stub->args.setxattr_cbk.op_errno, stub->xdata); - - else - stub->args.setxattr_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.setxattr_cbk.op_ret, - stub->args.setxattr_cbk.op_errno, stub->xdata); - - break; - } - + STUB_UNWIND (stub, setxattr, stub->args_cbk.xdata); + break; case GF_FOP_GETXATTR: - { - if (!stub->args.getxattr_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.getxattr_cbk.op_ret, - stub->args.getxattr_cbk.op_errno, - stub->args.getxattr_cbk.dict, stub->xdata); - else - stub->args.getxattr_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.getxattr_cbk.op_ret, - stub->args.getxattr_cbk.op_errno, - stub->args.getxattr_cbk.dict, stub->xdata); - break; - } - + STUB_UNWIND (stub, getxattr, stub->args_cbk.xattr, + stub->args_cbk.xdata); + break; case GF_FOP_FSETXATTR: - { - if (!stub->args.fsetxattr_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.fsetxattr_cbk.op_ret, - stub->args.fsetxattr_cbk.op_errno, stub->xdata); - - else - stub->args.fsetxattr_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.fsetxattr_cbk.op_ret, - stub->args.fsetxattr_cbk.op_errno, stub->xdata); - - break; - } - + STUB_UNWIND (stub, fsetxattr, stub->args_cbk.xdata); + break; case GF_FOP_FGETXATTR: - { - if (!stub->args.fgetxattr_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.fgetxattr_cbk.op_ret, - stub->args.fgetxattr_cbk.op_errno, - stub->args.fgetxattr_cbk.dict, stub->xdata); - else - stub->args.fgetxattr_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.fgetxattr_cbk.op_ret, - stub->args.fgetxattr_cbk.op_errno, - stub->args.fgetxattr_cbk.dict, stub->xdata); - break; - } - + STUB_UNWIND (stub, fgetxattr, stub->args_cbk.xattr, + stub->args_cbk.xdata); + break; case GF_FOP_REMOVEXATTR: - { - if (!stub->args.removexattr_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.removexattr_cbk.op_ret, - stub->args.removexattr_cbk.op_errno, stub->xdata); - else - stub->args.removexattr_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.removexattr_cbk.op_ret, - stub->args.removexattr_cbk.op_errno, stub->xdata); - - break; - } - + STUB_UNWIND (stub, removexattr, stub->args_cbk.xdata); + break; case GF_FOP_FREMOVEXATTR: - { - if (!stub->args.fremovexattr_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.fremovexattr_cbk.op_ret, - stub->args.fremovexattr_cbk.op_errno, stub->xdata); - else - stub->args.fremovexattr_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.fremovexattr_cbk.op_ret, - stub->args.fremovexattr_cbk.op_errno, stub->xdata); - - break; - } - + STUB_UNWIND (stub, fremovexattr, stub->args_cbk.xdata); + break; case GF_FOP_OPENDIR: - { - if (!stub->args.opendir_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.opendir_cbk.op_ret, - stub->args.opendir_cbk.op_errno, - stub->args.opendir_cbk.fd, stub->xdata); - else - stub->args.opendir_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.opendir_cbk.op_ret, - stub->args.opendir_cbk.op_errno, - stub->args.opendir_cbk.fd, stub->xdata); - break; - } - + STUB_UNWIND (stub, opendir, stub->args_cbk.fd, + stub->args_cbk.xdata); + break; case GF_FOP_FSYNCDIR: - { - if (!stub->args.fsyncdir_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.fsyncdir_cbk.op_ret, - stub->args.fsyncdir_cbk.op_errno, stub->xdata); - else - stub->args.fsyncdir_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.fsyncdir_cbk.op_ret, - stub->args.fsyncdir_cbk.op_errno, stub->xdata); + STUB_UNWIND (stub, fsyncdir, stub->args_cbk.xdata); break; - } - case GF_FOP_ACCESS: - { - if (!stub->args.access_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.access_cbk.op_ret, - stub->args.access_cbk.op_errno, stub->xdata); - else - stub->args.access_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.access_cbk.op_ret, - stub->args.access_cbk.op_errno, stub->xdata); - + STUB_UNWIND (stub, access, stub->args_cbk.xdata); break; - } - case GF_FOP_FTRUNCATE: - { - if (!stub->args.ftruncate_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.ftruncate_cbk.op_ret, - stub->args.ftruncate_cbk.op_errno, - &stub->args.ftruncate_cbk.prebuf, - &stub->args.ftruncate_cbk.postbuf, stub->xdata); - else - stub->args.ftruncate_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.ftruncate_cbk.op_ret, - stub->args.ftruncate_cbk.op_errno, - &stub->args.ftruncate_cbk.prebuf, - &stub->args.ftruncate_cbk.postbuf, stub->xdata); - break; - } - + STUB_UNWIND (stub, ftruncate, &stub->args_cbk.prestat, + &stub->args_cbk.poststat, stub->args_cbk.xdata); case GF_FOP_FSTAT: - { - if (!stub->args.fstat_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.fstat_cbk.op_ret, - stub->args.fstat_cbk.op_errno, - &stub->args.fstat_cbk.buf, stub->xdata); - else - stub->args.fstat_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.fstat_cbk.op_ret, - stub->args.fstat_cbk.op_errno, - &stub->args.fstat_cbk.buf, stub->xdata); - + STUB_UNWIND (stub, fstat, &stub->args_cbk.stat, + stub->args_cbk.xdata); break; - } - case GF_FOP_LK: - { - if (!stub->args.lk_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.lk_cbk.op_ret, - stub->args.lk_cbk.op_errno, - &stub->args.lk_cbk.lock, stub->xdata); - else - stub->args.lk_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.lk_cbk.op_ret, - stub->args.lk_cbk.op_errno, - &stub->args.lk_cbk.lock, stub->xdata); - break; - } - + STUB_UNWIND (stub, lk, &stub->args_cbk.lock, + stub->args_cbk.xdata); + break; case GF_FOP_INODELK: - { - if (!stub->args.inodelk_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.inodelk_cbk.op_ret, - stub->args.inodelk_cbk.op_errno, stub->xdata); - - else - stub->args.inodelk_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.inodelk_cbk.op_ret, - stub->args.inodelk_cbk.op_errno, stub->xdata); + STUB_UNWIND (stub, inodelk, stub->args_cbk.xdata); break; - } - case GF_FOP_FINODELK: - { - if (!stub->args.finodelk_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.finodelk_cbk.op_ret, - stub->args.finodelk_cbk.op_errno, stub->xdata); - - else - stub->args.finodelk_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.finodelk_cbk.op_ret, - stub->args.finodelk_cbk.op_errno, stub->xdata); + STUB_UNWIND (stub, finodelk, stub->args_cbk.xdata); break; - } - case GF_FOP_ENTRYLK: - { - if (!stub->args.entrylk_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.entrylk_cbk.op_ret, - stub->args.entrylk_cbk.op_errno, stub->xdata); - - else - stub->args.entrylk_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.entrylk_cbk.op_ret, - stub->args.entrylk_cbk.op_errno, stub->xdata); - break; - } - + STUB_UNWIND (stub, entrylk, stub->args_cbk.xdata); + break; case GF_FOP_FENTRYLK: - { - if (!stub->args.fentrylk_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.fentrylk_cbk.op_ret, - stub->args.fentrylk_cbk.op_errno, stub->xdata); - - else - stub->args.fentrylk_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.fentrylk_cbk.op_ret, - stub->args.fentrylk_cbk.op_errno, stub->xdata); + STUB_UNWIND (stub, fentrylk, stub->args_cbk.xdata); break; - } - case GF_FOP_LOOKUP: - { - if (!stub->args.lookup_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.lookup_cbk.op_ret, - stub->args.lookup_cbk.op_errno, - stub->args.lookup_cbk.inode, - &stub->args.lookup_cbk.buf, - stub->xdata, - &stub->args.lookup_cbk.postparent); - else - stub->args.lookup_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.lookup_cbk.op_ret, - stub->args.lookup_cbk.op_errno, - stub->args.lookup_cbk.inode, - &stub->args.lookup_cbk.buf, - stub->xdata, - &stub->args.lookup_cbk.postparent); - /* FIXME NULL should not be passed */ - - if (stub->args.lookup_cbk.inode) - inode_unref (stub->args.lookup_cbk.inode); - + STUB_UNWIND (stub, lookup, stub->args_cbk.inode, + &stub->args_cbk.stat, stub->args_cbk.xdata, + &stub->args_cbk.postparent); break; - } - case GF_FOP_RCHECKSUM: - { - if (!stub->args.rchecksum_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.rchecksum_cbk.op_ret, - stub->args.rchecksum_cbk.op_errno, - stub->args.rchecksum_cbk.weak_checksum, - stub->args.rchecksum_cbk.strong_checksum, stub->xdata); - else - stub->args.rchecksum_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.rchecksum_cbk.op_ret, - stub->args.rchecksum_cbk.op_errno, - stub->args.rchecksum_cbk.weak_checksum, - stub->args.rchecksum_cbk.strong_checksum, stub->xdata); - - if (stub->args.rchecksum_cbk.op_ret >= 0) - GF_FREE (stub->args.rchecksum_cbk.strong_checksum); - - break; - } - + STUB_UNWIND (stub, rchecksum, stub->args_cbk.weak_checksum, + stub->args_cbk.strong_checksum, stub->args_cbk.xdata); + break; case GF_FOP_READDIR: - { - if (!stub->args.readdir_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.readdir_cbk.op_ret, - stub->args.readdir_cbk.op_errno, - &stub->args.readdir_cbk.entries, stub->xdata); - else - stub->args.readdir_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.readdir_cbk.op_ret, - stub->args.readdir_cbk.op_errno, - &stub->args.readdir_cbk.entries, stub->xdata); - - if (stub->args.readdir_cbk.op_ret > 0) - gf_dirent_free (&stub->args.readdir_cbk.entries); - - break; - } - + STUB_UNWIND (stub, readdir, &stub->args_cbk.entries, + stub->args_cbk.xdata); + break; case GF_FOP_READDIRP: - { - if (!stub->args.readdirp_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.readdirp_cbk.op_ret, - stub->args.readdirp_cbk.op_errno, - &stub->args.readdirp_cbk.entries, stub->xdata); - else - stub->args.readdirp_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.readdirp_cbk.op_ret, - stub->args.readdirp_cbk.op_errno, - &stub->args.readdirp_cbk.entries, stub->xdata); - - if (stub->args.readdirp_cbk.op_ret > 0) - gf_dirent_free (&stub->args.readdirp_cbk.entries); - + STUB_UNWIND (stub, readdir, &stub->args_cbk.entries, + stub->args_cbk.xdata); break; - } - case GF_FOP_XATTROP: - { - if (!stub->args.xattrop_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.xattrop_cbk.op_ret, - stub->args.xattrop_cbk.op_errno, stub->xdata); - else - stub->args.xattrop_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.xattrop_cbk.op_ret, - stub->args.xattrop_cbk.op_errno, - stub->args.xattrop_cbk.xattr, stub->xdata); - - if (stub->args.xattrop_cbk.xattr) - dict_unref (stub->args.xattrop_cbk.xattr); - - break; - } + STUB_UNWIND (stub, xattrop, stub->args_cbk.xattr, + stub->args_cbk.xdata); + break; case GF_FOP_FXATTROP: - { - if (!stub->args.fxattrop_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.fxattrop_cbk.op_ret, - stub->args.fxattrop_cbk.op_errno, stub->xdata); - else - stub->args.fxattrop_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.fxattrop_cbk.op_ret, - stub->args.fxattrop_cbk.op_errno, - stub->args.fxattrop_cbk.xattr, stub->xdata); - - if (stub->args.fxattrop_cbk.xattr) - dict_unref (stub->args.fxattrop_cbk.xattr); - - break; - } + STUB_UNWIND (stub, fxattrop, stub->args_cbk.xattr, + stub->args_cbk.xdata); + break; case GF_FOP_SETATTR: - { - if (!stub->args.setattr_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.setattr_cbk.op_ret, - stub->args.setattr_cbk.op_errno, - &stub->args.setattr_cbk.statpre, - &stub->args.setattr_cbk.statpost, stub->xdata); - else - stub->args.setattr_cbk.fn ( - stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.setattr_cbk.op_ret, - stub->args.setattr_cbk.op_errno, - &stub->args.setattr_cbk.statpre, - &stub->args.setattr_cbk.statpost, stub->xdata); + STUB_UNWIND (stub, setattr, &stub->args_cbk.prestat, + &stub->args_cbk.poststat, stub->args_cbk.xdata); break; - } case GF_FOP_FSETATTR: - { - if (!stub->args.fsetattr_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.fsetattr_cbk.op_ret, - stub->args.fsetattr_cbk.op_errno, - &stub->args.fsetattr_cbk.statpre, - &stub->args.fsetattr_cbk.statpost, stub->xdata); - else - stub->args.fsetattr_cbk.fn ( - stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.fsetattr_cbk.op_ret, - stub->args.fsetattr_cbk.op_errno, - &stub->args.fsetattr_cbk.statpre, - &stub->args.fsetattr_cbk.statpost, stub->xdata); + STUB_UNWIND (stub, fsetattr, &stub->args_cbk.prestat, + &stub->args_cbk.poststat, stub->args_cbk.xdata); break; - } default: - { gf_log_callingfn ("call-stub", GF_LOG_ERROR, "Invalid value of FOP (%d)", stub->fop); break; } - } out: return; } static void -call_stub_destroy_wind (call_stub_t *stub) +call_stub_wipe_args (call_stub_t *stub) { - if (stub->xdata) - dict_unref (stub->xdata); - - switch (stub->fop) { - case GF_FOP_OPEN: - { - loc_wipe (&stub->args.open.loc); - if (stub->args.open.fd) - fd_unref (stub->args.open.fd); - break; - } - case GF_FOP_CREATE: - { - loc_wipe (&stub->args.create.loc); - if (stub->args.create.fd) - fd_unref (stub->args.create.fd); - break; - } - case GF_FOP_STAT: - { - loc_wipe (&stub->args.stat.loc); - break; - } - case GF_FOP_READLINK: - { - loc_wipe (&stub->args.readlink.loc); - break; - } - - case GF_FOP_MKNOD: - { - loc_wipe (&stub->args.mknod.loc); - } - break; - - case GF_FOP_MKDIR: - { - loc_wipe (&stub->args.mkdir.loc); - } - break; - - case GF_FOP_UNLINK: - { - loc_wipe (&stub->args.unlink.loc); - } - break; - - case GF_FOP_RMDIR: - { - loc_wipe (&stub->args.rmdir.loc); - } - break; - - case GF_FOP_SYMLINK: - { - GF_FREE ((char *)stub->args.symlink.linkname); - loc_wipe (&stub->args.symlink.loc); - } - break; - - case GF_FOP_RENAME: - { - loc_wipe (&stub->args.rename.old); - loc_wipe (&stub->args.rename.new); - } - break; - - case GF_FOP_LINK: - { - loc_wipe (&stub->args.link.oldloc); - loc_wipe (&stub->args.link.newloc); - } - break; - - case GF_FOP_TRUNCATE: - { - loc_wipe (&stub->args.truncate.loc); - break; - } - - case GF_FOP_READ: - { - if (stub->args.readv.fd) - fd_unref (stub->args.readv.fd); - break; - } - - case GF_FOP_WRITE: - { - struct iobref *iobref = stub->args.writev.iobref; - if (stub->args.writev.fd) - fd_unref (stub->args.writev.fd); - GF_FREE (stub->args.writev.vector); - if (iobref) - iobref_unref (iobref); - break; - } - - case GF_FOP_STATFS: - { - loc_wipe (&stub->args.statfs.loc); - break; - } - case GF_FOP_FLUSH: - { - if (stub->args.flush.fd) - fd_unref (stub->args.flush.fd); - break; - } - - case GF_FOP_FSYNC: - { - if (stub->args.fsync.fd) - fd_unref (stub->args.fsync.fd); - break; - } - - case GF_FOP_SETXATTR: - { - loc_wipe (&stub->args.setxattr.loc); - if (stub->args.setxattr.dict) - dict_unref (stub->args.setxattr.dict); - break; - } - - case GF_FOP_GETXATTR: - { - GF_FREE ((char *)stub->args.getxattr.name); - loc_wipe (&stub->args.getxattr.loc); - break; - } + loc_wipe (&stub->args.loc); - case GF_FOP_FSETXATTR: - { - fd_unref (stub->args.fsetxattr.fd); - if (stub->args.fsetxattr.dict) - dict_unref (stub->args.fsetxattr.dict); - break; - } + loc_wipe (&stub->args.loc2); - case GF_FOP_FGETXATTR: - { - GF_FREE ((char *)stub->args.fgetxattr.name); - fd_unref (stub->args.fgetxattr.fd); - break; - } - - case GF_FOP_REMOVEXATTR: - { - loc_wipe (&stub->args.removexattr.loc); - GF_FREE ((char *)stub->args.removexattr.name); - break; - } + if (stub->args.fd) + fd_unref (stub->args.fd); - case GF_FOP_FREMOVEXATTR: - { - fd_unref (stub->args.fremovexattr.fd); - GF_FREE ((char *)stub->args.fremovexattr.name); - break; - } + GF_FREE ((char *)stub->args.linkname); - case GF_FOP_OPENDIR: - { - loc_wipe (&stub->args.opendir.loc); - if (stub->args.opendir.fd) - fd_unref (stub->args.opendir.fd); - break; - } + GF_FREE (stub->args.vector); - case GF_FOP_FSYNCDIR: - { - if (stub->args.fsyncdir.fd) - fd_unref (stub->args.fsyncdir.fd); - break; - } - - case GF_FOP_ACCESS: - { - loc_wipe (&stub->args.access.loc); - break; - } - - case GF_FOP_FTRUNCATE: - { - if (stub->args.ftruncate.fd) - fd_unref (stub->args.ftruncate.fd); - break; - } - - case GF_FOP_FSTAT: - { - if (stub->args.fstat.fd) - fd_unref (stub->args.fstat.fd); - break; - } - - case GF_FOP_LK: - { - if (stub->args.lk.fd) - fd_unref (stub->args.lk.fd); - break; - } - - case GF_FOP_INODELK: - { - GF_FREE ((char *)stub->args.inodelk.volume); - - loc_wipe (&stub->args.inodelk.loc); - break; - } - case GF_FOP_FINODELK: - { - GF_FREE ((char *)stub->args.finodelk.volume); - - if (stub->args.finodelk.fd) - fd_unref (stub->args.finodelk.fd); - break; - } - case GF_FOP_ENTRYLK: - { - GF_FREE ((char *)stub->args.entrylk.volume); - - GF_FREE ((char *)stub->args.entrylk.name); - loc_wipe (&stub->args.entrylk.loc); - break; - } - case GF_FOP_FENTRYLK: - { - GF_FREE ((char *)stub->args.fentrylk.volume); - - GF_FREE ((char *)stub->args.fentrylk.name); - - if (stub->args.fentrylk.fd) - fd_unref (stub->args.fentrylk.fd); - break; - } - - case GF_FOP_LOOKUP: - { - loc_wipe (&stub->args.lookup.loc); - break; - } - - case GF_FOP_RCHECKSUM: - { - if (stub->args.rchecksum.fd) - fd_unref (stub->args.rchecksum.fd); - break; - } + if (stub->args.iobref) + iobref_unref (stub->args.iobref); - case GF_FOP_READDIR: - { - if (stub->args.readdir.fd) - fd_unref (stub->args.readdir.fd); - break; - } + if (stub->args.xattr) + dict_unref (stub->args.xattr); - case GF_FOP_READDIRP: - { - if (stub->args.readdirp.fd) - fd_unref (stub->args.readdirp.fd); + GF_FREE ((char *)stub->args.name); - break; - } + GF_FREE ((char *)stub->args.volume); - case GF_FOP_XATTROP: - { - loc_wipe (&stub->args.xattrop.loc); - dict_unref (stub->args.xattrop.xattr); - break; - } - case GF_FOP_FXATTROP: - { - if (stub->args.fxattrop.fd) - fd_unref (stub->args.fxattrop.fd); - dict_unref (stub->args.fxattrop.xattr); - break; - } - case GF_FOP_SETATTR: - { - loc_wipe (&stub->args.setattr.loc); - break; - } - case GF_FOP_FSETATTR: - { - if (stub->args.fsetattr.fd) - fd_unref (stub->args.fsetattr.fd); - break; - } - default: - { - gf_log_callingfn ("call-stub", GF_LOG_ERROR, - "Invalid value of FOP (%d)", - stub->fop); - break; - } - } + if (stub->args.xdata) + dict_unref (stub->args.xdata); } static void -call_stub_destroy_unwind (call_stub_t *stub) +call_stub_wipe_args_cbk (call_stub_t *stub) { - if (stub->xdata) - dict_unref (stub->xdata); - - switch (stub->fop) { - case GF_FOP_OPEN: - { - if (stub->args.open_cbk.fd) - fd_unref (stub->args.open_cbk.fd); - } - break; - - case GF_FOP_CREATE: - { - if (stub->args.create_cbk.fd) - fd_unref (stub->args.create_cbk.fd); - - if (stub->args.create_cbk.inode) - inode_unref (stub->args.create_cbk.inode); - } - break; - - case GF_FOP_STAT: - break; - - case GF_FOP_READLINK: - { - GF_FREE ((char *)stub->args.readlink_cbk.buf); - } - break; - - case GF_FOP_MKNOD: - { - if (stub->args.mknod_cbk.inode) - inode_unref (stub->args.mknod_cbk.inode); - } - break; - - case GF_FOP_MKDIR: - { - if (stub->args.mkdir_cbk.inode) - inode_unref (stub->args.mkdir_cbk.inode); - } - break; - - case GF_FOP_UNLINK: - break; - - case GF_FOP_RMDIR: - break; - - case GF_FOP_SYMLINK: - { - if (stub->args.symlink_cbk.inode) - inode_unref (stub->args.symlink_cbk.inode); - } - break; - - case GF_FOP_RENAME: - break; - - case GF_FOP_LINK: - { - if (stub->args.link_cbk.inode) - inode_unref (stub->args.link_cbk.inode); - } - break; - - case GF_FOP_TRUNCATE: - break; - - case GF_FOP_READ: - { - if (stub->args.readv_cbk.op_ret >= 0) { - struct iobref *iobref = stub->args.readv_cbk.iobref; - GF_FREE (stub->args.readv_cbk.vector); - - if (iobref) { - iobref_unref (iobref); - } - } - } - break; - - case GF_FOP_WRITE: - break; - - case GF_FOP_STATFS: - break; - - case GF_FOP_FLUSH: - break; - - case GF_FOP_FSYNC: - break; - - case GF_FOP_SETXATTR: - break; - - case GF_FOP_GETXATTR: - { - if (stub->args.getxattr_cbk.dict) - dict_unref (stub->args.getxattr_cbk.dict); - } - break; + if (stub->args_cbk.inode) + inode_unref (stub->args_cbk.inode); - case GF_FOP_FSETXATTR: - break; - - case GF_FOP_FGETXATTR: - { - if (stub->args.fgetxattr_cbk.dict) - dict_unref (stub->args.fgetxattr_cbk.dict); - } - break; - - case GF_FOP_REMOVEXATTR: - break; - case GF_FOP_FREMOVEXATTR: - break; - - case GF_FOP_OPENDIR: - { - if (stub->args.opendir_cbk.fd) - fd_unref (stub->args.opendir_cbk.fd); - } - break; - - case GF_FOP_FSYNCDIR: - break; - - case GF_FOP_ACCESS: - break; - - case GF_FOP_FTRUNCATE: - break; - - case GF_FOP_FSTAT: - break; + GF_FREE ((char *)stub->args_cbk.buf); - case GF_FOP_LK: - break; + GF_FREE (stub->args_cbk.vector); - case GF_FOP_INODELK: - break; + if (stub->args_cbk.iobref) + iobref_unref (stub->args_cbk.iobref); - case GF_FOP_FINODELK: - break; - - case GF_FOP_ENTRYLK: - break; - - case GF_FOP_FENTRYLK: - break; + if (stub->args_cbk.fd) + fd_unref (stub->args_cbk.fd); - case GF_FOP_LOOKUP: - { - if (stub->args.lookup_cbk.inode) - inode_unref (stub->args.lookup_cbk.inode); - } - break; + if (stub->args_cbk.xattr) + dict_unref (stub->args_cbk.xattr); - case GF_FOP_RCHECKSUM: - { - if (stub->args.rchecksum_cbk.op_ret >= 0) { - GF_FREE (stub->args.rchecksum_cbk.strong_checksum); - } - } - break; + GF_FREE (stub->args_cbk.strong_checksum); - case GF_FOP_READDIR: - { - if (stub->args.readdir_cbk.op_ret > 0) { - gf_dirent_free (&stub->args.readdir_cbk.entries); - } - } - break; + if (stub->args_cbk.xdata) + dict_unref (stub->args_cbk.xdata); - case GF_FOP_READDIRP: - { - if (stub->args.readdirp_cbk.op_ret > 0) { - gf_dirent_free (&stub->args.readdirp_cbk.entries); - } - } - break; - - case GF_FOP_XATTROP: - { - if (stub->args.xattrop_cbk.xattr) - dict_unref (stub->args.xattrop_cbk.xattr); - } - break; - - case GF_FOP_FXATTROP: - { - if (stub->args.fxattrop_cbk.xattr) - dict_unref (stub->args.fxattrop_cbk.xattr); - } - break; - - case GF_FOP_SETATTR: - { - break; - } - - case GF_FOP_FSETATTR: - { - break; - } - - default: - { - gf_log_callingfn ("call-stub", GF_LOG_ERROR, - "Invalid value of FOP (%d)", - stub->fop); - break; - } - } + if (!list_empty (&stub->args_cbk.entries.list)) + gf_dirent_free (&stub->args_cbk.entries); } @@ -4113,18 +2614,19 @@ call_stub_destroy (call_stub_t *stub) { GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - if (stub->wind) { - call_stub_destroy_wind (stub); - } else { - call_stub_destroy_unwind (stub); - } + if (stub->wind) + call_stub_wipe_args (stub); + else + call_stub_wipe_args_cbk (stub); stub->stub_mem_pool = NULL; + mem_put (stub); out: return; } + void call_resume (call_stub_t *stub) { @@ -4149,3 +2651,26 @@ call_resume (call_stub_t *stub) out: return; } + + +void +call_unwind_error (call_stub_t *stub, int op_ret, int op_errno) +{ + xlator_t *old_THIS = NULL; + + list_del_init (&stub->list); + + old_THIS = THIS; + THIS = stub->frame->this; + { + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; + call_resume_unwind (stub); + } + THIS = old_THIS; + + call_stub_destroy (stub); + + return; + +} diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h index 633fc4cbbe4..335111835b6 100644 --- a/libglusterfs/src/call-stub.h +++ b/libglusterfs/src/call-stub.h @@ -26,568 +26,152 @@ typedef struct { call_frame_t *frame; glusterfs_fop_t fop; struct mem_pool *stub_mem_pool; /* pointer to stub mempool in ctx_t */ - dict_t *xdata; /* common accross all the fops */ union { - /* lookup */ - struct { - fop_lookup_t fn; - loc_t loc; - } lookup; - struct { - fop_lookup_cbk_t fn; - int32_t op_ret, op_errno; - inode_t *inode; - struct iatt buf; - struct iatt postparent; - } lookup_cbk; - - /* stat */ - struct { - fop_stat_t fn; - loc_t loc; - } stat; - struct { - fop_stat_cbk_t fn; - int32_t op_ret, op_errno; - struct iatt buf; - } stat_cbk; - - /* fstat */ - struct { - fop_fstat_t fn; - fd_t *fd; - } fstat; - struct { - fop_fstat_cbk_t fn; - int32_t op_ret, op_errno; - struct iatt buf; - } fstat_cbk; - - /* truncate */ - struct { - fop_truncate_t fn; - loc_t loc; - off_t off; - } truncate; - struct { - fop_truncate_cbk_t fn; - int32_t op_ret, op_errno; - struct iatt prebuf; - struct iatt postbuf; - } truncate_cbk; - - /* ftruncate */ - struct { - fop_ftruncate_t fn; - fd_t *fd; - off_t off; - } ftruncate; - struct { - fop_ftruncate_cbk_t fn; - int32_t op_ret, op_errno; - struct iatt prebuf; - struct iatt postbuf; - } ftruncate_cbk; - - /* access */ - struct { - fop_access_t fn; - loc_t loc; - int32_t mask; - } access; - struct { - fop_access_cbk_t fn; - int32_t op_ret, op_errno; - } access_cbk; - - /* readlink */ - struct { - fop_readlink_t fn; - loc_t loc; - size_t size; - } readlink; - struct { - fop_readlink_cbk_t fn; - int32_t op_ret, op_errno; - const char *buf; - struct iatt sbuf; - } readlink_cbk; - - /* mknod */ - struct { - fop_mknod_t fn; - loc_t loc; - mode_t mode; - dev_t rdev; - mode_t umask; - } mknod; - struct { - fop_mknod_cbk_t fn; - int32_t op_ret, op_errno; - inode_t *inode; - struct iatt buf; - struct iatt preparent; - struct iatt postparent; - } mknod_cbk; - - /* mkdir */ - struct { - fop_mkdir_t fn; - loc_t loc; - mode_t mode; - mode_t umask; - } mkdir; - struct { - fop_mkdir_cbk_t fn; - int32_t op_ret, op_errno; - inode_t *inode; - struct iatt buf; - struct iatt preparent; - struct iatt postparent; - } mkdir_cbk; - - /* unlink */ - struct { - fop_unlink_t fn; - loc_t loc; - int xflag; - } unlink; - struct { - fop_unlink_cbk_t fn; - int32_t op_ret, op_errno; - struct iatt preparent; - struct iatt postparent; - } unlink_cbk; - - /* rmdir */ - struct { - fop_rmdir_t fn; - loc_t loc; - int flags; - } rmdir; - struct { - fop_rmdir_cbk_t fn; - int32_t op_ret, op_errno; - struct iatt preparent; - struct iatt postparent; - } rmdir_cbk; - - /* symlink */ - struct { - fop_symlink_t fn; - const char *linkname; - loc_t loc; - mode_t umask; - } symlink; - struct { - fop_symlink_cbk_t fn; - int32_t op_ret, op_errno; - inode_t *inode; - struct iatt buf; - struct iatt preparent; - struct iatt postparent; - } symlink_cbk; - - /* rename */ - struct { - fop_rename_t fn; - loc_t old; - loc_t new; - } rename; - struct { - fop_rename_cbk_t fn; - int32_t op_ret, op_errno; - struct iatt buf; - struct iatt preoldparent; - struct iatt postoldparent; - struct iatt prenewparent; - struct iatt postnewparent; - } rename_cbk; - - /* link */ - struct { - fop_link_t fn; - loc_t oldloc; - loc_t newloc; - } link; - struct { - fop_link_cbk_t fn; - int32_t op_ret, op_errno; - inode_t *inode; - struct iatt buf; - struct iatt preparent; - struct iatt postparent; - } link_cbk; - - /* create */ - struct { - fop_create_t fn; - loc_t loc; - int32_t flags; - mode_t mode; - fd_t *fd; - mode_t umask; - } create; - struct { - fop_create_cbk_t fn; - int32_t op_ret, op_errno; - fd_t *fd; - inode_t *inode; - struct iatt buf; - struct iatt preparent; - struct iatt postparent; - } create_cbk; - - /* open */ - struct { - fop_open_t fn; - loc_t loc; - int32_t flags; - fd_t *fd; - } open; - struct { - fop_open_cbk_t fn; - int32_t op_ret, op_errno; - fd_t *fd; - } open_cbk; - - /* readv */ - struct { - fop_readv_t fn; - fd_t *fd; - size_t size; - off_t off; - uint32_t flags; - } readv; - struct { - fop_readv_cbk_t fn; - int32_t op_ret; - int32_t op_errno; - struct iovec *vector; - int32_t count; - struct iatt stbuf; - struct iobref *iobref; - } readv_cbk; - - /* writev */ - struct { - fop_writev_t fn; - fd_t *fd; - struct iovec *vector; - int32_t count; - off_t off; - uint32_t flags; - struct iobref *iobref; - } writev; - struct { - fop_writev_cbk_t fn; - int32_t op_ret, op_errno; - struct iatt prebuf; - struct iatt postbuf; - } writev_cbk; - - /* flush */ - struct { - fop_flush_t fn; - fd_t *fd; - } flush; - struct { - fop_flush_cbk_t fn; - int32_t op_ret, op_errno; - } flush_cbk; - - /* fsync */ - struct { - fop_fsync_t fn; - fd_t *fd; - int32_t datasync; - } fsync; - struct { - fop_fsync_cbk_t fn; - int32_t op_ret, op_errno; - struct iatt prebuf; - struct iatt postbuf; - } fsync_cbk; - - /* opendir */ - struct { - fop_opendir_t fn; - loc_t loc; - fd_t *fd; - } opendir; - struct { - fop_opendir_cbk_t fn; - int32_t op_ret, op_errno; - fd_t *fd; - } opendir_cbk; - - - /* fsyncdir */ - struct { - fop_fsyncdir_t fn; - fd_t *fd; - int32_t datasync; - } fsyncdir; - struct { - fop_fsyncdir_cbk_t fn; - int32_t op_ret, op_errno; - } fsyncdir_cbk; - - /* statfs */ - struct { - fop_statfs_t fn; - loc_t loc; - } statfs; - struct { - fop_statfs_cbk_t fn; - int32_t op_ret, op_errno; - struct statvfs buf; - } statfs_cbk; - - /* setxattr */ - struct { - fop_setxattr_t fn; - loc_t loc; - dict_t *dict; - int32_t flags; - } setxattr; - struct { - fop_setxattr_cbk_t fn; - int32_t op_ret, op_errno; - } setxattr_cbk; - - /* getxattr */ - struct { - fop_getxattr_t fn; - loc_t loc; - const char *name; - } getxattr; - struct { - fop_getxattr_cbk_t fn; - int32_t op_ret, op_errno; - dict_t *dict; - } getxattr_cbk; - - /* fsetxattr */ - struct { - fop_fsetxattr_t fn; - fd_t *fd; - dict_t *dict; - int32_t flags; - } fsetxattr; - struct { - fop_fsetxattr_cbk_t fn; - int32_t op_ret, op_errno; - } fsetxattr_cbk; - - /* fgetxattr */ - struct { - fop_fgetxattr_t fn; - fd_t *fd; - const char *name; - } fgetxattr; - struct { - fop_fgetxattr_cbk_t fn; - int32_t op_ret, op_errno; - dict_t *dict; - } fgetxattr_cbk; - - /* removexattr */ - struct { - fop_removexattr_t fn; - loc_t loc; - const char *name; - } removexattr; - struct { - fop_removexattr_cbk_t fn; - int32_t op_ret, op_errno; - } removexattr_cbk; - - - /* fremovexattr */ - struct { - fop_fremovexattr_t fn; - fd_t *fd; - const char *name; - } fremovexattr; - struct { - fop_fremovexattr_cbk_t fn; - int32_t op_ret, op_errno; - } fremovexattr_cbk; - - /* lk */ - struct { - fop_lk_t fn; - fd_t *fd; - int32_t cmd; - struct gf_flock lock; - } lk; - struct { - fop_lk_cbk_t fn; - int32_t op_ret, op_errno; - struct gf_flock lock; - } lk_cbk; - - /* inodelk */ - struct { - fop_inodelk_t fn; - const char *volume; - loc_t loc; - int32_t cmd; - struct gf_flock lock; - } inodelk; - - struct { - fop_inodelk_cbk_t fn; - int32_t op_ret, op_errno; - } inodelk_cbk; - - /* finodelk */ - struct { - fop_finodelk_t fn; - const char *volume; - fd_t *fd; - int32_t cmd; - struct gf_flock lock; - } finodelk; - - struct { - fop_finodelk_cbk_t fn; - int32_t op_ret, op_errno; - } finodelk_cbk; - - /* entrylk */ - struct { - fop_entrylk_t fn; - loc_t loc; - const char *volume; - const char *name; - entrylk_cmd cmd; - entrylk_type type; - } entrylk; - - struct { - fop_entrylk_cbk_t fn; - int32_t op_ret, op_errno; - } entrylk_cbk; - - /* fentrylk */ - struct { - fop_fentrylk_t fn; - fd_t *fd; - const char *volume; - const char *name; - entrylk_cmd cmd; - entrylk_type type; - } fentrylk; - - struct { - fop_fentrylk_cbk_t fn; - int32_t op_ret, op_errno; - } fentrylk_cbk; - - /* readdir */ - struct { - fop_readdir_t fn; - fd_t *fd; - size_t size; - off_t off; - } readdir; - struct { - fop_readdir_cbk_t fn; - int32_t op_ret, op_errno; - gf_dirent_t entries; - } readdir_cbk; - - /* readdirp */ - struct { - fop_readdirp_t fn; - fd_t *fd; - size_t size; - off_t off; - } readdirp; - struct { - fop_readdirp_cbk_t fn; - int32_t op_ret, op_errno; - gf_dirent_t entries; - } readdirp_cbk; - - /* rchecksum */ - struct { - fop_rchecksum_t fn; - fd_t *fd; - off_t offset; - int32_t len; - } rchecksum; - struct { - fop_rchecksum_cbk_t fn; - int32_t op_ret, op_errno; - uint32_t weak_checksum; - uint8_t *strong_checksum; - } rchecksum_cbk; - - /* xattrop */ - struct { - fop_xattrop_t fn; - loc_t loc; - gf_xattrop_flags_t optype; - dict_t *xattr; - } xattrop; - struct { - fop_xattrop_cbk_t fn; - int32_t op_ret; - int32_t op_errno; - dict_t *xattr; - } xattrop_cbk; - - /* fxattrop */ - struct { - fop_fxattrop_t fn; - fd_t *fd; - gf_xattrop_flags_t optype; - dict_t *xattr; - } fxattrop; - struct { - fop_fxattrop_cbk_t fn; - int32_t op_ret; - int32_t op_errno; - dict_t *xattr; - } fxattrop_cbk; - - /* setattr */ - struct { - fop_setattr_t fn; - loc_t loc; - struct iatt stbuf; - int32_t valid; - } setattr; - struct { - fop_setattr_cbk_t fn; - int32_t op_ret; - int32_t op_errno; - struct iatt statpre; - struct iatt statpost; - } setattr_cbk; - - /* fsetattr */ - struct { - fop_fsetattr_t fn; - fd_t *fd; - struct iatt stbuf; - int32_t valid; - } fsetattr; - struct { - fop_fsetattr_cbk_t fn; - int32_t op_ret; - int32_t op_errno; - struct iatt statpre; - struct iatt statpost; - } fsetattr_cbk; + fop_lookup_t lookup; + fop_stat_t stat; + fop_fstat_t fstat; + fop_truncate_t truncate; + fop_ftruncate_t ftruncate; + fop_access_t access; + fop_readlink_t readlink; + fop_mknod_t mknod; + fop_mkdir_t mkdir; + fop_unlink_t unlink; + fop_rmdir_t rmdir; + fop_symlink_t symlink; + fop_rename_t rename; + fop_link_t link; + fop_create_t create; + fop_open_t open; + fop_readv_t readv; + fop_writev_t writev; + fop_flush_t flush; + fop_fsync_t fsync; + fop_opendir_t opendir; + fop_fsyncdir_t fsyncdir; + fop_statfs_t statfs; + fop_setxattr_t setxattr; + fop_getxattr_t getxattr; + fop_fgetxattr_t fgetxattr; + fop_fsetxattr_t fsetxattr; + fop_removexattr_t removexattr; + fop_fremovexattr_t fremovexattr; + fop_lk_t lk; + fop_inodelk_t inodelk; + fop_finodelk_t finodelk; + fop_entrylk_t entrylk; + fop_fentrylk_t fentrylk; + fop_readdir_t readdir; + fop_readdirp_t readdirp; + fop_rchecksum_t rchecksum; + fop_xattrop_t xattrop; + fop_fxattrop_t fxattrop; + fop_setattr_t setattr; + fop_fsetattr_t fsetattr; + } fn; + union { + fop_lookup_cbk_t lookup; + fop_stat_cbk_t stat; + fop_fstat_cbk_t fstat; + fop_truncate_cbk_t truncate; + fop_ftruncate_cbk_t ftruncate; + fop_access_cbk_t access; + fop_readlink_cbk_t readlink; + fop_mknod_cbk_t mknod; + fop_mkdir_cbk_t mkdir; + fop_unlink_cbk_t unlink; + fop_rmdir_cbk_t rmdir; + fop_symlink_cbk_t symlink; + fop_rename_cbk_t rename; + fop_link_cbk_t link; + fop_create_cbk_t create; + fop_open_cbk_t open; + fop_readv_cbk_t readv; + fop_writev_cbk_t writev; + fop_flush_cbk_t flush; + fop_fsync_cbk_t fsync; + fop_opendir_cbk_t opendir; + fop_fsyncdir_cbk_t fsyncdir; + fop_statfs_cbk_t statfs; + fop_setxattr_cbk_t setxattr; + fop_getxattr_cbk_t getxattr; + fop_fgetxattr_cbk_t fgetxattr; + fop_fsetxattr_cbk_t fsetxattr; + fop_removexattr_cbk_t removexattr; + fop_fremovexattr_cbk_t fremovexattr; + fop_lk_cbk_t lk; + fop_inodelk_cbk_t inodelk; + fop_finodelk_cbk_t finodelk; + fop_entrylk_cbk_t entrylk; + fop_fentrylk_cbk_t fentrylk; + fop_readdir_cbk_t readdir; + fop_readdirp_cbk_t readdirp; + fop_rchecksum_cbk_t rchecksum; + fop_xattrop_cbk_t xattrop; + fop_fxattrop_cbk_t fxattrop; + fop_setattr_cbk_t setattr; + fop_fsetattr_cbk_t fsetattr; + } fn_cbk; + + struct { + loc_t loc; // @old in rename(), link() + loc_t loc2; // @new in rename(), link() + fd_t *fd; + off_t offset; + int mask; + size_t size; + mode_t mode; + dev_t rdev; + mode_t umask; + int xflag; + int flags; + const char *linkname; + struct iovec *vector; + int count; + struct iobref *iobref; + int datasync; + dict_t *xattr; + const char *name; + int cmd; + struct gf_flock lock; + const char *volume; + entrylk_cmd entrylkcmd; + entrylk_type entrylktype; + gf_xattrop_flags_t optype; + int valid; + struct iatt stat; + dict_t *xdata; } args; + + struct { + int op_ret; + int op_errno; + inode_t *inode; + struct iatt stat; + struct iatt prestat; + struct iatt poststat; + struct iatt preparent; // @preoldparent in rename_cbk + struct iatt postparent; // @postoldparent in rename_cbk + struct iatt preparent2; // @prenewparent in rename_cbk + struct iatt postparent2; // @postnewparent in rename_cbk + const char *buf; + struct iovec *vector; + int count; + struct iobref *iobref; + fd_t *fd; + struct statvfs statvfs; + dict_t *xattr; + struct gf_flock lock; + gf_dirent_t entries; + uint32_t weak_checksum; + uint8_t *strong_checksum; + dict_t *xdata; + } args_cbk; } call_stub_t; + call_stub_t * fop_lookup_stub (call_frame_t *frame, fop_lookup_t fn, @@ -1131,4 +715,5 @@ fop_fsetattr_cbk_stub (call_frame_t *frame, void call_resume (call_stub_t *stub); void call_stub_destroy (call_stub_t *stub); +void call_unwind_error (call_stub_t *stub, int op_ret, int op_errno); #endif diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index b0d984ea2ef..7c2cb467ce9 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -449,8 +449,8 @@ wb_enqueue_common (wb_inode_t *wb_inode, call_stub_t *stub, int tempted) req->ordering.tempted = tempted; if (stub->fop == GF_FOP_WRITE) { - req->write_size = iov_length (stub->args.writev.vector, - stub->args.writev.count); + req->write_size = iov_length (stub->args.vector, + stub->args.count); /* req->write_size can change as we collapse small writes. But the window needs to grow @@ -466,7 +466,7 @@ wb_enqueue_common (wb_inode_t *wb_inode, call_stub_t *stub, int tempted) req->op_ret = req->write_size; req->op_errno = 0; - if (stub->args.writev.fd->flags & O_APPEND) + if (stub->args.fd->flags & O_APPEND) req->ordering.append = 1; } @@ -474,28 +474,28 @@ wb_enqueue_common (wb_inode_t *wb_inode, call_stub_t *stub, int tempted) switch (stub->fop) { case GF_FOP_WRITE: - req->ordering.off = stub->args.writev.off; + req->ordering.off = stub->args.offset; req->ordering.size = req->write_size; - req->fd = fd_ref (stub->args.writev.fd); + req->fd = fd_ref (stub->args.fd); break; case GF_FOP_READ: - req->ordering.off = stub->args.readv.off; - req->ordering.size = stub->args.readv.size; + req->ordering.off = stub->args.offset; + req->ordering.size = stub->args.size; - req->fd = fd_ref (stub->args.readv.fd); + req->fd = fd_ref (stub->args.fd); break; case GF_FOP_TRUNCATE: - req->ordering.off = stub->args.truncate.off; + req->ordering.off = stub->args.offset; req->ordering.size = 0; /* till infinity */ break; case GF_FOP_FTRUNCATE: - req->ordering.off = stub->args.ftruncate.off; + req->ordering.off = stub->args.offset; req->ordering.size = 0; /* till infinity */ - req->fd = fd_ref (stub->args.ftruncate.fd); + req->fd = fd_ref (stub->args.fd); break; default: @@ -708,9 +708,9 @@ wb_fulfill_cbk (call_frame_t *frame, void *cookie, xlator_t *this, #define WB_IOV_LOAD(vec, cnt, req, head) do { \ - memcpy (&vec[cnt], req->stub->args.writev.vector, \ - (req->stub->args.writev.count * sizeof(vec[0]))); \ - cnt += req->stub->args.writev.count; \ + memcpy (&vec[cnt], req->stub->args.vector, \ + (req->stub->args.count * sizeof(vec[0]))); \ + cnt += req->stub->args.count; \ head->total_size += req->write_size; \ } while (0) @@ -736,8 +736,8 @@ wb_fulfill_head (wb_inode_t *wb_inode, wb_request_t *head) list_for_each_entry (req, &head->winds, winds) { WB_IOV_LOAD (vector, count, req, head); - iobref_merge (head->stub->args.writev.iobref, - req->stub->args.writev.iobref); + iobref_merge (head->stub->args.iobref, + req->stub->args.iobref); } if (wb_fd_err (head->fd, this, NULL)) { @@ -761,9 +761,9 @@ wb_fulfill_head (wb_inode_t *wb_inode, wb_request_t *head) STACK_WIND (frame, wb_fulfill_cbk, FIRST_CHILD (frame->this), FIRST_CHILD (frame->this)->fops->writev, head->fd, vector, count, - head->stub->args.writev.off, - head->stub->args.writev.flags, - head->stub->args.writev.iobref, NULL); + head->stub->args.offset, + head->stub->args.flags, + head->stub->args.iobref, NULL); return; err: @@ -782,7 +782,7 @@ err: if (head) \ wb_fulfill_head (wb_inode, head); \ head = req; \ - expected_offset = req->stub->args.writev.off + \ + expected_offset = req->stub->args.offset + \ req->write_size; \ curr_aggregate = 0; \ vector_count = 0; \ @@ -820,7 +820,7 @@ wb_fulfill (wb_inode_t *wb_inode, list_head_t *liabilities) continue; } - if (expected_offset != req->stub->args.writev.off) { + if (expected_offset != req->stub->args.offset) { NEXT_HEAD (head, req); continue; } @@ -830,7 +830,7 @@ wb_fulfill (wb_inode_t *wb_inode, list_head_t *liabilities) continue; } - if (vector_count + req->stub->args.writev.count > + if (vector_count + req->stub->args.count > MAX_VECTOR_COUNT) { NEXT_HEAD (head, req); continue; @@ -838,7 +838,7 @@ wb_fulfill (wb_inode_t *wb_inode, list_head_t *liabilities) list_add_tail (&req->winds, &head->winds); curr_aggregate += req->write_size; - vector_count += req->stub->args.writev.count; + vector_count += req->stub->args.count; } if (head) @@ -912,10 +912,10 @@ __wb_collapse_small_writes (wb_request_t *holder, wb_request_t *req) size_t req_len = 0; if (!holder->iobref) { - holder_len = iov_length (holder->stub->args.writev.vector, - holder->stub->args.writev.count); - req_len = iov_length (req->stub->args.writev.vector, - req->stub->args.writev.count); + holder_len = iov_length (holder->stub->args.vector, + holder->stub->args.count); + req_len = iov_length (req->stub->args.vector, + req->stub->args.count); required_size = max ((THIS->ctx->page_size), (holder_len + req_len)); @@ -941,25 +941,25 @@ __wb_collapse_small_writes (wb_request_t *holder, wb_request_t *req) goto out; } - iov_unload (iobuf->ptr, holder->stub->args.writev.vector, - holder->stub->args.writev.count); - holder->stub->args.writev.vector[0].iov_base = iobuf->ptr; - holder->stub->args.writev.count = 1; + iov_unload (iobuf->ptr, holder->stub->args.vector, + holder->stub->args.count); + holder->stub->args.vector[0].iov_base = iobuf->ptr; + holder->stub->args.count = 1; - iobref_unref (holder->stub->args.writev.iobref); - holder->stub->args.writev.iobref = iobref; + iobref_unref (holder->stub->args.iobref); + holder->stub->args.iobref = iobref; iobuf_unref (iobuf); holder->iobref = iobref_ref (iobref); } - ptr = holder->stub->args.writev.vector[0].iov_base + holder->write_size; + ptr = holder->stub->args.vector[0].iov_base + holder->write_size; - iov_unload (ptr, req->stub->args.writev.vector, - req->stub->args.writev.count); + iov_unload (ptr, req->stub->args.vector, + req->stub->args.count); - holder->stub->args.writev.vector[0].iov_len += req->write_size; + holder->stub->args.vector[0].iov_len += req->write_size; holder->write_size += req->write_size; holder->ordering.size += req->write_size; @@ -1009,10 +1009,10 @@ __wb_preprocess_winds (wb_inode_t *wb_inode) continue; } - offset_expected = holder->stub->args.writev.off + offset_expected = holder->stub->args.offset + holder->write_size; - if (req->stub->args.writev.off != offset_expected) { + if (req->stub->args.offset != offset_expected) { holder->ordering.go = 1; holder = req; continue; @@ -1776,7 +1776,7 @@ __wb_dump_requests (struct list_head *head, char *prefix) req->write_size); gf_proc_dump_write ("offset", "%"PRId64, - req->stub->args.writev.off); + req->stub->args.offset); flag = req->ordering.lied; gf_proc_dump_write ("lied", "%d", flag); |