summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/syncop.c
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2012-03-20 17:22:24 +0530
committerAnand Avati <avati@redhat.com>2012-03-22 16:40:27 -0700
commit9d3af972f516b6ba38d2736ce2016e34a452d569 (patch)
tree1dcdc620748a42cdfb5464c3adaae5a4a3a6f869 /libglusterfs/src/syncop.c
parentafe542eca18888463798747d2a95e5a9d239a4a0 (diff)
core: adding extra data for fops
with this change, the xlator APIs will have a dictionary as extra argument, which is passed between all the layers. This can be utilized for overloading in some of the operations. Change-Id: I58a8186b3ef647650280e63f3e5e9b9de7827b40 Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 782265 Reviewed-on: http://review.gluster.com/2960 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs/src/syncop.c')
-rw-r--r--libglusterfs/src/syncop.c122
1 files changed, 62 insertions, 60 deletions
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index 47bb013..e407ab7 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -423,7 +423,7 @@ syncenv_new (size_t stacksize)
int
syncop_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno, inode_t *inode,
- struct iatt *iatt, dict_t *xattr, struct iatt *parent)
+ struct iatt *iatt, dict_t *xdata, struct iatt *parent)
{
struct syncargs *args = NULL;
@@ -435,8 +435,8 @@ syncop_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret == 0) {
args->iatt1 = *iatt;
args->iatt2 = *parent;
- if (xattr)
- args->xattr = dict_ref (xattr);
+ if (xdata)
+ args->xdata = dict_ref (xdata);
}
__wake (args);
@@ -446,22 +446,22 @@ syncop_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-syncop_lookup (xlator_t *subvol, loc_t *loc, dict_t *xattr_req,
- struct iatt *iatt, dict_t **xattr_rsp, struct iatt *parent)
+syncop_lookup (xlator_t *subvol, loc_t *loc, dict_t *xdata_req,
+ struct iatt *iatt, dict_t **xdata_rsp, struct iatt *parent)
{
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_lookup_cbk, subvol->fops->lookup,
- loc, xattr_req);
+ loc, xdata_req);
if (iatt)
*iatt = args.iatt1;
if (parent)
*parent = args.iatt2;
- if (xattr_rsp)
- *xattr_rsp = args.xattr;
- else if (args.xattr)
- dict_unref (args.xattr);
+ if (xdata_rsp)
+ *xdata_rsp = args.xdata;
+ else if (args.xdata)
+ dict_unref (args.xdata);
errno = args.op_errno;
return args.op_ret;
@@ -488,7 +488,7 @@ syncop_readdirp_cbk (call_frame_t *frame,
xlator_t *this,
int32_t op_ret,
int32_t op_errno,
- gf_dirent_t *entries)
+ gf_dirent_t *entries, dict_t *xdata)
{
struct syncargs *args = NULL;
gf_dirent_t *entry = NULL;
@@ -548,7 +548,7 @@ syncop_readdir_cbk (call_frame_t *frame,
xlator_t *this,
int32_t op_ret,
int32_t op_errno,
- gf_dirent_t *entries)
+ gf_dirent_t *entries, dict_t *xdata)
{
struct syncargs *args = NULL;
gf_dirent_t *entry = NULL;
@@ -590,7 +590,7 @@ syncop_readdir (xlator_t *subvol,
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_readdir_cbk, subvol->fops->readdir,
- fd, size, off);
+ fd, size, off, NULL);
if (entries)
list_splice_init (&args.entries.list, &entries->list);
@@ -607,7 +607,7 @@ syncop_opendir_cbk (call_frame_t *frame,
xlator_t *this,
int32_t op_ret,
int32_t op_errno,
- fd_t *fd)
+ fd_t *fd, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -629,7 +629,7 @@ syncop_opendir (xlator_t *subvol,
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_opendir_cbk, subvol->fops->opendir,
- loc, fd);
+ loc, fd, NULL);
errno = args.op_errno;
return args.op_ret;
@@ -638,7 +638,7 @@ syncop_opendir (xlator_t *subvol,
int
syncop_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno)
+ int op_ret, int op_errno, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -658,7 +658,7 @@ syncop_removexattr (xlator_t *subvol, loc_t *loc, const char *name)
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_removexattr_cbk, subvol->fops->removexattr,
- loc, name);
+ loc, name, NULL);
errno = args.op_errno;
return args.op_ret;
@@ -666,7 +666,7 @@ syncop_removexattr (xlator_t *subvol, loc_t *loc, const char *name)
int
syncop_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno)
+ int op_ret, int op_errno, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -686,7 +686,7 @@ syncop_fremovexattr (xlator_t *subvol, fd_t *fd, const char *name)
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_fremovexattr_cbk,
- subvol->fops->fremovexattr, fd, name);
+ subvol->fops->fremovexattr, fd, name, NULL);
errno = args.op_errno;
return args.op_ret;
@@ -694,7 +694,7 @@ syncop_fremovexattr (xlator_t *subvol, fd_t *fd, const char *name)
int
syncop_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno)
+ int op_ret, int op_errno, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -715,7 +715,7 @@ syncop_setxattr (xlator_t *subvol, loc_t *loc, dict_t *dict, int32_t flags)
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_setxattr_cbk, subvol->fops->setxattr,
- loc, dict, flags);
+ loc, dict, flags, NULL);
errno = args.op_errno;
return args.op_ret;
@@ -723,7 +723,7 @@ syncop_setxattr (xlator_t *subvol, loc_t *loc, dict_t *dict, int32_t flags)
int
syncop_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno)
+ int op_ret, int op_errno, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -744,7 +744,7 @@ syncop_fsetxattr (xlator_t *subvol, fd_t *fd, dict_t *dict, int32_t flags)
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_fsetxattr_cbk, subvol->fops->fsetxattr,
- fd, dict, flags);
+ fd, dict, flags, NULL);
errno = args.op_errno;
return args.op_ret;
@@ -752,7 +752,7 @@ syncop_fsetxattr (xlator_t *subvol, fd_t *fd, dict_t *dict, int32_t flags)
int
syncop_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, dict_t *dict)
+ int op_ret, int op_errno, dict_t *dict, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -774,7 +774,7 @@ syncop_listxattr (xlator_t *subvol, loc_t *loc, dict_t **dict)
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_getxattr_cbk, subvol->fops->getxattr,
- loc, NULL);
+ loc, NULL, NULL);
if (dict)
*dict = args.xattr;
@@ -791,7 +791,7 @@ syncop_getxattr (xlator_t *subvol, loc_t *loc, dict_t **dict, const char *key)
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_getxattr_cbk, subvol->fops->getxattr,
- loc, key);
+ loc, key, NULL);
if (dict)
*dict = args.xattr;
@@ -808,7 +808,7 @@ syncop_fgetxattr (xlator_t *subvol, fd_t *fd, dict_t **dict, const char *key)
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_getxattr_cbk, subvol->fops->fgetxattr,
- fd, key);
+ fd, key, NULL);
if (dict)
*dict = args.xattr;
@@ -822,7 +822,7 @@ syncop_fgetxattr (xlator_t *subvol, fd_t *fd, dict_t **dict, const char *key)
int
syncop_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
- struct statvfs *buf)
+ struct statvfs *buf, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -849,7 +849,7 @@ syncop_statfs (xlator_t *subvol, loc_t *loc, struct statvfs *buf)
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_statfs_cbk, subvol->fops->statfs,
- loc);
+ loc, NULL);
if (buf)
*buf = args.statvfs_buf;
@@ -861,7 +861,7 @@ syncop_statfs (xlator_t *subvol, loc_t *loc, struct statvfs *buf)
int
syncop_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno,
- struct iatt *preop, struct iatt *postop)
+ struct iatt *preop, struct iatt *postop, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -888,7 +888,7 @@ syncop_setattr (xlator_t *subvol, loc_t *loc, struct iatt *iatt, int valid,
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_setattr_cbk, subvol->fops->setattr,
- loc, iatt, valid);
+ loc, iatt, valid, NULL);
if (preop)
*preop = args.iatt1;
@@ -907,7 +907,7 @@ syncop_fsetattr (xlator_t *subvol, fd_t *fd, struct iatt *iatt, int valid,
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_setattr_cbk, subvol->fops->fsetattr,
- fd, iatt, valid);
+ fd, iatt, valid, NULL);
if (preop)
*preop = args.iatt1;
@@ -921,7 +921,7 @@ syncop_fsetattr (xlator_t *subvol, fd_t *fd, struct iatt *iatt, int valid,
int32_t
syncop_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, fd_t *fd)
+ int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -944,7 +944,7 @@ syncop_open (xlator_t *subvol, loc_t *loc, int32_t flags, fd_t *fd)
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_open_cbk, subvol->fops->open,
- loc, flags, fd, 0);
+ loc, flags, fd, NULL);
errno = args.op_errno;
return args.op_ret;
@@ -955,7 +955,8 @@ syncop_open (xlator_t *subvol, loc_t *loc, int32_t flags, fd_t *fd)
int32_t
syncop_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iovec *vector,
- int32_t count, struct iatt *stbuf, struct iobref *iobref)
+ int32_t count, struct iatt *stbuf, struct iobref *iobref,
+ dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -987,7 +988,7 @@ syncop_readv (xlator_t *subvol, fd_t *fd, size_t size, off_t off,
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_readv_cbk, subvol->fops->readv,
- fd, size, off, flags);
+ fd, size, off, flags, NULL);
if (vector)
*vector = args.vector;
@@ -1011,7 +1012,7 @@ syncop_readv (xlator_t *subvol, fd_t *fd, size_t size, off_t off,
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)
+ struct iatt *postbuf, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -1033,7 +1034,7 @@ syncop_writev (xlator_t *subvol, fd_t *fd, struct iovec *vector,
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_writev_cbk, subvol->fops->writev,
- fd, vector, count, offset, flags, iobref);
+ fd, vector, count, offset, flags, iobref, NULL);
errno = args.op_errno;
return args.op_ret;
@@ -1049,7 +1050,7 @@ int syncop_write (xlator_t *subvol, fd_t *fd, const char *buf, int size,
vec.iov_base = (void *)buf;
SYNCOP (subvol, (&args), syncop_writev_cbk, subvol->fops->writev,
- fd, &vec, 1, offset, flags, iobref);
+ fd, &vec, 1, offset, flags, iobref, NULL);
errno = args.op_errno;
return args.op_ret;
@@ -1068,7 +1069,7 @@ int32_t
syncop_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode,
struct iatt *buf, struct iatt *preparent,
- struct iatt *postparent)
+ struct iatt *postparent, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -1087,12 +1088,12 @@ syncop_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
syncop_create (xlator_t *subvol, loc_t *loc, int32_t flags, mode_t mode,
- fd_t *fd, dict_t *dict)
+ fd_t *fd, dict_t *xdata)
{
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_create_cbk, subvol->fops->create,
- loc, flags, mode, fd, dict);
+ loc, flags, mode, 0, fd, xdata);
errno = args.op_errno;
return args.op_ret;
@@ -1102,7 +1103,7 @@ syncop_create (xlator_t *subvol, loc_t *loc, int32_t flags, mode_t mode,
int
syncop_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno, struct iatt *preparent,
- struct iatt *postparent)
+ struct iatt *postparent, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -1121,7 +1122,8 @@ syncop_unlink (xlator_t *subvol, loc_t *loc)
{
struct syncargs args = {0, };
- SYNCOP (subvol, (&args), syncop_unlink_cbk, subvol->fops->unlink, loc);
+ SYNCOP (subvol, (&args), syncop_unlink_cbk, subvol->fops->unlink, loc,
+ 0, NULL);
errno = args.op_errno;
return args.op_ret;
@@ -1131,7 +1133,7 @@ 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,
- struct iatt *postparent)
+ struct iatt *postparent, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -1152,7 +1154,7 @@ syncop_link (xlator_t *subvol, loc_t *oldloc, loc_t *newloc)
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_link_cbk, subvol->fops->link,
- oldloc, newloc);
+ oldloc, newloc, NULL);
errno = args.op_errno;
@@ -1162,7 +1164,7 @@ syncop_link (xlator_t *subvol, loc_t *oldloc, loc_t *newloc)
int
syncop_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno, struct iatt *prebuf,
- struct iatt *postbuf)
+ struct iatt *postbuf, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -1182,7 +1184,7 @@ syncop_ftruncate (xlator_t *subvol, fd_t *fd, off_t offset)
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_ftruncate_cbk, subvol->fops->ftruncate,
- fd, offset);
+ fd, offset, NULL);
errno = args.op_errno;
return args.op_ret;
@@ -1194,7 +1196,7 @@ syncop_truncate (xlator_t *subvol, loc_t *loc, off_t offset)
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_ftruncate_cbk, subvol->fops->truncate,
- loc, offset);
+ loc, offset, NULL);
errno = args.op_errno;
return args.op_ret;
@@ -1203,7 +1205,7 @@ syncop_truncate (xlator_t *subvol, loc_t *loc, off_t offset)
int
syncop_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
- struct iatt *prebuf, struct iatt *postbuf)
+ struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -1224,7 +1226,7 @@ syncop_fsync (xlator_t *subvol, fd_t *fd)
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_fsync_cbk, subvol->fops->fsync,
- fd, 0);
+ fd, 0, NULL);
errno = args.op_errno;
return args.op_ret;
@@ -1233,7 +1235,7 @@ syncop_fsync (xlator_t *subvol, fd_t *fd)
int
syncop_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iatt *stbuf)
+ int32_t op_ret, int32_t op_errno, struct iatt *stbuf, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -1256,7 +1258,7 @@ syncop_fstat (xlator_t *subvol, fd_t *fd, struct iatt *stbuf)
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_fstat_cbk, subvol->fops->fstat,
- fd);
+ fd, NULL);
if (stbuf)
*stbuf = args.iatt1;
@@ -1272,7 +1274,7 @@ syncop_stat (xlator_t *subvol, loc_t *loc, struct iatt *stbuf)
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_fstat_cbk, subvol->fops->stat,
- loc);
+ loc, NULL);
if (stbuf)
*stbuf = args.iatt1;
@@ -1286,7 +1288,7 @@ int32_t
syncop_symlink_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)
+ struct iatt *postparent, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -1306,7 +1308,7 @@ syncop_symlink (xlator_t *subvol, loc_t *loc, char *newpath, dict_t *dict)
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_symlink_cbk, subvol->fops->symlink,
- newpath, loc, dict);
+ newpath, loc, 0, dict);
errno = args.op_errno;
return args.op_ret;
@@ -1316,7 +1318,7 @@ syncop_symlink (xlator_t *subvol, loc_t *loc, char *newpath, dict_t *dict)
int
syncop_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno, const char *path,
- struct iatt *stbuf)
+ struct iatt *stbuf, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -1339,7 +1341,7 @@ syncop_readlink (xlator_t *subvol, loc_t *loc, char **buffer, size_t size)
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_readlink_cbk, subvol->fops->readlink,
- loc, size);
+ loc, size, NULL);
if (buffer)
*buffer = args.buffer;
@@ -1354,7 +1356,7 @@ int
syncop_mknod_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)
+ struct iatt *postparent, dict_t *xdata)
{
struct syncargs *args = NULL;
@@ -1375,7 +1377,7 @@ syncop_mknod (xlator_t *subvol, loc_t *loc, mode_t mode, dev_t rdev,
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_mknod_cbk, subvol->fops->mknod,
- loc, mode, rdev, dict);
+ loc, mode, rdev, 0, dict);
errno = args.op_errno;
return args.op_ret;