libglusterfs: Implement cluster-syncop
This patch implements syncop equivalent for cluster of xlators. The xlators on which the fop needs to be performed is taken in input arguments to the functions and the responses are gathered and provided as the output. This idea is taken from afr-v2 self-heal implementation by Avati. Change-Id: I2b568f4340cf921a65054b8ab0df7edc4478b5ca BUG: 1213358 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/10240 Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> Tested-by: NetBSD Build System Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
This commit is contained in:
parent
3514f465ef
commit
557ea3781e
@ -22,7 +22,8 @@ libglusterfs_la_SOURCES = dict.c xlator.c logging.c \
|
||||
$(CONTRIBDIR)/rbtree/rb.c rbthash.c store.c latency.c \
|
||||
graph.c syncop.c graph-print.c trie.c run.c options.c fd-lk.c \
|
||||
circ-buff.c event-history.c gidcache.c ctx.c client_t.c event-poll.c \
|
||||
event-epoll.c syncop-utils.c $(CONTRIBDIR)/libgen/basename_r.c \
|
||||
event-epoll.c syncop-utils.c cluster-syncop.c \
|
||||
$(CONTRIBDIR)/libgen/basename_r.c \
|
||||
$(CONTRIBDIR)/libgen/dirname_r.c $(CONTRIBDIR)/stdlib/gf_mkostemp.c \
|
||||
strfd.c parse-utils.c $(CONTRIBDIR)/mount/mntent.c \
|
||||
$(CONTRIBDIR)/libexecinfo/execinfo.c quota-common-utils.c rot-buffs.c \
|
||||
@ -38,7 +39,8 @@ noinst_HEADERS = common-utils.h defaults.h dict.h glusterfs.h hashfn.h timespec.
|
||||
fd.h revision.h compat-errno.h event.h mem-pool.h byte-order.h \
|
||||
gf-dirent.h locking.h syscall.h iobuf.h globals.h statedump.h \
|
||||
checksum.h daemon.h $(CONTRIBDIR)/rbtree/rb.h store.h\
|
||||
rbthash.h iatt.h latency.h mem-types.h syncop.h graph-utils.h trie.h \
|
||||
rbthash.h iatt.h latency.h mem-types.h syncop.h cluster-syncop.h \
|
||||
graph-utils.h trie.h \
|
||||
run.h options.h lkowner.h fd-lk.h circ-buff.h event-history.h \
|
||||
gidcache.h client_t.h glusterfs-acl.h glfs-message-id.h \
|
||||
template-component-messages.h strfd.h syncop-utils.h parse-utils.h \
|
||||
|
@ -81,16 +81,8 @@ fop_lookup_cbk_stub (call_frame_t *frame, fop_lookup_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.lookup = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (inode)
|
||||
stub->args_cbk.inode = inode_ref (inode);
|
||||
if (buf)
|
||||
stub->args_cbk.stat = *buf;
|
||||
if (postparent)
|
||||
stub->args_cbk.postparent = *postparent;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_lookup_cbk_store (&stub->args_cbk, op_ret, op_errno, inode,
|
||||
buf, xdata, postparent);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -130,12 +122,8 @@ fop_stat_cbk_stub (call_frame_t *frame, fop_stat_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
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_cbk.stat = *buf;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_stat_cbk_store (&stub->args_cbk, op_ret, op_errno, buf,
|
||||
xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -176,12 +164,8 @@ fop_fstat_cbk_stub (call_frame_t *frame, fop_fstat_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.fstat = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (buf)
|
||||
stub->args_cbk.stat = *buf;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_fstat_cbk_store (&stub->args_cbk, op_ret, op_errno, buf,
|
||||
xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -222,14 +206,8 @@ fop_truncate_cbk_stub (call_frame_t *frame, fop_truncate_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.truncate = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (prebuf)
|
||||
stub->args_cbk.prestat = *prebuf;
|
||||
if (postbuf)
|
||||
stub->args_cbk.poststat = *postbuf;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_truncate_cbk_store (&stub->args_cbk, op_ret, op_errno,
|
||||
prebuf, postbuf, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -271,14 +249,8 @@ fop_ftruncate_cbk_stub (call_frame_t *frame, fop_ftruncate_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.ftruncate = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (prebuf)
|
||||
stub->args_cbk.prestat = *prebuf;
|
||||
if (postbuf)
|
||||
stub->args_cbk.poststat = *postbuf;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_ftruncate_cbk_store (&stub->args_cbk, op_ret, op_errno,
|
||||
prebuf, postbuf, xdata);
|
||||
|
||||
out:
|
||||
return stub;
|
||||
@ -319,10 +291,7 @@ fop_access_cbk_stub (call_frame_t *frame, fop_access_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.access = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_access_cbk_store (&stub->args_cbk, op_ret, op_errno, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -363,14 +332,8 @@ fop_readlink_cbk_stub (call_frame_t *frame, fop_readlink_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.readlink = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (path)
|
||||
stub->args_cbk.buf = gf_strdup (path);
|
||||
if (stbuf)
|
||||
stub->args_cbk.stat = *stbuf;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_readlink_cbk_store (&stub->args_cbk, op_ret, op_errno, path,
|
||||
stbuf, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -414,19 +377,8 @@ fop_mknod_cbk_stub (call_frame_t *frame, fop_mknod_cbk_t fn, int32_t op_ret,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.mknod = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (inode)
|
||||
stub->args_cbk.inode = inode_ref (inode);
|
||||
if (buf)
|
||||
stub->args_cbk.stat = *buf;
|
||||
if (preparent)
|
||||
stub->args_cbk.preparent = *preparent;
|
||||
if (postparent)
|
||||
stub->args_cbk.postparent = *postparent;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
|
||||
args_mknod_cbk_store (&stub->args_cbk, op_ret, op_errno, inode, buf,
|
||||
preparent, postparent, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -470,18 +422,8 @@ fop_mkdir_cbk_stub (call_frame_t *frame, fop_mkdir_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.mkdir = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (inode)
|
||||
stub->args_cbk.inode = inode_ref (inode);
|
||||
if (buf)
|
||||
stub->args_cbk.stat = *buf;
|
||||
if (preparent)
|
||||
stub->args_cbk.preparent = *preparent;
|
||||
if (postparent)
|
||||
stub->args_cbk.postparent = *postparent;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_mkdir_cbk_store (&stub->args_cbk, op_ret, op_errno, inode,
|
||||
buf, preparent, postparent, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -523,14 +465,8 @@ fop_unlink_cbk_stub (call_frame_t *frame, fop_unlink_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.unlink = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (preparent)
|
||||
stub->args_cbk.preparent = *preparent;
|
||||
if (postparent)
|
||||
stub->args_cbk.postparent = *postparent;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_unlink_cbk_store (&stub->args_cbk, op_ret, op_errno, preparent,
|
||||
postparent, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -573,14 +509,8 @@ fop_rmdir_cbk_stub (call_frame_t *frame, fop_rmdir_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.rmdir = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (preparent)
|
||||
stub->args_cbk.preparent = *preparent;
|
||||
if (postparent)
|
||||
stub->args_cbk.postparent = *postparent;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_rmdir_cbk_store (&stub->args_cbk, op_ret, op_errno, preparent,
|
||||
postparent, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -625,18 +555,8 @@ fop_symlink_cbk_stub (call_frame_t *frame, fop_symlink_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.symlink = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (inode)
|
||||
stub->args_cbk.inode = inode_ref (inode);
|
||||
if (buf)
|
||||
stub->args_cbk.stat = *buf;
|
||||
if (preparent)
|
||||
stub->args_cbk.preparent = *preparent;
|
||||
if (postparent)
|
||||
stub->args_cbk.postparent = *postparent;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_symlink_cbk_store (&stub->args_cbk, op_ret, op_errno, inode, buf,
|
||||
preparent, postparent, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -680,20 +600,9 @@ fop_rename_cbk_stub (call_frame_t *frame, fop_rename_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.rename = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (buf)
|
||||
stub->args_cbk.stat = *buf;
|
||||
if (preoldparent)
|
||||
stub->args_cbk.preparent = *preoldparent;
|
||||
if (postoldparent)
|
||||
stub->args_cbk.postparent = *postoldparent;
|
||||
if (prenewparent)
|
||||
stub->args_cbk.preparent2 = *prenewparent;
|
||||
if (postnewparent)
|
||||
stub->args_cbk.postparent2 = *postnewparent;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_rename_cbk_store (&stub->args_cbk, op_ret, op_errno, buf,
|
||||
preoldparent, postoldparent, prenewparent,
|
||||
postnewparent, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -738,18 +647,8 @@ fop_link_cbk_stub (call_frame_t *frame, fop_link_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.link = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (inode)
|
||||
stub->args_cbk.inode = inode_ref (inode);
|
||||
if (buf)
|
||||
stub->args_cbk.stat = *buf;
|
||||
if (preparent)
|
||||
stub->args_cbk.preparent = *preparent;
|
||||
if (postparent)
|
||||
stub->args_cbk.postparent = *postparent;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_link_cbk_store (&stub->args_cbk, op_ret, op_errno,
|
||||
inode, buf, preparent, postparent, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -797,20 +696,8 @@ fop_create_cbk_stub (call_frame_t *frame, fop_create_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.create = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (fd)
|
||||
stub->args_cbk.fd = fd_ref (fd);
|
||||
if (inode)
|
||||
stub->args_cbk.inode = inode_ref (inode);
|
||||
if (buf)
|
||||
stub->args_cbk.stat = *buf;
|
||||
if (preparent)
|
||||
stub->args_cbk.preparent = *preparent;
|
||||
if (postparent)
|
||||
stub->args_cbk.postparent = *postparent;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_create_cbk_store (&stub->args_cbk, op_ret, op_errno, fd, inode,
|
||||
buf, preparent, postparent, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -853,12 +740,7 @@ fop_open_cbk_stub (call_frame_t *frame, fop_open_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.open = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (fd)
|
||||
stub->args_cbk.fd = fd_ref (fd);
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_open_cbk_store (&stub->args_cbk, op_ret, op_errno, fd, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -904,16 +786,8 @@ fop_readv_cbk_stub (call_frame_t *frame, fop_readv_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
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_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->args_cbk.xdata = dict_ref (xdata);
|
||||
args_readv_cbk_store (&stub->args_cbk, op_ret, op_errno, vector,
|
||||
count, stbuf, iobref, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -960,14 +834,8 @@ fop_writev_cbk_stub (call_frame_t *frame, fop_writev_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
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_cbk.poststat = *postbuf;
|
||||
if (prebuf)
|
||||
stub->args_cbk.prestat = *prebuf;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_writev_cbk_store (&stub->args_cbk, op_ret, op_errno,
|
||||
prebuf, postbuf, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1006,10 +874,7 @@ fop_flush_cbk_stub (call_frame_t *frame, fop_flush_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.flush = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_flush_cbk_store (&stub->args_cbk, op_ret, op_errno, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1050,14 +915,8 @@ fop_fsync_cbk_stub (call_frame_t *frame, fop_fsync_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.fsync = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (prebuf)
|
||||
stub->args_cbk.prestat = *prebuf;
|
||||
if (postbuf)
|
||||
stub->args_cbk.poststat = *postbuf;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_fsync_cbk_store (&stub->args_cbk, op_ret, op_errno,
|
||||
prebuf, postbuf, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1099,13 +958,7 @@ fop_opendir_cbk_stub (call_frame_t *frame, fop_opendir_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.opendir = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
|
||||
if (fd)
|
||||
stub->args_cbk.fd = fd_ref (fd);
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_opendir_cbk_store (&stub->args_cbk, op_ret, op_errno, fd, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1145,10 +998,7 @@ fop_fsyncdir_cbk_stub (call_frame_t *frame, fop_fsyncdir_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.fsyncdir = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_fsyncdir_cbk_store (&stub->args_cbk, op_ret, op_errno, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1188,12 +1038,7 @@ fop_statfs_cbk_stub (call_frame_t *frame, fop_statfs_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
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_cbk.statvfs = *buf;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_statfs_cbk_store (&stub->args_cbk, op_ret, op_errno, buf, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1239,10 +1084,7 @@ fop_setxattr_cbk_stub (call_frame_t *frame,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.setxattr = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_setxattr_cbk_store (&stub->args_cbk, op_ret, op_errno, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1285,13 +1127,8 @@ fop_getxattr_cbk_stub (call_frame_t *frame, fop_getxattr_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.getxattr = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
/* TODO */
|
||||
if (dict)
|
||||
stub->args_cbk.xattr = dict_ref (dict);
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_getxattr_cbk_store (&stub->args_cbk, op_ret, op_errno, dict,
|
||||
xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1334,10 +1171,7 @@ fop_fsetxattr_cbk_stub (call_frame_t *frame, fop_fsetxattr_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.fsetxattr = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_fsetxattr_cbk_store (&stub->args_cbk, op_ret, op_errno, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1380,13 +1214,8 @@ fop_fgetxattr_cbk_stub (call_frame_t *frame, fop_fgetxattr_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.fgetxattr = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
|
||||
if (dict)
|
||||
stub->args_cbk.xattr = dict_ref (dict);
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_fgetxattr_cbk_store (&stub->args_cbk, op_ret, op_errno, dict,
|
||||
xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1427,10 +1256,7 @@ fop_removexattr_cbk_stub (call_frame_t *frame, fop_removexattr_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.removexattr = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_removexattr_cbk_store (&stub->args_cbk, op_ret, op_errno, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1471,10 +1297,7 @@ fop_fremovexattr_cbk_stub (call_frame_t *frame, fop_fremovexattr_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.fremovexattr = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_fremovexattr_cbk_store (&stub->args_cbk, op_ret, op_errno, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1518,12 +1341,7 @@ fop_lk_cbk_stub (call_frame_t *frame, fop_lk_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
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_cbk.lock = *lock;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_lk_cbk_store (&stub->args_cbk, op_ret, op_errno, lock, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1569,11 +1387,7 @@ fop_inodelk_cbk_stub (call_frame_t *frame, fop_inodelk_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.inodelk = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_inodelk_cbk_store (&stub->args_cbk, op_ret, op_errno, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1622,11 +1436,7 @@ fop_finodelk_cbk_stub (call_frame_t *frame, fop_inodelk_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.finodelk = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_finodelk_cbk_store (&stub->args_cbk, op_ret, op_errno, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1676,11 +1486,7 @@ fop_entrylk_cbk_stub (call_frame_t *frame, fop_entrylk_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.entrylk = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_entrylk_cbk_store (&stub->args_cbk, op_ret, op_errno, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1729,11 +1535,7 @@ fop_fentrylk_cbk_stub (call_frame_t *frame, fop_fentrylk_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.fentrylk = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_fentrylk_cbk_store (&stub->args_cbk, op_ret, op_errno, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1745,7 +1547,6 @@ fop_readdirp_cbk_stub (call_frame_t *frame, fop_readdirp_cbk_t fn,
|
||||
gf_dirent_t *entries, dict_t *xdata)
|
||||
{
|
||||
call_stub_t *stub = NULL;
|
||||
gf_dirent_t *stub_entry = NULL, *entry = NULL;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
|
||||
|
||||
@ -1753,27 +1554,8 @@ fop_readdirp_cbk_stub (call_frame_t *frame, fop_readdirp_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.readdirp = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", entries, out);
|
||||
|
||||
if (op_ret > 0) {
|
||||
list_for_each_entry (entry, &entries->list, list) {
|
||||
stub_entry = gf_dirent_for_name (entry->d_name);
|
||||
if (!stub_entry)
|
||||
goto out;
|
||||
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_cbk.entries.list);
|
||||
}
|
||||
}
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_readdirp_cbk_store (&stub->args_cbk, op_ret, op_errno, entries,
|
||||
xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1785,7 +1567,6 @@ fop_readdir_cbk_stub (call_frame_t *frame, fop_readdir_cbk_t fn,
|
||||
gf_dirent_t *entries, dict_t *xdata)
|
||||
{
|
||||
call_stub_t *stub = NULL;
|
||||
gf_dirent_t *stub_entry = NULL, *entry = NULL;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
|
||||
|
||||
@ -1793,25 +1574,8 @@ fop_readdir_cbk_stub (call_frame_t *frame, fop_readdir_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.readdir = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", entries, out);
|
||||
|
||||
if (op_ret > 0) {
|
||||
list_for_each_entry (entry, &entries->list, list) {
|
||||
stub_entry = gf_dirent_for_name (entry->d_name);
|
||||
if (!stub_entry)
|
||||
goto out;
|
||||
stub_entry->d_off = entry->d_off;
|
||||
stub_entry->d_ino = entry->d_ino;
|
||||
|
||||
list_add_tail (&stub_entry->list,
|
||||
&stub->args_cbk.entries.list);
|
||||
}
|
||||
}
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_readdir_cbk_store (&stub->args_cbk, op_ret, op_errno, entries,
|
||||
xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1896,26 +1660,16 @@ fop_rchecksum_cbk_stub (call_frame_t *frame, fop_rchecksum_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
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_cbk.weak_checksum =
|
||||
weak_checksum;
|
||||
stub->args_cbk.strong_checksum =
|
||||
memdup (strong_checksum, MD5_DIGEST_LENGTH);
|
||||
}
|
||||
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_rchecksum_cbk_store (&stub->args_cbk, op_ret, op_errno,
|
||||
weak_checksum, strong_checksum, 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 *xattr, dict_t *xdata)
|
||||
{
|
||||
call_stub_t *stub = NULL;
|
||||
|
||||
@ -1925,11 +1679,8 @@ fop_xattrop_cbk_stub (call_frame_t *frame, fop_xattrop_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.xattrop = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_xattrop_cbk_store (&stub->args_cbk, op_ret, op_errno, xattr,
|
||||
xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -1947,13 +1698,8 @@ fop_fxattrop_cbk_stub (call_frame_t *frame, fop_fxattrop_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.fxattrop = fn;
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
if (xattr)
|
||||
stub->args_cbk.xattr = dict_ref (xattr);
|
||||
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_xattrop_cbk_store (&stub->args_cbk, op_ret, op_errno, xattr,
|
||||
xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -2027,17 +1773,8 @@ fop_setattr_cbk_stub (call_frame_t *frame, fop_setattr_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.setattr = fn;
|
||||
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
|
||||
if (statpre)
|
||||
stub->args_cbk.prestat = *statpre;
|
||||
if (statpost)
|
||||
stub->args_cbk.poststat = *statpost;
|
||||
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_setattr_cbk_store (&stub->args_cbk, op_ret, op_errno, statpre,
|
||||
statpost, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -2057,16 +1794,8 @@ fop_fsetattr_cbk_stub (call_frame_t *frame, fop_setattr_cbk_t fn,
|
||||
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
|
||||
|
||||
stub->fn_cbk.fsetattr = fn;
|
||||
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
|
||||
if (statpre)
|
||||
stub->args_cbk.prestat = *statpre;
|
||||
if (statpost)
|
||||
stub->args_cbk.poststat = *statpost;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_fsetattr_cbk_store (&stub->args_cbk, op_ret, op_errno, statpre,
|
||||
statpost, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -2145,15 +1874,8 @@ fop_fallocate_cbk_stub(call_frame_t *frame, fop_fallocate_cbk_t fn,
|
||||
|
||||
stub->fn_cbk.fallocate = fn;
|
||||
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
|
||||
if (statpre)
|
||||
stub->args_cbk.prestat = *statpre;
|
||||
if (statpost)
|
||||
stub->args_cbk.poststat = *statpost;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_fallocate_cbk_store (&stub->args_cbk, op_ret, op_errno, statpre,
|
||||
statpost, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -2201,15 +1923,8 @@ fop_discard_cbk_stub(call_frame_t *frame, fop_discard_cbk_t fn,
|
||||
|
||||
stub->fn_cbk.discard = fn;
|
||||
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
|
||||
if (statpre)
|
||||
stub->args_cbk.prestat = *statpre;
|
||||
if (statpost)
|
||||
stub->args_cbk.poststat = *statpost;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_discard_cbk_store (&stub->args_cbk, op_ret, op_errno, statpre,
|
||||
statpost, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -2256,15 +1971,8 @@ fop_zerofill_cbk_stub(call_frame_t *frame, fop_zerofill_cbk_t fn,
|
||||
|
||||
stub->fn_cbk.zerofill = fn;
|
||||
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
|
||||
if (statpre)
|
||||
stub->args_cbk.prestat = *statpre;
|
||||
if (statpost)
|
||||
stub->args_cbk.poststat = *statpost;
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_zerofill_cbk_store (&stub->args_cbk, op_ret, op_errno, statpre,
|
||||
statpost, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -2310,11 +2018,7 @@ fop_ipc_cbk_stub (call_frame_t *frame, fop_ipc_cbk_t fn,
|
||||
|
||||
stub->fn_cbk.ipc = fn;
|
||||
|
||||
stub->args_cbk.op_ret = op_ret;
|
||||
stub->args_cbk.op_errno = op_errno;
|
||||
|
||||
if (xdata)
|
||||
stub->args_cbk.xdata = dict_ref (xdata);
|
||||
args_ipc_cbk_store (&stub->args_cbk, op_ret, op_errno, xdata);
|
||||
out:
|
||||
return stub;
|
||||
}
|
||||
@ -2833,29 +2537,7 @@ call_stub_wipe_args (call_stub_t *stub)
|
||||
static void
|
||||
call_stub_wipe_args_cbk (call_stub_t *stub)
|
||||
{
|
||||
if (stub->args_cbk.inode)
|
||||
inode_unref (stub->args_cbk.inode);
|
||||
|
||||
GF_FREE ((char *)stub->args_cbk.buf);
|
||||
|
||||
GF_FREE (stub->args_cbk.vector);
|
||||
|
||||
if (stub->args_cbk.iobref)
|
||||
iobref_unref (stub->args_cbk.iobref);
|
||||
|
||||
if (stub->args_cbk.fd)
|
||||
fd_unref (stub->args_cbk.fd);
|
||||
|
||||
if (stub->args_cbk.xattr)
|
||||
dict_unref (stub->args_cbk.xattr);
|
||||
|
||||
GF_FREE (stub->args_cbk.strong_checksum);
|
||||
|
||||
if (stub->args_cbk.xdata)
|
||||
dict_unref (stub->args_cbk.xdata);
|
||||
|
||||
if (!list_empty (&stub->args_cbk.entries.list))
|
||||
gf_dirent_free (&stub->args_cbk.entries);
|
||||
args_cbk_wipe (&stub->args_cbk);
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#endif
|
||||
|
||||
#include "xlator.h"
|
||||
#include "defaults.h"
|
||||
#include "stack.h"
|
||||
#include "list.h"
|
||||
|
||||
@ -153,30 +154,7 @@ typedef struct {
|
||||
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;
|
||||
uint32_t weak_checksum;
|
||||
uint8_t *strong_checksum;
|
||||
dict_t *xdata;
|
||||
gf_dirent_t entries;
|
||||
} args_cbk;
|
||||
default_args_cbk_t args_cbk;
|
||||
} call_stub_t;
|
||||
|
||||
|
||||
|
1184
libglusterfs/src/cluster-syncop.c
Normal file
1184
libglusterfs/src/cluster-syncop.c
Normal file
File diff suppressed because it is too large
Load Diff
126
libglusterfs/src/cluster-syncop.h
Normal file
126
libglusterfs/src/cluster-syncop.h
Normal file
@ -0,0 +1,126 @@
|
||||
/*
|
||||
Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
|
||||
This file is part of GlusterFS.
|
||||
|
||||
This file is licensed to you under your choice of the GNU Lesser
|
||||
General Public License, version 3 or any later version (LGPLv3 or
|
||||
later), or the GNU General Public License, version 2 (GPLv2), in all
|
||||
cases as published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CLUSTER_SYNCOP_H
|
||||
#define _CLUSTER_SYNCOP_H
|
||||
|
||||
#ifndef _CONFIG_H
|
||||
#define _CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "xlator.h"
|
||||
#include <sys/time.h>
|
||||
#include <pthread.h>
|
||||
#include <ucontext.h>
|
||||
#include "defaults.h"
|
||||
#include "syncop.h"
|
||||
|
||||
typedef struct cluster_local_ {
|
||||
default_args_cbk_t *replies;
|
||||
syncbarrier_t barrier;
|
||||
} cluster_local_t;
|
||||
|
||||
int32_t
|
||||
cluster_lookup (xlator_t **subvols, unsigned char *on, int numsubvols,
|
||||
default_args_cbk_t *replies, unsigned char *output,
|
||||
call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata);
|
||||
int32_t
|
||||
cluster_setattr (xlator_t **subvols, unsigned char *on, int numsubvols,
|
||||
default_args_cbk_t *replies, unsigned char *output,
|
||||
call_frame_t *frame, xlator_t *this, loc_t *loc,
|
||||
struct iatt *stbuf, int32_t valid, dict_t *xdata);
|
||||
int32_t
|
||||
cluster_getxattr (xlator_t **subvols, unsigned char *on, int numsubvols,
|
||||
default_args_cbk_t *replies, unsigned char *output,
|
||||
call_frame_t *frame, xlator_t *this, loc_t *loc,
|
||||
const char *name, dict_t *xdata);
|
||||
int32_t
|
||||
cluster_setxattr (xlator_t **subvols, unsigned char *on, int numsubvols,
|
||||
default_args_cbk_t *replies, unsigned char *output,
|
||||
call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
|
||||
int32_t flags, dict_t *xdata);
|
||||
|
||||
int
|
||||
cluster_inodelk (xlator_t **subvols, unsigned char *on, int numsubvols,
|
||||
default_args_cbk_t *replies, unsigned char *locked_on,
|
||||
call_frame_t *frame, xlator_t *this, char *dom,
|
||||
inode_t *inode, off_t off, size_t size);
|
||||
|
||||
int
|
||||
cluster_uninodelk (xlator_t **subvols, unsigned char *locked_on, int numsubvols,
|
||||
default_args_cbk_t *replies, unsigned char *output,
|
||||
call_frame_t *frame, xlator_t *this, char *dom,
|
||||
inode_t *inode, off_t off, size_t size);
|
||||
|
||||
int
|
||||
cluster_entrylk (xlator_t **subvols, unsigned char *on, int numsubvols,
|
||||
default_args_cbk_t *replies, unsigned char *locked_on,
|
||||
call_frame_t *frame, xlator_t *this, char *dom,
|
||||
inode_t *inode, const char *name);
|
||||
|
||||
int32_t
|
||||
cluster_rmdir (xlator_t **subvols, unsigned char *on, int numsubvols,
|
||||
default_args_cbk_t *replies, unsigned char *output,
|
||||
call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
|
||||
dict_t *xdata);
|
||||
|
||||
int32_t
|
||||
cluster_unlink (xlator_t **subvols, unsigned char *on, int numsubvols,
|
||||
default_args_cbk_t *replies, unsigned char *output,
|
||||
call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,
|
||||
dict_t *xdata);
|
||||
|
||||
int
|
||||
cluster_mkdir (xlator_t **subvols, unsigned char *on, int numsubvols,
|
||||
default_args_cbk_t *replies, unsigned char *output,
|
||||
call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
|
||||
mode_t umask, dict_t *xdata);
|
||||
|
||||
int32_t
|
||||
cluster_readlink (xlator_t **subvols, unsigned char *on, int numsubvols,
|
||||
default_args_cbk_t *replies, unsigned char *output,
|
||||
call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size,
|
||||
dict_t *xdata);
|
||||
|
||||
int
|
||||
cluster_symlink (xlator_t **subvols, unsigned char *on, int numsubvols,
|
||||
default_args_cbk_t *replies, unsigned char *output,
|
||||
call_frame_t *frame, xlator_t *this, const char *linkpath,
|
||||
loc_t *loc, mode_t umask, dict_t *xdata);
|
||||
|
||||
int32_t
|
||||
cluster_link (xlator_t **subvols, unsigned char *on, int numsubvols,
|
||||
default_args_cbk_t *replies, unsigned char *output,
|
||||
call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
|
||||
dict_t *xdata);
|
||||
|
||||
int
|
||||
cluster_mknod (xlator_t **subvols, unsigned char *on, int numsubvols,
|
||||
default_args_cbk_t *replies, unsigned char *output,
|
||||
call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
|
||||
dev_t rdev, mode_t umask, dict_t *xdata);
|
||||
|
||||
int
|
||||
cluster_unentrylk (xlator_t **subvols, unsigned char *locked_on, int numsubvols,
|
||||
default_args_cbk_t *replies, unsigned char *output,
|
||||
call_frame_t *frame, xlator_t *this, char *dom,
|
||||
inode_t *inode, const char *name);
|
||||
|
||||
int
|
||||
cluster_tryentrylk (xlator_t **subvols, unsigned char *on, int numsubvols,
|
||||
default_args_cbk_t *replies, unsigned char *locked_on,
|
||||
call_frame_t *frame, xlator_t *this, char *dom,
|
||||
inode_t *inode, const char *name);
|
||||
|
||||
void
|
||||
cluster_replies_wipe (default_args_cbk_t *replies, int num_subvols);
|
||||
#endif /* !_CLUSTER_SYNCOP_H */
|
@ -26,6 +26,7 @@
|
||||
#endif
|
||||
|
||||
#include "xlator.h"
|
||||
#include "defaults.h"
|
||||
|
||||
/* FAILURE_CBK function section */
|
||||
|
||||
@ -2357,3 +2358,811 @@ default_mem_acct_init (xlator_t *this)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*ARGS_ STORE section*/
|
||||
int
|
||||
args_lookup_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
inode_t *inode, struct iatt *buf,
|
||||
dict_t *xdata, struct iatt *postparent)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (inode)
|
||||
args->inode = inode_ref (inode);
|
||||
if (buf)
|
||||
args->stat = *buf;
|
||||
if (postparent)
|
||||
args->postparent = *postparent;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
args_stat_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *buf, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (op_ret == 0)
|
||||
args->stat = *buf;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_fstat_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *buf, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (buf)
|
||||
args->stat = *buf;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_truncate_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
|
||||
struct iatt *postbuf, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (prebuf)
|
||||
args->prestat = *prebuf;
|
||||
if (postbuf)
|
||||
args->poststat = *postbuf;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
args_ftruncate_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
|
||||
struct iatt *postbuf, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (prebuf)
|
||||
args->prestat = *prebuf;
|
||||
if (postbuf)
|
||||
args->poststat = *postbuf;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
args_access_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
args_readlink_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
const char *path, struct iatt *stbuf, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (path)
|
||||
args->buf = gf_strdup (path);
|
||||
if (stbuf)
|
||||
args->stat = *stbuf;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_mknod_cbk_store (default_args_cbk_t *args, int op_ret,
|
||||
int32_t op_errno, inode_t *inode, struct iatt *buf,
|
||||
struct iatt *preparent, struct iatt *postparent,
|
||||
dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (inode)
|
||||
args->inode = inode_ref (inode);
|
||||
if (buf)
|
||||
args->stat = *buf;
|
||||
if (preparent)
|
||||
args->preparent = *preparent;
|
||||
if (postparent)
|
||||
args->postparent = *postparent;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_mkdir_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, inode_t *inode,
|
||||
struct iatt *buf, struct iatt *preparent,
|
||||
struct iatt *postparent, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (inode)
|
||||
args->inode = inode_ref (inode);
|
||||
if (buf)
|
||||
args->stat = *buf;
|
||||
if (preparent)
|
||||
args->preparent = *preparent;
|
||||
if (postparent)
|
||||
args->postparent = *postparent;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_unlink_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *preparent, struct iatt *postparent,
|
||||
dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (preparent)
|
||||
args->preparent = *preparent;
|
||||
if (postparent)
|
||||
args->postparent = *postparent;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_rmdir_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *preparent, struct iatt *postparent,
|
||||
dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (preparent)
|
||||
args->preparent = *preparent;
|
||||
if (postparent)
|
||||
args->postparent = *postparent;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_symlink_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
inode_t *inode, struct iatt *buf,
|
||||
struct iatt *preparent, struct iatt *postparent,
|
||||
dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (inode)
|
||||
args->inode = inode_ref (inode);
|
||||
if (buf)
|
||||
args->stat = *buf;
|
||||
if (preparent)
|
||||
args->preparent = *preparent;
|
||||
if (postparent)
|
||||
args->postparent = *postparent;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
args_rename_cbk_store (default_args_cbk_t *args,
|
||||
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)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (buf)
|
||||
args->stat = *buf;
|
||||
if (preoldparent)
|
||||
args->preparent = *preoldparent;
|
||||
if (postoldparent)
|
||||
args->postparent = *postoldparent;
|
||||
if (prenewparent)
|
||||
args->preparent2 = *prenewparent;
|
||||
if (postnewparent)
|
||||
args->postparent2 = *postnewparent;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_link_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
inode_t *inode, struct iatt *buf,
|
||||
struct iatt *preparent, struct iatt *postparent,
|
||||
dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (inode)
|
||||
args->inode = inode_ref (inode);
|
||||
if (buf)
|
||||
args->stat = *buf;
|
||||
if (preparent)
|
||||
args->preparent = *preparent;
|
||||
if (postparent)
|
||||
args->postparent = *postparent;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_create_cbk_store (default_args_cbk_t *args,
|
||||
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)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (fd)
|
||||
args->fd = fd_ref (fd);
|
||||
if (inode)
|
||||
args->inode = inode_ref (inode);
|
||||
if (buf)
|
||||
args->stat = *buf;
|
||||
if (preparent)
|
||||
args->preparent = *preparent;
|
||||
if (postparent)
|
||||
args->postparent = *postparent;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_open_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
fd_t *fd, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (fd)
|
||||
args->fd = fd_ref (fd);
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_readv_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, struct iovec *vector,
|
||||
int32_t count, struct iatt *stbuf,
|
||||
struct iobref *iobref, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (op_ret >= 0) {
|
||||
args->vector = iov_dup (vector, count);
|
||||
args->count = count;
|
||||
args->stat = *stbuf;
|
||||
args->iobref = iobref_ref (iobref);
|
||||
}
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_writev_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (op_ret >= 0)
|
||||
args->poststat = *postbuf;
|
||||
if (prebuf)
|
||||
args->prestat = *prebuf;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
args_flush_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
args_fsync_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (prebuf)
|
||||
args->prestat = *prebuf;
|
||||
if (postbuf)
|
||||
args->poststat = *postbuf;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_opendir_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
fd_t *fd, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (fd)
|
||||
args->fd = fd_ref (fd);
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_fsyncdir_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_statfs_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct statvfs *buf, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (op_ret == 0)
|
||||
args->statvfs = *buf;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_setxattr_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret,
|
||||
int32_t op_errno, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_getxattr_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
dict_t *dict, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (dict)
|
||||
args->xattr = dict_ref (dict);
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_fsetxattr_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_fgetxattr_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
dict_t *dict, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (dict)
|
||||
args->xattr = dict_ref (dict);
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_removexattr_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_fremovexattr_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_lk_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct gf_flock *lock, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (op_ret == 0)
|
||||
args->lock = *lock;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
args_inodelk_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_finodelk_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_entrylk_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_fentrylk_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
args_readdirp_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
gf_dirent_t *entries, dict_t *xdata)
|
||||
{
|
||||
gf_dirent_t *stub_entry = NULL, *entry = NULL;
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (op_ret > 0) {
|
||||
list_for_each_entry (entry, &entries->list, list) {
|
||||
stub_entry = gf_dirent_for_name (entry->d_name);
|
||||
if (!stub_entry)
|
||||
goto out;
|
||||
stub_entry->d_off = entry->d_off;
|
||||
stub_entry->d_ino = entry->d_ino;
|
||||
stub_entry->d_stat = entry->d_stat;
|
||||
stub_entry->d_type = entry->d_type;
|
||||
if (entry->inode)
|
||||
stub_entry->inode = inode_ref (entry->inode);
|
||||
if (entry->dict)
|
||||
stub_entry->dict = dict_ref (entry->dict);
|
||||
list_add_tail (&stub_entry->list,
|
||||
&args->entries.list);
|
||||
}
|
||||
}
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
out:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
args_readdir_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
gf_dirent_t *entries, dict_t *xdata)
|
||||
{
|
||||
gf_dirent_t *stub_entry = NULL, *entry = NULL;
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (op_ret > 0) {
|
||||
list_for_each_entry (entry, &entries->list, list) {
|
||||
stub_entry = gf_dirent_for_name (entry->d_name);
|
||||
if (!stub_entry)
|
||||
goto out;
|
||||
stub_entry->d_off = entry->d_off;
|
||||
stub_entry->d_ino = entry->d_ino;
|
||||
stub_entry->d_type = entry->d_type;
|
||||
list_add_tail (&stub_entry->list,
|
||||
&args->entries.list);
|
||||
}
|
||||
}
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
out:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
args_rchecksum_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
uint32_t weak_checksum, uint8_t *strong_checksum,
|
||||
dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (op_ret >= 0) {
|
||||
args->weak_checksum =
|
||||
weak_checksum;
|
||||
args->strong_checksum =
|
||||
memdup (strong_checksum, MD5_DIGEST_LENGTH);
|
||||
}
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
args_xattrop_cbk_store (default_args_cbk_t *args, int32_t op_ret,
|
||||
int32_t op_errno, dict_t *xattr, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (xattr)
|
||||
args->xattr = dict_ref (xattr);
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
args_fxattrop_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
dict_t *xattr, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (xattr)
|
||||
args->xattr = dict_ref (xattr);
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_setattr_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *statpre, struct iatt *statpost,
|
||||
dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (statpre)
|
||||
args->prestat = *statpre;
|
||||
if (statpost)
|
||||
args->poststat = *statpost;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
args_fsetattr_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *statpre, struct iatt *statpost,
|
||||
dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (statpre)
|
||||
args->prestat = *statpre;
|
||||
if (statpost)
|
||||
args->poststat = *statpost;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_fallocate_cbk_store(default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *statpre, struct iatt *statpost,
|
||||
dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (statpre)
|
||||
args->prestat = *statpre;
|
||||
if (statpost)
|
||||
args->poststat = *statpost;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_discard_cbk_store(default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *statpre, struct iatt *statpost,
|
||||
dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (statpre)
|
||||
args->prestat = *statpre;
|
||||
if (statpost)
|
||||
args->poststat = *statpost;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_zerofill_cbk_store(default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *statpre, struct iatt *statpost,
|
||||
dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (statpre)
|
||||
args->prestat = *statpre;
|
||||
if (statpost)
|
||||
args->poststat = *statpost;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
args_ipc_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
||||
{
|
||||
args->op_ret = op_ret;
|
||||
args->op_errno = op_errno;
|
||||
if (xdata)
|
||||
args->xdata = dict_ref (xdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
args_cbk_wipe (default_args_cbk_t *args_cbk)
|
||||
{
|
||||
if (!args_cbk)
|
||||
return;
|
||||
if (args_cbk->inode)
|
||||
inode_unref (args_cbk->inode);
|
||||
|
||||
GF_FREE ((char *)args_cbk->buf);
|
||||
|
||||
GF_FREE (args_cbk->vector);
|
||||
|
||||
if (args_cbk->iobref)
|
||||
iobref_unref (args_cbk->iobref);
|
||||
|
||||
if (args_cbk->fd)
|
||||
fd_unref (args_cbk->fd);
|
||||
|
||||
if (args_cbk->xattr)
|
||||
dict_unref (args_cbk->xattr);
|
||||
|
||||
GF_FREE (args_cbk->strong_checksum);
|
||||
|
||||
if (args_cbk->xdata)
|
||||
dict_unref (args_cbk->xdata);
|
||||
|
||||
if (!list_empty (&args_cbk->entries.list))
|
||||
gf_dirent_free (&args_cbk->entries);
|
||||
}
|
||||
/* end of ARGS_ STORE section*/
|
||||
|
@ -22,6 +22,33 @@
|
||||
|
||||
#include "xlator.h"
|
||||
|
||||
typedef 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;
|
||||
uint32_t weak_checksum;
|
||||
uint8_t *strong_checksum;
|
||||
dict_t *xdata;
|
||||
gf_dirent_t entries;
|
||||
int valid; /* If the response is valid or not. For call-stub it is
|
||||
always valid irrespective of this */
|
||||
} default_args_cbk_t;
|
||||
|
||||
int32_t default_notify (xlator_t *this,
|
||||
int32_t event,
|
||||
void *data,
|
||||
@ -1138,4 +1165,254 @@ default_getspec_failure_cbk (call_frame_t *frame, int32_t op_errno);
|
||||
int32_t
|
||||
default_mem_acct_init (xlator_t *this);
|
||||
|
||||
int
|
||||
args_lookup_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
inode_t *inode, struct iatt *buf,
|
||||
dict_t *xdata, struct iatt *postparent);
|
||||
|
||||
|
||||
int
|
||||
args_stat_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *buf, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_fstat_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *buf, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_truncate_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
|
||||
struct iatt *postbuf, dict_t *xdata);
|
||||
|
||||
|
||||
int
|
||||
args_ftruncate_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
|
||||
struct iatt *postbuf, dict_t *xdata);
|
||||
|
||||
|
||||
int
|
||||
args_access_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata);
|
||||
|
||||
|
||||
int
|
||||
args_readlink_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
const char *path, struct iatt *stbuf, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_mknod_cbk_store (default_args_cbk_t *args, int32_t op_ret,
|
||||
int32_t op_errno, inode_t *inode, struct iatt *buf,
|
||||
struct iatt *preparent, struct iatt *postparent,
|
||||
dict_t *xdata);
|
||||
|
||||
int
|
||||
args_mkdir_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, inode_t *inode,
|
||||
struct iatt *buf, struct iatt *preparent,
|
||||
struct iatt *postparent, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_unlink_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *preparent, struct iatt *postparent,
|
||||
dict_t *xdata);
|
||||
|
||||
int
|
||||
args_rmdir_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *preparent, struct iatt *postparent,
|
||||
dict_t *xdata);
|
||||
|
||||
int
|
||||
args_symlink_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
inode_t *inode, struct iatt *buf,
|
||||
struct iatt *preparent, struct iatt *postparent,
|
||||
dict_t *xdata);
|
||||
|
||||
|
||||
int
|
||||
args_rename_cbk_store (default_args_cbk_t *args,
|
||||
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);
|
||||
|
||||
int
|
||||
args_link_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
inode_t *inode, struct iatt *buf,
|
||||
struct iatt *preparent, struct iatt *postparent,
|
||||
dict_t *xdata);
|
||||
|
||||
int
|
||||
args_create_cbk_store (default_args_cbk_t *args,
|
||||
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);
|
||||
|
||||
int
|
||||
args_open_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
fd_t *fd, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_readv_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, struct iovec *vector,
|
||||
int32_t count, struct iatt *stbuf,
|
||||
struct iobref *iobref, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_writev_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata);
|
||||
|
||||
|
||||
int
|
||||
args_flush_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata);
|
||||
|
||||
|
||||
int
|
||||
args_fsync_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_opendir_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
fd_t *fd, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_fsyncdir_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_statfs_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct statvfs *buf, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_setxattr_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret,
|
||||
int32_t op_errno, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_getxattr_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
dict_t *dict, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_fsetxattr_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_fgetxattr_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
dict_t *dict, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_removexattr_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_fremovexattr_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_lk_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct gf_flock *lock, dict_t *xdata);
|
||||
|
||||
|
||||
int
|
||||
args_inodelk_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_finodelk_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_entrylk_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_fentrylk_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata);
|
||||
|
||||
|
||||
int
|
||||
args_readdirp_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
gf_dirent_t *entries, dict_t *xdata);
|
||||
|
||||
|
||||
int
|
||||
args_readdir_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
gf_dirent_t *entries, dict_t *xdata);
|
||||
|
||||
|
||||
int
|
||||
args_rchecksum_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
uint32_t weak_checksum, uint8_t *strong_checksum,
|
||||
dict_t *xdata);
|
||||
|
||||
|
||||
int
|
||||
args_xattrop_cbk_store (default_args_cbk_t *args, int32_t op_ret,
|
||||
int32_t op_errno, dict_t *xattr, dict_t *xdata);
|
||||
|
||||
|
||||
int
|
||||
args_fxattrop_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
dict_t *xattr, dict_t *xdata);
|
||||
|
||||
int
|
||||
args_setattr_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *statpre, struct iatt *statpost,
|
||||
dict_t *xdata);
|
||||
|
||||
|
||||
int
|
||||
args_fsetattr_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *statpre, struct iatt *statpost,
|
||||
dict_t *xdata);
|
||||
|
||||
int
|
||||
args_fallocate_cbk_store(default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *statpre, struct iatt *statpost,
|
||||
dict_t *xdata);
|
||||
|
||||
int
|
||||
args_discard_cbk_store(default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *statpre, struct iatt *statpost,
|
||||
dict_t *xdata);
|
||||
|
||||
int
|
||||
args_zerofill_cbk_store(default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno,
|
||||
struct iatt *statpre, struct iatt *statpost,
|
||||
dict_t *xdata);
|
||||
|
||||
int
|
||||
args_ipc_cbk_store (default_args_cbk_t *args,
|
||||
int32_t op_ret, int32_t op_errno, dict_t *xdata);
|
||||
|
||||
void
|
||||
args_cbk_wipe (default_args_cbk_t *args_cbk);
|
||||
/* end of ARGS_ STORE section*/
|
||||
#endif /* _DEFAULTS_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user