summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/call-stub.c57
-rw-r--r--libglusterfs/src/call-stub.h15
-rw-r--r--libglusterfs/src/cluster-syncop.c26
-rw-r--r--libglusterfs/src/cluster-syncop.h8
-rw-r--r--libglusterfs/src/default-args.c40
-rw-r--r--libglusterfs/src/default-args.h9
-rw-r--r--libglusterfs/src/defaults-tmpl.c1
-rw-r--r--libglusterfs/src/defaults.h25
-rwxr-xr-xlibglusterfs/src/generator.py18
-rw-r--r--libglusterfs/src/globals.c2
-rw-r--r--libglusterfs/src/syncop.c49
-rw-r--r--libglusterfs/src/syncop.h6
-rw-r--r--libglusterfs/src/xlator.c1
-rw-r--r--libglusterfs/src/xlator.h14
14 files changed, 271 insertions, 0 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c
index 9aa67aab6c2..74a64294528 100644
--- a/libglusterfs/src/call-stub.c
+++ b/libglusterfs/src/call-stub.c
@@ -1968,6 +1968,47 @@ out:
}
+call_stub_t *
+fop_put_stub (call_frame_t *frame, fop_put_t fn,
+ loc_t *loc, mode_t mode, mode_t umask, uint32_t flags,
+ struct iovec *vector, int32_t count, off_t offset,
+ struct iobref *iobref, dict_t *xattr, dict_t *xdata)
+{
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", vector, out);
+
+ stub = stub_new (frame, 1, GF_FOP_PUT);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ stub->fn.put = fn;
+ args_put_store (&stub->args, loc, mode, umask, flags, vector,
+ count, offset, iobref, xattr, xdata);
+out:
+ return stub;
+}
+
+call_stub_t *
+fop_put_cbk_stub (call_frame_t *frame, fop_put_cbk_t fn,
+ int32_t op_ret, int32_t op_errno, inode_t *inode,
+ struct iatt *buf, struct iatt *preparent,
+ struct iatt *postparent, dict_t *xdata)
+{
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+
+ stub = stub_new (frame, 0, GF_FOP_PUT);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ stub->fn_cbk.put = fn;
+ args_put_cbk_store (&stub->args_cbk, op_ret, op_errno, inode,
+ buf, preparent, postparent, xdata);
+out:
+ return stub;
+}
+
void
call_resume_wind (call_stub_t *stub)
{
@@ -2226,6 +2267,14 @@ call_resume_wind (call_stub_t *stub)
stub->args.xdata);
break;
+ case GF_FOP_PUT:
+ stub->fn.put (stub->frame, stub->frame->this,
+ &stub->args.loc, stub->args.mode, stub->args.umask,
+ stub->args.flags, stub->args.vector,
+ stub->args.count, stub->args.offset,
+ stub->args.iobref, stub->args.xattr,
+ stub->args.xdata);
+
default:
gf_msg_callingfn ("call-stub", GF_LOG_ERROR, EINVAL,
LG_MSG_INVALID_ENTRY, "Invalid value of FOP"
@@ -2453,6 +2502,14 @@ call_resume_unwind (call_stub_t *stub)
STUB_UNWIND (stub, setactivelk, stub->args_cbk.xdata);
break;
+ case GF_FOP_PUT:
+ STUB_UNWIND (stub, put, stub->args_cbk.inode,
+ &stub->args_cbk.stat,
+ &stub->args_cbk.preparent,
+ &stub->args_cbk.postparent,
+ stub->args_cbk.xdata);
+ break;
+
default:
gf_msg_callingfn ("call-stub", GF_LOG_ERROR, EINVAL,
LG_MSG_INVALID_ENTRY, "Invalid value of FOP"
diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h
index 59868d414e3..4d86a517537 100644
--- a/libglusterfs/src/call-stub.h
+++ b/libglusterfs/src/call-stub.h
@@ -14,6 +14,7 @@
#include "xlator.h"
#include "defaults.h"
#include "default-args.h"
+#include "stack.h"
#include "list.h"
typedef struct _call_stub {
@@ -76,6 +77,7 @@ typedef struct _call_stub {
fop_lease_t lease;
fop_getactivelk_t getactivelk;
fop_setactivelk_t setactivelk;
+ fop_put_t put;
} fn;
union {
@@ -128,6 +130,7 @@ typedef struct _call_stub {
fop_lease_cbk_t lease;
fop_getactivelk_cbk_t getactivelk;
fop_setactivelk_cbk_t setactivelk;
+ fop_put_cbk_t put;
} fn_cbk;
default_args_t args;
@@ -761,6 +764,18 @@ call_stub_t *
fop_setactivelk_cbk_stub (call_frame_t *frame, fop_setactivelk_cbk_t fn,
int32_t op_ret, int32_t op_errno, dict_t *xdata);
+call_stub_t *
+fop_put_stub (call_frame_t *frame, fop_put_t fn, loc_t *loc,
+ mode_t mode, mode_t umask, uint32_t flags,
+ struct iovec *vector, int32_t count, off_t offset,
+ struct iobref *iobref, dict_t *xattr, dict_t *xdata);
+
+call_stub_t *
+fop_put_cbk_stub (call_frame_t *frame, fop_put_cbk_t fn, int32_t op_ret,
+ int32_t op_errno, inode_t *inode, struct iatt *buf,
+ struct iatt *preparent, struct iatt *postparent,
+ dict_t *xdata);
+
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/cluster-syncop.c b/libglusterfs/src/cluster-syncop.c
index 50542eb7c16..aa9cea75ba3 100644
--- a/libglusterfs/src/cluster-syncop.c
+++ b/libglusterfs/src/cluster-syncop.c
@@ -304,6 +304,18 @@ cluster_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t
+cluster_put_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,
+ struct iatt *postparent, dict_t *xdata)
+{
+ FOP_CBK (put, frame, cookie, op_ret, op_errno, inode, buf, preparent,
+ postparent, xdata);
+ return 0;
+}
+
+
+int32_t
cluster_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
dict_t *xdata)
@@ -686,6 +698,20 @@ cluster_writev (xlator_t **subvols, unsigned char *on, int numsubvols,
}
int32_t
+cluster_put (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, uint32_t flags, struct iovec *vector,
+ int32_t count, off_t offset, struct iobref *iobref, dict_t *xattr,
+ dict_t *xdata)
+{
+ FOP_ONLIST (subvols, on, numsubvols, replies, output, frame, put, loc,
+ mode, umask, flags, vector, count, offset, iobref, xattr,
+ xdata);
+ return cluster_fop_success_fill (replies, numsubvols, output);
+}
+
+int32_t
cluster_readv (xlator_t **subvols, unsigned char *on, int numsubvols,
default_args_cbk_t *replies, unsigned char *output,
call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
diff --git a/libglusterfs/src/cluster-syncop.h b/libglusterfs/src/cluster-syncop.h
index b91a09ea681..9127dde6dfb 100644
--- a/libglusterfs/src/cluster-syncop.h
+++ b/libglusterfs/src/cluster-syncop.h
@@ -198,6 +198,14 @@ cluster_fsetattr (xlator_t **subvols, unsigned char *on, int numsubvols,
call_frame_t *frame, xlator_t *this, fd_t *fd,
struct iatt *stbuf, int32_t valid, dict_t *xdata);
+int32_t
+cluster_put (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, uint32_t flags, struct iovec *vector,
+ int32_t count, off_t offset, struct iobref *iobref, dict_t *xattr,
+ dict_t *xdata);
+
void
cluster_replies_wipe (default_args_cbk_t *replies, int num_subvols);
diff --git a/libglusterfs/src/default-args.c b/libglusterfs/src/default-args.c
index f40de2dae68..9ac0f400493 100644
--- a/libglusterfs/src/default-args.c
+++ b/libglusterfs/src/default-args.c
@@ -594,6 +594,46 @@ args_writev_cbk_store (default_args_cbk_t *args,
}
int
+args_put_store (default_args_t *args, 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)
+{
+ loc_copy (&args->loc, loc);
+ args->mode = mode;
+ args->umask = umask;
+ args->flags = flags;
+ args->vector = iov_dup (vector, count);
+ args->count = count;
+ args->offset = off;
+ args->iobref = iobref_ref (iobref);
+ if (xattr)
+ args->xattr = dict_ref (xattr);
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
+args_put_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 (op_ret >= 0)
+ args->stat = *buf;
+ if (inode)
+ args->inode = inode_ref (inode);
+ if (preparent)
+ args->preparent = *preparent;
+ if (postparent)
+ args->postparent = *postparent;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ return 0;
+}
+int
args_flush_store (default_args_t *args, fd_t *fd, dict_t *xdata)
{
if (fd)
diff --git a/libglusterfs/src/default-args.h b/libglusterfs/src/default-args.h
index a2201dd4703..f97d8830de9 100644
--- a/libglusterfs/src/default-args.h
+++ b/libglusterfs/src/default-args.h
@@ -125,6 +125,10 @@ 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_put_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_flush_cbk_store (default_args_cbk_t *args,
@@ -349,6 +353,11 @@ args_writev_store (default_args_t *args, fd_t *fd, struct iovec *vector,
struct iobref *iobref, dict_t *xdata);
int
+args_put_store (default_args_t *args, 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);
+
+int
args_flush_store (default_args_t *args, fd_t *fd, dict_t *xdata);
int
diff --git a/libglusterfs/src/defaults-tmpl.c b/libglusterfs/src/defaults-tmpl.c
index d311972f0c0..21b99d9566c 100644
--- a/libglusterfs/src/defaults-tmpl.c
+++ b/libglusterfs/src/defaults-tmpl.c
@@ -81,6 +81,7 @@ struct xlator_fops _default_fops = {
.getspec = default_getspec,
.getactivelk = default_getactivelk,
.setactivelk = default_setactivelk,
+ .put = default_put,
};
struct xlator_fops *default_fops = &_default_fops;
diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h
index 9b4f4828e91..c202dbe4941 100644
--- a/libglusterfs/src/defaults.h
+++ b/libglusterfs/src/defaults.h
@@ -354,6 +354,11 @@ int32_t
default_setactivelk (call_frame_t *frame, xlator_t *this, loc_t *loc,
lock_migration_info_t *locklist, dict_t *xdata);
+int32_t
+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);
+
/* Resume */
int32_t default_getspec_resume (call_frame_t *frame,
xlator_t *this,
@@ -599,6 +604,12 @@ int32_t
default_setactivelk_resume (call_frame_t *frame, xlator_t *this, loc_t *loc,
lock_migration_info_t *locklist, dict_t *xdata);
+int32_t
+default_put_resume (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);
+
/* _cbk_resume */
int32_t
@@ -895,6 +906,12 @@ default_setactivelk_cbk_resume (call_frame_t *frame, void *cookie,
xlator_t *this, int32_t op_ret,
int32_t op_errno, dict_t *xdata);
+int32_t
+default_put_cbk_resume (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,
+ struct iatt *postparent, dict_t *xdata);
+
/* _CBK */
int32_t
default_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
@@ -1142,6 +1159,11 @@ int32_t
default_setactivelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata);
+int32_t
+default_put_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,
+ struct iatt *postparent, dict_t *xdata);
int32_t
default_lookup_failure_cbk (call_frame_t *frame, int32_t op_errno);
@@ -1296,6 +1318,9 @@ int32_t
default_setactivelk_failure_cbk (call_frame_t *frame, int32_t op_errno);
int32_t
+default_put_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 7bd4c21cb3a..d9262e473b7 100755
--- a/libglusterfs/src/generator.py
+++ b/libglusterfs/src/generator.py
@@ -557,6 +557,24 @@ ops['setactivelk'] = (
('cbk-arg', 'xdata', 'dict_t *'),
)
+ops['put'] = (
+ ('fop-arg', 'loc', 'loc_t *', 'loc'),
+ ('fop-arg', 'mode', 'mode_t', 'mode'),
+ ('fop-arg', 'umask', 'mode_t', 'umask'),
+ ('fop-arg', 'flags', 'uint32_t', 'flags'),
+ ('fop-arg', 'vector', 'struct iovec *', 'vector'),
+ ('fop-arg', 'count', 'int32_t'),
+ ('fop-arg', 'off', 'off_t', 'offset'),
+ ('fop-arg', 'iobref', 'struct iobref *'),
+ ('fop-arg', 'dict', 'dict_t *', 'xattr'),
+ ('fop-arg', 'xdata', 'dict_t *', 'xdata'),
+ ('cbk-arg', 'inode', 'inode_t *'),
+ ('cbk-arg', 'buf', 'struct iatt *'),
+ ('cbk-arg', 'preparent', 'struct iatt *'),
+ ('cbk-arg', 'postparent', '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 1c733840f46..1c574463123 100644
--- a/libglusterfs/src/globals.c
+++ b/libglusterfs/src/globals.c
@@ -11,6 +11,7 @@
#include <pthread.h>
#include "glusterfs.h"
+#include "globals.h"
#include "xlator.h"
#include "mem-pool.h"
#include "syncop.h"
@@ -73,6 +74,7 @@ const char *gf_fop_list[GF_FOP_MAXVALUE] = {
[GF_FOP_COMPOUND] = "COMPOUND",
[GF_FOP_GETACTIVELK] = "GETACTIVELK",
[GF_FOP_SETACTIVELK] = "SETACTIVELK",
+ [GF_FOP_PUT] = "PUT",
};
const char *gf_upcall_list[GF_UPCALL_FLAGS_MAXVALUE] = {
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index b36c88dc829..a4882f5eef2 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -2080,6 +2080,55 @@ syncop_create (xlator_t *subvol, loc_t *loc, int32_t flags, mode_t mode,
}
+int32_t
+syncop_put_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,
+ struct iatt *postparent, 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_put (xlator_t *subvol, loc_t *loc, mode_t mode, mode_t umask,
+ uint32_t flags, struct iovec *vector, int32_t count,
+ off_t offset, struct iobref *iobref, dict_t *xattr,
+ struct iatt *iatt, dict_t *xdata_in, dict_t **xdata_out)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_put_cbk, subvol->fops->put,
+ loc, mode, umask, flags, (struct iovec *) vector, count,
+ offset, iobref, xattr, xdata_in);
+
+ if (iatt)
+ *iatt = args.iatt1;
+
+ if (xdata_out)
+ *xdata_out = args.xdata;
+ else if (args.xdata)
+ dict_unref (args.xdata);
+
+ if (args.op_ret < 0)
+ return -args.op_errno;
+ return args.op_ret;
+
+}
+
int
syncop_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno, struct iatt *preparent,
diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h
index c64b483e85c..8f84cb7c4a4 100644
--- a/libglusterfs/src/syncop.h
+++ b/libglusterfs/src/syncop.h
@@ -563,4 +563,10 @@ syncop_setactivelk (xlator_t *subvol, loc_t *loc,
lock_migration_info_t *locklist, dict_t *xdata_in,
dict_t **xdata_out);
+int
+syncop_put (xlator_t *subvol, loc_t *loc, mode_t mode, mode_t umask,
+ uint32_t flags, struct iovec *vector, int32_t count,
+ off_t offset, struct iobref *iobref, dict_t *xattr,
+ struct iatt *iatt, dict_t *xdata_in, dict_t **xdata_out);
+
#endif /* _SYNCOP_H */
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index ed1d95d01e1..677dd6ce80f 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -103,6 +103,7 @@ fill_defaults (xlator_t *xl)
SET_DEFAULT_FOP (lease);
SET_DEFAULT_FOP (getactivelk);
SET_DEFAULT_FOP (setactivelk);
+ SET_DEFAULT_FOP (put);
SET_DEFAULT_FOP (getspec);
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index de353fe702d..a3115f09c52 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -465,6 +465,12 @@ typedef int32_t (*fop_setactivelk_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_put_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, struct iatt *preparent,
+ struct iatt *postparent, dict_t *xdata);
+
typedef int32_t (*fop_lookup_t) (call_frame_t *frame,
xlator_t *this,
loc_t *loc,
@@ -725,6 +731,12 @@ typedef int32_t (*fop_setactivelk_t) (call_frame_t *frame, xlator_t *this,
lock_migration_info_t *locklist,
dict_t *xdata);
+typedef int32_t (*fop_put_t) (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 offset,
+ struct iobref *iobref, dict_t *xattr,
+ 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 */
@@ -786,6 +798,7 @@ struct xlator_fops {
fop_compound_t compound;
fop_getactivelk_t getactivelk;
fop_setactivelk_t setactivelk;
+ fop_put_t put;
/* these entries are used for a typechecking hack in STACK_WIND _only_ */
/* make sure to add _cbk variables only after defining regular fops as
@@ -847,6 +860,7 @@ struct xlator_fops {
fop_compound_cbk_t compound_cbk;
fop_getactivelk_cbk_t getactivelk_cbk;
fop_setactivelk_cbk_t setactivelk_cbk;
+ fop_put_cbk_t put_cbk;
};
typedef int32_t (*cbk_forget_t) (xlator_t *this,