From 429550b75d2b97f24a102cc648bf9d8240965f93 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Thu, 13 Oct 2011 12:59:41 +0530 Subject: distribute: handle migration of symlink and special files TODO: currently, wrt. rebalance/decommissioning, only pending thing is hardlink migration. Change-Id: I30cd06802e84c95601a5a081198f1f09c6d6bc01 BUG: 3714 Reviewed-on: http://review.gluster.com/578 Tested-by: Gluster Build System Reviewed-by: Shishir Gowda Reviewed-by: Vijay Bellur --- libglusterfs/src/syncop.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) (limited to 'libglusterfs/src/syncop.c') diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index 1380d15f3..a9b49bb58 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -985,3 +985,101 @@ syncop_stat (xlator_t *subvol, loc_t *loc, struct iatt *stbuf) return args.op_ret; } + +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 syncargs *args = NULL; + + args = cookie; + + args->op_ret = op_ret; + args->op_errno = op_errno; + + __wake (args); + + return 0; +} + +int +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); + + errno = args.op_errno; + return args.op_ret; + +} + +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 syncargs *args = NULL; + + args = cookie; + + args->op_ret = op_ret; + args->op_errno = op_errno; + + if ((op_ret != -1) && path) + args->buffer = gf_strdup (path); + + __wake (args); + + return 0; +} + +int +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); + + if (buffer) + *buffer = args.buffer; + + errno = args.op_errno; + return args.op_ret; +} + +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 syncargs *args = NULL; + + args = cookie; + + args->op_ret = op_ret; + args->op_errno = op_errno; + + __wake (args); + + return 0; +} + +int +syncop_mknod (xlator_t *subvol, loc_t *loc, mode_t mode, dev_t rdev, + dict_t *dict) +{ + struct syncargs args = {0, }; + + SYNCOP (subvol, (&args), syncop_mknod_cbk, subvol->fops->mknod, + loc, mode, rdev, dict); + + errno = args.op_errno; + return args.op_ret; + +} -- cgit