summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/call-stub.c120
-rw-r--r--libglusterfs/src/call-stub.h24
-rw-r--r--libglusterfs/src/common-utils.c3
-rw-r--r--libglusterfs/src/default-args.c23
-rw-r--r--libglusterfs/src/default-args.h8
-rw-r--r--libglusterfs/src/defaults-tmpl.c2
-rw-r--r--libglusterfs/src/defaults.h32
-rwxr-xr-xlibglusterfs/src/generator.py17
-rw-r--r--libglusterfs/src/globals.c2
-rw-r--r--libglusterfs/src/glusterfs.h1
-rw-r--r--libglusterfs/src/syncop.c76
-rw-r--r--libglusterfs/src/syncop.h10
-rw-r--r--libglusterfs/src/xlator.c2
-rw-r--r--libglusterfs/src/xlator.h20
14 files changed, 339 insertions, 1 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c
index 74a6429452..d5c4f1365e 100644
--- a/libglusterfs/src/call-stub.c
+++ b/libglusterfs/src/call-stub.c
@@ -2009,6 +2009,126 @@ out:
return stub;
}
+call_stub_t *
+fop_icreate_stub (call_frame_t *frame, fop_icreate_t fn,
+ loc_t *loc, mode_t mode, 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_ICREATE);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ stub->fn.icreate = fn;
+
+ stub->args.mode = mode;
+ if (loc)
+ loc_copy (&stub->args.loc, loc);
+ if (xdata)
+ stub->args.xdata = dict_ref (xdata);
+
+ out:
+ return stub;
+}
+
+static void
+args_icreate_store_cbk (default_args_cbk_t *args,
+ int32_t op_ret, int32_t op_errno,
+ inode_t *inode, struct iatt *buf, 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 (xdata)
+ args->xdata = dict_ref (xdata);
+}
+
+call_stub_t *
+fop_icreate_cbk_stub (call_frame_t *frame,
+ fop_icreate_cbk_t fn,
+ int32_t op_ret, int32_t op_errno,
+ inode_t *inode, struct iatt *buf, dict_t *xdata)
+{
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+
+ stub = stub_new (frame, 0, GF_FOP_ICREATE);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ stub->fn_cbk.icreate = fn;
+ args_icreate_store_cbk (&stub->args_cbk,
+ op_ret, op_errno, inode, buf, xdata);
+
+ out:
+ return stub;
+}
+
+call_stub_t *
+fop_namelink_stub (call_frame_t *frame,
+ fop_namelink_t fn, loc_t *loc, 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_NAMELINK);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ stub->fn.namelink = fn;
+
+ if (loc)
+ loc_copy (&stub->args.loc, loc);
+ if (xdata)
+ stub->args.xdata = dict_ref (xdata);
+
+ out:
+ return stub;
+}
+
+static void
+args_namelink_store_cbk (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);
+}
+
+call_stub_t *
+fop_namelink_cbk_stub (call_frame_t *frame,
+ fop_namelink_cbk_t fn,
+ int32_t op_ret, int32_t op_errno,
+ struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
+{
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+
+ stub = stub_new (frame, 0, GF_FOP_NAMELINK);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ stub->fn_cbk.namelink = fn;
+ args_namelink_store_cbk (&stub->args_cbk,
+ op_ret, op_errno, prebuf, postbuf, xdata);
+
+ out:
+ return stub;
+}
+
void
call_resume_wind (call_stub_t *stub)
{
diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h
index 4d86a51753..e20f6a5a09 100644
--- a/libglusterfs/src/call-stub.h
+++ b/libglusterfs/src/call-stub.h
@@ -78,6 +78,8 @@ typedef struct _call_stub {
fop_getactivelk_t getactivelk;
fop_setactivelk_t setactivelk;
fop_put_t put;
+ fop_icreate_t icreate;
+ fop_namelink_t namelink;
} fn;
union {
@@ -131,6 +133,8 @@ typedef struct _call_stub {
fop_getactivelk_cbk_t getactivelk;
fop_setactivelk_cbk_t setactivelk;
fop_put_cbk_t put;
+ fop_icreate_cbk_t icreate;
+ fop_namelink_cbk_t namelink;
} fn_cbk;
default_args_t args;
@@ -776,6 +780,26 @@ fop_put_cbk_stub (call_frame_t *frame, fop_put_cbk_t fn, int32_t op_ret,
struct iatt *preparent, struct iatt *postparent,
dict_t *xdata);
+call_stub_t *
+fop_icreate_stub (call_frame_t *frame, fop_icreate_t fn,
+ loc_t *loc, mode_t mode, dict_t *xdata);
+
+call_stub_t *
+fop_namelink_stub (call_frame_t *frame,
+ fop_namelink_t fn, loc_t *loc, dict_t *xdata);
+
+call_stub_t *
+fop_icreate_cbk_stub (call_frame_t *frame,
+ fop_icreate_cbk_t fn,
+ int32_t op_ret, int32_t op_errno,
+ inode_t *inode, struct iatt *buf, dict_t *xdata);
+
+call_stub_t *
+fop_namelink_cbk_stub (call_frame_t *frame,
+ fop_namelink_cbk_t fn,
+ int32_t op_ret, int32_t op_errno,
+ struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata);
+
void call_resume (call_stub_t *stub);
void call_resume_keep_stub (call_stub_t *stub);
void call_stub_destroy (call_stub_t *stub);
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 68d2e243f5..ad0359d7cb 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -4591,6 +4591,8 @@ fop_enum_to_pri_string (glusterfs_fop_t fop)
case GF_FOP_READDIRP:
case GF_FOP_GETACTIVELK:
case GF_FOP_SETACTIVELK:
+ case GF_FOP_ICREATE:
+ case GF_FOP_NAMELINK:
return "HIGH";
case GF_FOP_CREATE:
@@ -4940,4 +4942,3 @@ get_struct_variable (int mem_num, gf_gsync_status_t *sts_val)
out:
return NULL;
}
-
diff --git a/libglusterfs/src/default-args.c b/libglusterfs/src/default-args.c
index 9ac0f40049..20cd05e68c 100644
--- a/libglusterfs/src/default-args.c
+++ b/libglusterfs/src/default-args.c
@@ -1580,6 +1580,29 @@ args_lease_cbk_store (default_args_cbk_t *args,
args->xdata = dict_ref (xdata);
}
+int
+args_icreate_store (default_args_t *args,
+ loc_t *loc, mode_t mode, dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+ args->mode = mode;
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
+args_namelink_store (default_args_t *args,
+ loc_t *loc, dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
void
args_cbk_wipe (default_args_cbk_t *args_cbk)
{
diff --git a/libglusterfs/src/default-args.h b/libglusterfs/src/default-args.h
index f97d8830de..7d46fefa66 100644
--- a/libglusterfs/src/default-args.h
+++ b/libglusterfs/src/default-args.h
@@ -488,6 +488,14 @@ args_getactivelk_cbk_store (default_args_cbk_t *args,
int
args_setactivelk_store (default_args_t *args, loc_t *loc,
lock_migration_info_t *locklist, dict_t *xdata);
+
+int
+args_icreate_store (default_args_t *args,
+ loc_t *loc, mode_t mode, dict_t *xdata);
+
+int
+args_namelink_store (default_args_t *args, loc_t *loc, dict_t *xdata);
+
void
args_cbk_init (default_args_cbk_t *args_cbk);
#endif /* _DEFAULT_ARGS_H */
diff --git a/libglusterfs/src/defaults-tmpl.c b/libglusterfs/src/defaults-tmpl.c
index 21b99d9566..b9f6274800 100644
--- a/libglusterfs/src/defaults-tmpl.c
+++ b/libglusterfs/src/defaults-tmpl.c
@@ -82,6 +82,8 @@ struct xlator_fops _default_fops = {
.getactivelk = default_getactivelk,
.setactivelk = default_setactivelk,
.put = default_put,
+ .icreate = default_icreate,
+ .namelink = default_namelink,
};
struct xlator_fops *default_fops = &_default_fops;
diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h
index c202dbe494..5e56cc2c9f 100644
--- a/libglusterfs/src/defaults.h
+++ b/libglusterfs/src/defaults.h
@@ -359,6 +359,12 @@ default_put (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
mode_t umask, uint32_t flags, struct iovec *vector, int32_t count,
off_t off, struct iobref *iobref, dict_t *xattr, dict_t *xdata);
+int32_t default_icreate (call_frame_t *frame, xlator_t *this,
+ loc_t *loc, mode_t mode, dict_t *xdata);
+
+int32_t default_namelink (call_frame_t *frame,
+ xlator_t *this, loc_t *loc, dict_t *xdata);
+
/* Resume */
int32_t default_getspec_resume (call_frame_t *frame,
xlator_t *this,
@@ -912,6 +918,14 @@ default_put_cbk_resume (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *buf, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata);
+int32_t
+default_icreate_resume (call_frame_t *frame, xlator_t *this,
+ loc_t *loc, mode_t mode, dict_t *xdata);
+
+int32_t
+default_namelink_resume (call_frame_t *frame,
+ xlator_t *this, loc_t *loc, dict_t *xdata);
+
/* _CBK */
int32_t
default_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
@@ -1166,6 +1180,18 @@ default_put_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *postparent, dict_t *xdata);
int32_t
+default_icreate_cbk (call_frame_t *frame,
+ void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno,
+ inode_t *inode, struct iatt *buf, dict_t *xdata);
+
+int32_t
+default_namelink_cbk (call_frame_t *frame, void *cookie,
+ xlator_t *this, int32_t op_ret,
+ int32_t op_errno, struct iatt *prebuf,
+ struct iatt *postbuf, dict_t *xdata);
+
+int32_t
default_lookup_failure_cbk (call_frame_t *frame, int32_t op_errno);
int32_t
@@ -1321,6 +1347,12 @@ int32_t
default_put_failure_cbk (call_frame_t *frame, int32_t op_errno);
int32_t
+default_icreate_failure_cbk (call_frame_t *frame, int32_t op_errno);
+
+int32_t
+default_namelink_failure_cbk (call_frame_t *frame, int32_t op_errno);
+
+int32_t
default_mem_acct_init (xlator_t *this);
void
diff --git a/libglusterfs/src/generator.py b/libglusterfs/src/generator.py
index d9262e473b..7fa5f43350 100755
--- a/libglusterfs/src/generator.py
+++ b/libglusterfs/src/generator.py
@@ -575,6 +575,23 @@ ops['put'] = (
('cbk-arg', 'xdata', 'dict_t *'),
)
+ops['icreate'] = (
+ ('fop-arg', 'loc', 'loc_t *'),
+ ('fop-arg', 'mode', 'mode_t'),
+ ('fop-arg', 'xdata', 'dict_t *'),
+ ('cbk-arg', 'inode', 'inode_t *'),
+ ('cbk-arg', 'buf', 'struct iatt *'),
+ ('cbk-arg', 'xdata', 'dict_t *'),
+)
+
+ops['namelink'] = (
+ ('fop-arg', 'loc', 'loc_t *'),
+ ('fop-arg', 'xdata', 'dict_t *'),
+ ('cbk-arg', 'prebuf', 'struct iatt *'),
+ ('cbk-arg', 'postbuf', 'struct iatt *'),
+ ('cbk-arg', 'xdata', 'dict_t *'),
+)
+
#####################################################################
xlator_cbks['forget'] = (
('fn-arg', 'this', 'xlator_t *'),
diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c
index 1c57446312..6bed1b546e 100644
--- a/libglusterfs/src/globals.c
+++ b/libglusterfs/src/globals.c
@@ -75,6 +75,8 @@ const char *gf_fop_list[GF_FOP_MAXVALUE] = {
[GF_FOP_GETACTIVELK] = "GETACTIVELK",
[GF_FOP_SETACTIVELK] = "SETACTIVELK",
[GF_FOP_PUT] = "PUT",
+ [GF_FOP_ICREATE] = "ICREATE",
+ [GF_FOP_NAMELINK] = "NAMELINK",
};
const char *gf_upcall_list[GF_UPCALL_FLAGS_MAXVALUE] = {
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index ad8e396fde..aa28b80222 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -306,6 +306,7 @@ const char *fop_enum_to_pri_string (glusterfs_fop_t fop);
#define GF_SET_OVERWRITE 0x2 /* Overwrite with the buf given */
#define GF_SET_DIR_ONLY 0x4
#define GF_SET_EPOCH_TIME 0x8 /* used by afr dir lookup selfheal */
+#define GF_AUXILLARY_PARGFID 0xd /* RIO dummy parent gfid */
/* key value which quick read uses to get small files in lookup cbk */
#define GF_CONTENT_KEY "glusterfs.content"
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index a4882f5eef..58c606b238 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -3251,3 +3251,79 @@ syncop_setactivelk (xlator_t *subvol, loc_t *loc,
return args.op_ret;
}
+
+int
+syncop_icreate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, inode_t *inode,
+ struct iatt *buf, dict_t *xdata)
+{
+ struct syncargs *args = NULL;
+
+ args = cookie;
+
+ args->op_ret = op_ret;
+ args->op_errno = op_errno;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ if (buf)
+ args->iatt1 = *buf;
+
+ __wake (args);
+
+ return 0;
+}
+
+int
+syncop_namelink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
+ struct iatt *postbuf, dict_t *xdata)
+{
+ struct syncargs *args = NULL;
+
+ args = cookie;
+
+ args->op_ret = op_ret;
+ args->op_errno = op_errno;
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ __wake (args);
+
+ return 0;
+}
+
+int
+syncop_icreate (xlator_t *subvol, loc_t *loc, mode_t mode, dict_t *xdata)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_icreate_cbk, subvol->fops->icreate,
+ loc, mode, xdata);
+
+ if (xdata)
+ xdata = args.xdata;
+ else if (args.xdata)
+ dict_unref (args.xdata);
+
+ errno = args.op_errno;
+ return args.op_ret;
+}
+
+int
+syncop_namelink (xlator_t *subvol, loc_t *loc, dict_t *xdata)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_namelink_cbk, subvol->fops->namelink,
+ loc, xdata);
+
+ if (xdata)
+ xdata = args.xdata;
+ else if (args.xdata)
+ dict_unref (args.xdata);
+
+ errno = args.op_errno;
+ return args.op_ret;
+}
diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h
index 8f84cb7c4a..3b2556535b 100644
--- a/libglusterfs/src/syncop.h
+++ b/libglusterfs/src/syncop.h
@@ -569,4 +569,14 @@ syncop_put (xlator_t *subvol, loc_t *loc, mode_t mode, mode_t umask,
off_t offset, struct iobref *iobref, dict_t *xattr,
struct iatt *iatt, dict_t *xdata_in, dict_t **xdata_out);
+int
+syncop_setactivelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata);
+
+int
+syncop_icreate (xlator_t *subvol, loc_t *loc, mode_t mode, dict_t *xdata_out);
+
+int
+syncop_namelink (xlator_t *subvol, loc_t *loc, dict_t *xdata_out);
+
#endif /* _SYNCOP_H */
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 677dd6ce80..3e108312d6 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -106,6 +106,8 @@ fill_defaults (xlator_t *xl)
SET_DEFAULT_FOP (put);
SET_DEFAULT_FOP (getspec);
+ SET_DEFAULT_FOP (icreate);
+ SET_DEFAULT_FOP (namelink);
if (!xl->cbks)
xl->cbks = &default_cbks;
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index a3115f09c5..81199bd180 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -471,6 +471,16 @@ typedef int32_t (*fop_put_cbk_t) (call_frame_t *frame, void *cookie,
struct iatt *buf, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata);
+typedef int32_t (*fop_icreate_cbk_t) (call_frame_t *frame, void *cookie,
+ xlator_t *this, int32_t op_ret,
+ int32_t op_errno, inode_t *inode,
+ struct iatt *buf, dict_t *xdata);
+
+typedef int32_t (*fop_namelink_cbk_t) (call_frame_t *frame, void *cookie,
+ xlator_t *this, int32_t op_ret,
+ int32_t op_errno, struct iatt *prebuf,
+ struct iatt *postbuf, dict_t *xdata);
+
typedef int32_t (*fop_lookup_t) (call_frame_t *frame,
xlator_t *this,
loc_t *loc,
@@ -737,6 +747,12 @@ typedef int32_t (*fop_put_t) (call_frame_t *frame, xlator_t *this, loc_t *loc,
struct iobref *iobref, dict_t *xattr,
dict_t *xdata);
+typedef int32_t (*fop_icreate_t) (call_frame_t *frame, xlator_t *this,
+ loc_t *loc, mode_t mode, dict_t *xdata);
+
+typedef int32_t (*fop_namelink_t) (call_frame_t *frame, xlator_t *this,
+ loc_t *loc, dict_t *xdata);
+
/* WARNING: make sure the list is in order with FOP definition in
`rpc/xdr/src/glusterfs-fops.x`.
If it is not in order, mainly the metrics related feature would be broken */
@@ -799,6 +815,8 @@ struct xlator_fops {
fop_getactivelk_t getactivelk;
fop_setactivelk_t setactivelk;
fop_put_t put;
+ fop_icreate_t icreate;
+ fop_namelink_t namelink;
/* these entries are used for a typechecking hack in STACK_WIND _only_ */
/* make sure to add _cbk variables only after defining regular fops as
@@ -861,6 +879,8 @@ struct xlator_fops {
fop_getactivelk_cbk_t getactivelk_cbk;
fop_setactivelk_cbk_t setactivelk_cbk;
fop_put_cbk_t put_cbk;
+ fop_icreate_cbk_t icreate_cbk;
+ fop_namelink_cbk_t namelink_cbk;
};
typedef int32_t (*cbk_forget_t) (xlator_t *this,