summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/call-stub.c55
-rw-r--r--libglusterfs/src/call-stub.h15
-rw-r--r--libglusterfs/src/defaults.c31
-rw-r--r--libglusterfs/src/defaults.h9
-rw-r--r--libglusterfs/src/globals.c3
-rw-r--r--libglusterfs/src/glusterfs.h3
-rw-r--r--libglusterfs/src/list.h14
-rw-r--r--libglusterfs/src/syncop.c263
-rw-r--r--libglusterfs/src/syncop.h34
-rw-r--r--libglusterfs/src/xlator.c2
-rw-r--r--libglusterfs/src/xlator.h10
11 files changed, 418 insertions, 21 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c
index 7e94ee3c0..ee2e7c933 100644
--- a/libglusterfs/src/call-stub.c
+++ b/libglusterfs/src/call-stub.c
@@ -2297,7 +2297,53 @@ out:
}
-static void
+call_stub_t *
+fop_ipc_cbk_stub (call_frame_t *frame, fop_ipc_cbk_t fn,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
+{
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+
+ stub = stub_new (frame, 0, GF_FOP_IPC);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ 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);
+out:
+ return stub;
+}
+
+call_stub_t *
+fop_ipc_stub (call_frame_t *frame, fop_ipc_t fn,
+ int32_t op, dict_t *xdata)
+{
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", fn, out);
+
+ stub = stub_new (frame, 1, GF_FOP_IPC);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ stub->fn.ipc = fn;
+
+ stub->args.cmd = op;
+
+ if (xdata)
+ stub->args.xdata = dict_ref (xdata);
+out:
+ return stub;
+
+}
+
+
+void
call_resume_wind (call_stub_t *stub)
{
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
@@ -2529,6 +2575,10 @@ call_resume_wind (call_stub_t *stub)
stub->args.fd, stub->args.offset,
stub->args.size, stub->args.xdata);
break;
+ case GF_FOP_IPC:
+ stub->fn.ipc (stub->frame, stub->frame->this,
+ stub->args.cmd, stub->args.xdata);
+ break;
default:
gf_log_callingfn ("call-stub", GF_LOG_ERROR,
@@ -2736,6 +2786,9 @@ call_resume_unwind (call_stub_t *stub)
STUB_UNWIND(stub, zerofill, &stub->args_cbk.prestat,
&stub->args_cbk.poststat, stub->args_cbk.xdata);
break;
+ case GF_FOP_IPC:
+ STUB_UNWIND (stub, ipc, stub->args_cbk.xdata);
+ break;
default:
gf_log_callingfn ("call-stub", GF_LOG_ERROR,
diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h
index 0f6c108ee..e404c8dda 100644
--- a/libglusterfs/src/call-stub.h
+++ b/libglusterfs/src/call-stub.h
@@ -72,6 +72,7 @@ typedef struct {
fop_fallocate_t fallocate;
fop_discard_t discard;
fop_zerofill_t zerofill;
+ fop_ipc_t ipc;
} fn;
union {
@@ -119,6 +120,7 @@ typedef struct {
fop_fallocate_cbk_t fallocate;
fop_discard_cbk_t discard;
fop_zerofill_cbk_t zerofill;
+ fop_ipc_cbk_t ipc;
} fn_cbk;
struct {
@@ -761,7 +763,20 @@ fop_zerofill_cbk_stub(call_frame_t *frame,
struct iatt *statpre, struct iatt *statpost,
dict_t *xdata);
+call_stub_t *
+fop_ipc_stub (call_frame_t *frame, fop_ipc_t fn, int32_t op, dict_t *xdata);
+
+call_stub_t *
+fop_ipc_cbk_stub (call_frame_t *frame, fop_ipc_cbk_t fn,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata);
+
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);
+
+/*
+ * Sometimes we might want to call just this, perhaps repeatedly, without
+ * having (or being able) to destroy and recreate it.
+ */
+void call_resume_wind (call_stub_t *stub);
#endif
diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c
index 599f9477d..8e0e56a74 100644
--- a/libglusterfs/src/defaults.c
+++ b/libglusterfs/src/defaults.c
@@ -1295,6 +1295,16 @@ default_getspec_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
return 0;
}
+
+int32_t
+default_ipc_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
+{
+ STACK_UNWIND_STRICT (ipc, frame, op_ret, op_errno, xdata);
+ return 0;
+}
+
+
/* RESUME */
int32_t
@@ -1726,6 +1736,17 @@ default_zerofill_resume(call_frame_t *frame, xlator_t *this, fd_t *fd,
}
+int32_t
+default_ipc_resume (call_frame_t *frame, xlator_t *this, int32_t op,
+ dict_t *xdata)
+{
+ STACK_WIND (frame, default_ipc_cbk,
+ FIRST_CHILD(this), FIRST_CHILD(this)->fops->ipc,
+ op, xdata);
+ return 0;
+}
+
+
/* FOPS */
int32_t
@@ -2162,6 +2183,16 @@ default_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd,
int32_t
+default_ipc (call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata)
+{
+ STACK_WIND_TAIL (frame,
+ FIRST_CHILD(this), FIRST_CHILD(this)->fops->ipc,
+ op, xdata);
+ return 0;
+}
+
+
+int32_t
default_forget (xlator_t *this, inode_t *inode)
{
gf_log_callingfn (this->name, GF_LOG_WARNING, "xlator does not "
diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h
index 9bd5eb842..e29d62edf 100644
--- a/libglusterfs/src/defaults.h
+++ b/libglusterfs/src/defaults.h
@@ -263,6 +263,9 @@ int32_t default_zerofill(call_frame_t *frame,
off_t offset,
off_t len, dict_t *xdata);
+int32_t default_ipc (call_frame_t *frame, xlator_t *this, int32_t op,
+ dict_t *xdata);
+
/* Resume */
int32_t default_getspec_resume (call_frame_t *frame,
@@ -492,6 +495,9 @@ int32_t default_zerofill_resume(call_frame_t *frame,
off_t offset,
off_t len, dict_t *xdata);
+int32_t default_ipc_resume (call_frame_t *frame, xlator_t *this,
+ int32_t op, dict_t *xdata);
+
/* _cbk_resume */
@@ -985,6 +991,9 @@ int32_t default_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *pre,
struct iatt *post, dict_t *xdata);
+int32_t default_ipc_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata);
+
int32_t
default_getspec_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, char *spec_data);
diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c
index 259c5c885..0bb5ea9f4 100644
--- a/libglusterfs/src/globals.c
+++ b/libglusterfs/src/globals.c
@@ -70,7 +70,8 @@ const char *gf_fop_list[GF_FOP_MAXVALUE] = {
[GF_FOP_FREMOVEXATTR]= "FREMOVEXATTR",
[GF_FOP_FALLOCATE] = "FALLOCATE",
[GF_FOP_DISCARD] = "DISCARD",
- [GF_FOP_ZEROFILL] = "ZEROFILL",
+ [GF_FOP_ZEROFILL] = "ZEROFILL",
+ [GF_FOP_IPC] = "IPC",
};
/* THIS */
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 96a203770..2bb3558e9 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -205,7 +205,7 @@ typedef enum {
GF_FOP_WRITE,
GF_FOP_STATFS,
GF_FOP_FLUSH,
- GF_FOP_FSYNC, /* 15 */
+ GF_FOP_FSYNC, /* 16 */
GF_FOP_SETXATTR,
GF_FOP_GETXATTR,
GF_FOP_REMOVEXATTR,
@@ -238,6 +238,7 @@ typedef enum {
GF_FOP_FALLOCATE,
GF_FOP_DISCARD,
GF_FOP_ZEROFILL,
+ GF_FOP_IPC,
GF_FOP_MAXVALUE,
} glusterfs_fop_t;
diff --git a/libglusterfs/src/list.h b/libglusterfs/src/list.h
index 04b404712..3bb991fac 100644
--- a/libglusterfs/src/list.h
+++ b/libglusterfs/src/list.h
@@ -212,4 +212,18 @@ list_append_init (struct list_head *list, struct list_head *head)
&pos->member != (head); \
pos = n, n = list_entry(n->member.prev, typeof(*n), member))
+/*
+ * This list implementation has some advantages, but one disadvantage: you
+ * can't use NULL to check whether you're at the head or tail. Thus, the
+ * address of the head has to be an argument for these macros.
+ */
+
+#define list_next(ptr,head,type,member) \
+ (((ptr)->member.next == head) ? NULL \
+ : list_entry((ptr)->member.next,type,member))
+
+#define list_prev(ptr,head,type,member) \
+ (((ptr)->member.prev == head) ? NULL \
+ : list_entry((ptr)->member.prev,type,member))
+
#endif /* _LLIST_H */
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index 9705a7d54..a46a6603f 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -1203,6 +1203,22 @@ syncop_opendir (xlator_t *subvol,
}
int
+syncop_opendir_with_xdata (xlator_t *subvol,
+ loc_t *loc,
+ fd_t *fd,
+ dict_t *dict)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_opendir_cbk, subvol->fops->opendir,
+ loc, fd, dict);
+
+ errno = args.op_errno;
+ return args.op_ret;
+
+}
+
+int
syncop_fsyncdir_cbk (call_frame_t *frame, void* cookie, xlator_t *this,
int op_ret, int op_errno, dict_t *xdata)
{
@@ -1250,10 +1266,16 @@ syncop_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
syncop_removexattr (xlator_t *subvol, loc_t *loc, const char *name, dict_t *xdata)
{
+ return(syncop_removexattr_with_xdata(subvol, loc, name, NULL));
+}
+
+int
+syncop_removexattr_with_xdata (xlator_t *subvol, loc_t *loc, const char *name, dict_t *dict)
+{
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_removexattr_cbk, subvol->fops->removexattr,
- loc, name, xdata);
+ loc, name, dict);
if (args.op_ret < 0)
return -args.op_errno;
@@ -1290,6 +1312,17 @@ syncop_fremovexattr (xlator_t *subvol, fd_t *fd, const char *name, dict_t *xdata
}
int
+syncop_fremovexattr_with_xdata (xlator_t *subvol, fd_t *fd, const char *name, dict_t *dict)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_fremovexattr_cbk,
+ subvol->fops->fremovexattr, fd, name, dict);
+
+ errno = args.op_errno;
+ return args.op_ret;
+}
+int
syncop_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno, dict_t *xdata)
{
@@ -1305,14 +1338,19 @@ syncop_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
return 0;
}
-
int
syncop_setxattr (xlator_t *subvol, loc_t *loc, dict_t *dict, int32_t flags)
{
+ return (syncop_setxattr_with_xdata(subvol, loc, dict, flags, NULL));
+}
+
+int
+syncop_setxattr_with_xdata (xlator_t *subvol, loc_t *loc, dict_t *dict, int32_t flags, dict_t *extra)
+{
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_setxattr_cbk, subvol->fops->setxattr,
- loc, dict, flags, NULL);
+ loc, dict, flags, extra);
if (args.op_ret < 0)
return -args.op_errno;
@@ -1350,6 +1388,18 @@ syncop_fsetxattr (xlator_t *subvol, fd_t *fd, dict_t *dict, int32_t flags)
}
int
+syncop_fsetxattr_with_xdata (xlator_t *subvol, fd_t *fd, dict_t *dict, int32_t flags, dict_t *extra)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_fsetxattr_cbk, subvol->fops->fsetxattr,
+ fd, dict, flags, extra);
+
+ errno = args.op_errno;
+ return args.op_ret;
+}
+
+int
syncop_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno, dict_t *dict, dict_t *xdata)
{
@@ -1404,12 +1454,12 @@ syncop_getxattr (xlator_t *subvol, loc_t *loc, dict_t **dict, const char *key)
}
int
-syncop_fgetxattr (xlator_t *subvol, fd_t *fd, dict_t **dict, const char *key)
+syncop_fgetxattr_with_xdata (xlator_t *subvol, fd_t *fd, dict_t **dict, const char *key, dict_t *extra)
{
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_getxattr_cbk, subvol->fops->fgetxattr,
- fd, key, NULL);
+ fd, key, extra);
if (dict)
*dict = args.xattr;
@@ -1422,6 +1472,12 @@ syncop_fgetxattr (xlator_t *subvol, fd_t *fd, dict_t **dict, const char *key)
}
int
+syncop_fgetxattr (xlator_t *subvol, fd_t *fd, dict_t **dict, const char *key)
+{
+ return(syncop_fgetxattr_with_xdata(subvol, fd, dict, key, NULL));
+}
+
+int
syncop_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
struct statvfs *buf, dict_t *xdata)
@@ -1485,13 +1541,13 @@ syncop_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-syncop_setattr (xlator_t *subvol, loc_t *loc, struct iatt *iatt, int valid,
- struct iatt *preop, struct iatt *postop)
+syncop_setattr_with_xdata (xlator_t *subvol, loc_t *loc, struct iatt *iatt, int valid,
+ struct iatt *preop, struct iatt *postop, dict_t *dict)
{
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_setattr_cbk, subvol->fops->setattr,
- loc, iatt, valid, NULL);
+ loc, iatt, valid, dict);
if (preop)
*preop = args.iatt1;
@@ -1503,15 +1559,21 @@ syncop_setattr (xlator_t *subvol, loc_t *loc, struct iatt *iatt, int valid,
return args.op_ret;
}
+int
+syncop_setattr (xlator_t *subvol, loc_t *loc, struct iatt *iatt, int valid,
+ struct iatt *preop, struct iatt *postop)
+{
+ return(syncop_setattr_with_xdata(subvol, loc, iatt, valid, preop, postop, NULL));
+}
int
-syncop_fsetattr (xlator_t *subvol, fd_t *fd, struct iatt *iatt, int valid,
- struct iatt *preop, struct iatt *postop)
+syncop_fsetattr_with_xdata (xlator_t *subvol, fd_t *fd, struct iatt *iatt, int valid,
+ struct iatt *preop, struct iatt *postop, dict_t *dict)
{
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_setattr_cbk, subvol->fops->fsetattr,
- fd, iatt, valid, NULL);
+ fd, iatt, valid, dict);
if (preop)
*preop = args.iatt1;
@@ -1523,6 +1585,12 @@ syncop_fsetattr (xlator_t *subvol, fd_t *fd, struct iatt *iatt, int valid,
return args.op_ret;
}
+int
+syncop_fsetattr (xlator_t *subvol, fd_t *fd, struct iatt *iatt, int valid,
+ struct iatt *preop, struct iatt *postop)
+{
+ return(syncop_fsetattr_with_xdata(subvol, fd, iatt, valid, preop, postop, NULL));
+}
int32_t
syncop_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
@@ -1554,6 +1622,19 @@ syncop_open (xlator_t *subvol, loc_t *loc, int32_t flags, fd_t *fd)
}
+int
+syncop_open_with_xdata (xlator_t *subvol, loc_t *loc, int32_t flags, fd_t *fd, dict_t *dict)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_open_cbk, subvol->fops->open,
+ loc, flags, fd, dict);
+
+ errno = args.op_errno;
+ return args.op_ret;
+
+}
+
int32_t
syncop_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
@@ -1584,14 +1665,14 @@ syncop_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
int
-syncop_readv (xlator_t *subvol, fd_t *fd, size_t size, off_t off,
+syncop_readv_with_xdata (xlator_t *subvol, fd_t *fd, size_t size, off_t off,
uint32_t flags, struct iovec **vector, int *count,
- struct iobref **iobref)
+ struct iobref **iobref, dict_t *dict)
{
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_readv_cbk, subvol->fops->readv,
- fd, size, off, flags, NULL);
+ fd, size, off, flags, dict);
if (args.op_ret < 0)
goto out;
@@ -1618,6 +1699,14 @@ out:
}
int
+syncop_readv (xlator_t *subvol, fd_t *fd, size_t size, off_t off,
+ uint32_t flags, struct iovec **vector, int *count,
+ struct iobref **iobref)
+{
+ return(syncop_readv_with_xdata(subvol, fd, size, off, flags, vector, count, iobref, NULL));
+}
+
+int
syncop_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
@@ -1635,21 +1724,29 @@ syncop_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
int
-syncop_writev (xlator_t *subvol, fd_t *fd, const struct iovec *vector,
+syncop_writev_with_xdata (xlator_t *subvol, fd_t *fd, const struct iovec *vector,
int32_t count, off_t offset, struct iobref *iobref,
- uint32_t flags)
+ uint32_t flags, dict_t *dict)
{
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_writev_cbk, subvol->fops->writev,
fd, (struct iovec *) vector, count, offset, flags, iobref,
- NULL);
+ dict);
if (args.op_ret < 0)
return -args.op_errno;
return args.op_ret;
}
+int
+syncop_writev (xlator_t *subvol, fd_t *fd, const struct iovec *vector,
+ int32_t count, off_t offset, struct iobref *iobref,
+ uint32_t flags)
+{
+ return(syncop_writev_with_xdata(subvol, fd, vector, count, offset, iobref, flags, NULL));
+}
+
int syncop_write (xlator_t *subvol, fd_t *fd, const char *buf, int size,
off_t offset, struct iobref *iobref, uint32_t flags)
{
@@ -1746,6 +1843,18 @@ syncop_unlink (xlator_t *subvol, loc_t *loc)
}
int
+syncop_unlink_with_xdata (xlator_t *subvol, loc_t *loc, dict_t *dict)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_unlink_cbk, subvol->fops->unlink, loc,
+ 0, dict);
+
+ errno = args.op_errno;
+ return args.op_ret;
+}
+
+int
syncop_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata)
@@ -1777,6 +1886,18 @@ syncop_rmdir (xlator_t *subvol, loc_t *loc, int flags)
int
+syncop_rmdir_with_xdata (xlator_t *subvol, loc_t *loc, int flags, dict_t *dict)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_rmdir_cbk, subvol->fops->rmdir, loc,
+ flags, dict);
+
+ errno = args.op_errno;
+ return args.op_ret;
+}
+
+int
syncop_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, inode_t *inode,
struct iatt *buf, struct iatt *preparent,
@@ -1809,6 +1930,18 @@ syncop_link (xlator_t *subvol, loc_t *oldloc, loc_t *newloc)
return args.op_ret;
}
+int
+syncop_link_with_xdata (xlator_t *subvol, loc_t *oldloc, loc_t *newloc, dict_t *dict)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_link_cbk, subvol->fops->link,
+ oldloc, newloc, dict);
+
+ errno = args.op_errno;
+
+ return args.op_ret;
+}
int
syncop_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
@@ -1844,6 +1977,19 @@ syncop_rename (xlator_t *subvol, loc_t *oldloc, loc_t *newloc)
return args.op_ret;
}
+int
+syncop_rename_with_xdata (xlator_t *subvol, loc_t *oldloc, loc_t *newloc, dict_t *dict)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_rename_cbk, subvol->fops->rename,
+ oldloc, newloc, dict);
+
+ errno = args.op_errno;
+
+ return args.op_ret;
+}
+
int
syncop_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
@@ -1876,6 +2022,18 @@ syncop_ftruncate (xlator_t *subvol, fd_t *fd, off_t offset)
}
int
+syncop_ftruncate_with_xdata (xlator_t *subvol, fd_t *fd, off_t offset, dict_t *dict)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_ftruncate_cbk, subvol->fops->ftruncate,
+ fd, offset, dict);
+
+ errno = args.op_errno;
+ return args.op_ret;
+}
+
+int
syncop_truncate (xlator_t *subvol, loc_t *loc, off_t offset)
{
struct syncargs args = {0, };
@@ -1920,6 +2078,19 @@ syncop_fsync (xlator_t *subvol, fd_t *fd, int dataonly)
}
+int
+syncop_fsync_with_xdata (xlator_t *subvol, fd_t *fd, int dataonly, dict_t *dict)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_fsync_cbk, subvol->fops->fsync,
+ fd, dataonly, dict);
+
+ errno = args.op_errno;
+ return args.op_ret;
+
+}
+
int
syncop_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
@@ -1953,6 +2124,19 @@ syncop_flush (xlator_t *subvol, fd_t *fd)
}
int
+syncop_flush_with_xdata (xlator_t *subvol, fd_t *fd, dict_t *dict)
+{
+ struct syncargs args = {0};
+
+ SYNCOP (subvol, (&args), syncop_flush_cbk, subvol->fops->flush,
+ fd, dict);
+
+ errno = args.op_errno;
+ return args.op_ret;
+
+}
+
+int
syncop_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *stbuf, dict_t *xdata)
{
@@ -1987,6 +2171,21 @@ syncop_fstat (xlator_t *subvol, fd_t *fd, struct iatt *stbuf)
return args.op_ret;
}
+int
+syncop_fstat_with_xdata (xlator_t *subvol, fd_t *fd, struct iatt *stbuf, dict_t *dict)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_fstat_cbk, subvol->fops->fstat,
+ fd, dict);
+
+ if (stbuf)
+ *stbuf = args.iatt1;
+
+ errno = args.op_errno;
+ return args.op_ret;
+
+}
int
syncop_stat (xlator_t *subvol, loc_t *loc, struct iatt *stbuf)
@@ -2282,6 +2481,36 @@ syncop_zerofill(xlator_t *subvol, fd_t *fd, off_t offset, off_t len)
int
+syncop_ipc_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int op_ret, int op_errno, dict_t *xdata)
+{
+ struct syncargs *args = NULL;
+
+ args = cookie;
+
+ args->op_ret = op_ret;
+ args->op_errno = op_errno;
+
+ __wake (args);
+
+ return 0;
+}
+
+int
+syncop_ipc (xlator_t *subvol, int32_t op)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_ipc_cbk, subvol->fops->ipc,
+ op, NULL);
+
+ if (args.op_ret < 0)
+ return -args.op_errno;
+ return args.op_ret;
+}
+
+
+int
syncop_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno, struct gf_flock *flock,
dict_t *xdata)
diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h
index 16f3833ba..8760f4b68 100644
--- a/libglusterfs/src/syncop.h
+++ b/libglusterfs/src/syncop.h
@@ -351,51 +351,81 @@ int syncop_readdir (xlator_t *subvol, fd_t *fd, size_t size, off_t off,
gf_dirent_t *entries);
int syncop_opendir (xlator_t *subvol, loc_t *loc, fd_t *fd);
+int syncop_opendir_with_xdata (xlator_t *subvol, loc_t *loc, fd_t *fd, dict_t *dict);
int syncop_setattr (xlator_t *subvol, loc_t *loc, struct iatt *iatt, int valid,
/* out */
struct iatt *preop, struct iatt *postop);
+int syncop_setattr_with_xdata (xlator_t *subvol, loc_t *loc, struct iatt *iatt, int valid,
+ /* out */
+ struct iatt *preop, struct iatt *postop, dict_t *dict);
+
int syncop_fsetattr (xlator_t *subvol, fd_t *fd, struct iatt *iatt, int valid,
/* out */
struct iatt *preop, struct iatt *postop);
+int syncop_fsetattr_with_xdata (xlator_t *subvol, fd_t *fd, struct iatt *iatt, int valid,
+ /* out */
+ struct iatt *preop, struct iatt *postop, dict_t *dict);
+
int syncop_statfs (xlator_t *subvol, loc_t *loc, struct statvfs *buf);
int syncop_setxattr (xlator_t *subvol, loc_t *loc, dict_t *dict, int32_t flags);
+int syncop_setxattr_with_xdata (xlator_t *subvol, loc_t *loc, dict_t *dict, int32_t flags, dict_t *extra);
int syncop_fsetxattr (xlator_t *subvol, fd_t *fd, dict_t *dict, int32_t flags);
+int syncop_fsetxattr_with_xdata (xlator_t *subvol, fd_t *fd, dict_t *dict, int32_t flags, dict_t *extra);
int syncop_listxattr (xlator_t *subvol, loc_t *loc, dict_t **dict);
int syncop_getxattr (xlator_t *xl, loc_t *loc, dict_t **dict, const char *key);
int syncop_fgetxattr (xlator_t *xl, fd_t *fd, dict_t **dict, const char *key);
+int syncop_fgetxattr_with_xdata (xlator_t *xl, fd_t *fd, dict_t **dict, const char *key, dict_t *extra);
int syncop_removexattr (xlator_t *subvol, loc_t *loc, const char *name,
dict_t *xdata);
+int syncop_removexattr_with_xdata (xlator_t *subvol, loc_t *loc, const char *name, dict_t *dict);
int syncop_fremovexattr (xlator_t *subvol, fd_t *fd, const char *name,
dict_t *xdata);
+int syncop_fremovexattr_with_xdata (xlator_t *subvol, fd_t *fd, const char *name, dict_t *dict);
int syncop_create (xlator_t *subvol, loc_t *loc, int32_t flags, mode_t mode,
fd_t *fd, dict_t *dict, struct iatt *iatt);
int syncop_open (xlator_t *subvol, loc_t *loc, int32_t flags, fd_t *fd);
+int syncop_open_with_xdata (xlator_t *subvol, loc_t *loc, int32_t flags, fd_t *fd, dict_t *dict);
int syncop_close (fd_t *fd);
+int syncop_close_with_xdata (fd_t *fd, dict_t *dict);
int syncop_write (xlator_t *subvol, fd_t *fd, const char *buf, int size,
off_t offset, struct iobref *iobref, uint32_t flags);
int syncop_writev (xlator_t *subvol, fd_t *fd, const struct iovec *vector,
int32_t count, off_t offset, struct iobref *iobref,
uint32_t flags);
+int syncop_writev_with_xdata (xlator_t *subvol, fd_t *fd, const struct iovec *vector,
+ int32_t count, off_t offset, struct iobref *iobref,
+ uint32_t flags, dict_t *dict);
int syncop_readv (xlator_t *subvol, fd_t *fd, size_t size, off_t off,
uint32_t flags,
/* out */
struct iovec **vector, int *count, struct iobref **iobref);
+int syncop_readv_with_xdata (xlator_t *subvol, fd_t *fd, size_t size, off_t off,
+ uint32_t flags,
+ /* out */
+ struct iovec **vector, int *count, struct iobref **iobref, dict_t *dict);
int syncop_ftruncate (xlator_t *subvol, fd_t *fd, off_t offset);
+int syncop_ftruncate_with_xdata (xlator_t *subvol, fd_t *fd, off_t offset, dict_t *dict);
int syncop_truncate (xlator_t *subvol, loc_t *loc, off_t offset);
int syncop_unlink (xlator_t *subvol, loc_t *loc);
+int syncop_unlink_with_xdata (xlator_t *subvol, loc_t *loc, dict_t *dict);
+
int syncop_rmdir (xlator_t *subvol, loc_t *loc, int flags);
+int syncop_rmdir_with_xdata (xlator_t *subvol, loc_t *loc, int flags, dict_t *dict);
int syncop_fsync (xlator_t *subvol, fd_t *fd, int dataonly);
+int syncop_fsync_with_xdata (xlator_t *subvol, fd_t *fd, int dataonly, dict_t *dict);
int syncop_flush (xlator_t *subvol, fd_t *fd);
+int syncop_flush_with_xdata (xlator_t *subvol, fd_t *fd, dict_t *dict);
int syncop_fstat (xlator_t *subvol, fd_t *fd, struct iatt *stbuf);
+int syncop_fstat_with_xdata (xlator_t *subvol, fd_t *fd, struct iatt *stbuf, dict_t *dict);
int syncop_stat (xlator_t *subvol, loc_t *loc, struct iatt *stbuf);
int syncop_symlink (xlator_t *subvol, loc_t *loc, const char *newpath,
@@ -406,6 +436,7 @@ int syncop_mknod (xlator_t *subvol, loc_t *loc, mode_t mode, dev_t rdev,
int syncop_mkdir (xlator_t *subvol, loc_t *loc, mode_t mode, dict_t *dict,
struct iatt *iatt);
int syncop_link (xlator_t *subvol, loc_t *oldloc, loc_t *newloc);
+int syncop_link_with_xdata (xlator_t *subvol, loc_t *oldloc, loc_t *newloc, dict_t *dict);
int syncop_fsyncdir (xlator_t *subvol, fd_t *fd, int datasync);
int syncop_access (xlator_t *subvol, loc_t *loc, int32_t mask);
int syncop_fallocate(xlator_t *subvol, fd_t *fd, int32_t keep_size, off_t offset,
@@ -415,7 +446,10 @@ int syncop_discard(xlator_t *subvol, fd_t *fd, off_t offset, size_t len);
int syncop_zerofill(xlator_t *subvol, fd_t *fd, off_t offset, off_t len);
int syncop_rename (xlator_t *subvol, loc_t *oldloc, loc_t *newloc);
+int syncop_rename_with_xdata (xlator_t *subvol, loc_t *oldloc, loc_t *newloc, dict_t *dict);
int syncop_lk (xlator_t *subvol, fd_t *fd, int cmd, struct gf_flock *flock);
+int syncop_ipc (xlator_t *subvol, int op);
+
#endif /* _SYNCOP_H */
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 1bded6d3d..55e946795 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -82,6 +82,7 @@ fill_defaults (xlator_t *xl)
SET_DEFAULT_FOP (fallocate);
SET_DEFAULT_FOP (discard);
SET_DEFAULT_FOP (zerofill);
+ SET_DEFAULT_FOP (ipc);
SET_DEFAULT_FOP (getspec);
@@ -880,4 +881,3 @@ glusterd_check_log_level (const char *value)
return log_level;
}
-
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index 1daa06ec2..ec5c0c5c1 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -442,6 +442,10 @@ typedef int32_t (*fop_zerofill_cbk_t) (call_frame_t *frame,
struct iatt *preop_stbuf,
struct iatt *postop_stbuf, dict_t *xdata);
+typedef int32_t (*fop_ipc_cbk_t) (call_frame_t *frame, void *cookie,
+ xlator_t *this, int32_t op_ret,
+ int32_t op_errno, dict_t *xdata);
+
typedef int32_t (*fop_lookup_t) (call_frame_t *frame,
xlator_t *this,
loc_t *loc,
@@ -673,6 +677,7 @@ typedef int32_t (*fop_discard_t) (call_frame_t *frame,
off_t offset,
size_t len,
dict_t *xdata);
+
typedef int32_t (*fop_zerofill_t) (call_frame_t *frame,
xlator_t *this,
fd_t *fd,
@@ -680,6 +685,9 @@ typedef int32_t (*fop_zerofill_t) (call_frame_t *frame,
off_t len,
dict_t *xdata);
+typedef int32_t (*fop_ipc_t) (call_frame_t *frame, xlator_t *this, int32_t op,
+ dict_t *xdata);
+
struct xlator_fops {
fop_lookup_t lookup;
fop_stat_t stat;
@@ -726,6 +734,7 @@ struct xlator_fops {
fop_fallocate_t fallocate;
fop_discard_t discard;
fop_zerofill_t zerofill;
+ fop_ipc_t ipc;
/* these entries are used for a typechecking hack in STACK_WIND _only_ */
fop_lookup_cbk_t lookup_cbk;
@@ -773,6 +782,7 @@ struct xlator_fops {
fop_fallocate_cbk_t fallocate_cbk;
fop_discard_cbk_t discard_cbk;
fop_zerofill_cbk_t zerofill_cbk;
+ fop_ipc_cbk_t ipc_cbk;
};
typedef int32_t (*cbk_forget_t) (xlator_t *this,