diff options
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/call-stub.c | 53 | ||||
-rw-r--r-- | libglusterfs/src/call-stub.h | 9 | ||||
-rw-r--r-- | libglusterfs/src/defaults.c | 31 | ||||
-rw-r--r-- | libglusterfs/src/defaults.h | 9 | ||||
-rw-r--r-- | libglusterfs/src/globals.c | 3 | ||||
-rw-r--r-- | libglusterfs/src/glusterfs.h | 1 | ||||
-rw-r--r-- | libglusterfs/src/syncop.c | 30 | ||||
-rw-r--r-- | libglusterfs/src/syncop.h | 2 | ||||
-rw-r--r-- | libglusterfs/src/xlator.c | 2 | ||||
-rw-r--r-- | libglusterfs/src/xlator.h | 10 |
10 files changed, 148 insertions, 2 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index 86c2463ef..ee2e7c933 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -2297,6 +2297,52 @@ out: } +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) { @@ -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 ccf92cf53..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,6 +763,13 @@ 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); diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c index f5fb2aa9d..07c7d3de4 100644 --- a/libglusterfs/src/defaults.c +++ b/libglusterfs/src/defaults.c @@ -837,6 +837,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 @@ -1268,6 +1278,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 @@ -1704,6 +1725,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 f0b786ddf..6b3c90719 100644 --- a/libglusterfs/src/defaults.h +++ b/libglusterfs/src/defaults.h @@ -261,6 +261,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, @@ -490,6 +493,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 */ @@ -713,6 +719,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 f537110d7..0d4a4564f 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -237,6 +237,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/syncop.c b/libglusterfs/src/syncop.c index 552a26355..a46a6603f 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -2481,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 fb867a108..8760f4b68 100644 --- a/libglusterfs/src/syncop.h +++ b/libglusterfs/src/syncop.h @@ -450,4 +450,6 @@ int syncop_rename_with_xdata (xlator_t *subvol, loc_t *oldloc, loc_t *newloc, di 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 f3df8e2ae..da62db0a5 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); @@ -876,4 +877,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, |