diff options
Diffstat (limited to 'libglusterfs/src/syncop.c')
-rw-r--r-- | libglusterfs/src/syncop.c | 263 |
1 files changed, 246 insertions, 17 deletions
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) |