diff options
| author | Susant Palai <spalai@redhat.com> | 2016-04-17 10:14:02 +0530 | 
|---|---|---|
| committer | Niels de Vos <ndevos@redhat.com> | 2016-05-01 18:04:21 -0700 | 
| commit | c4efd39d339535856c1a0a6b0fad2783587411c9 (patch) | |
| tree | bd6b6e2c632b42bda264f7cc0327cca4159e49a3 /libglusterfs/src/syncop.c | |
| parent | f1f6a0e2b09884151c37434bd512cb1482608218 (diff) | |
core: add getactivelk () fop
Change-Id: Ifd0ff278dcf43da064021f5c25e5dcd34347fcde
BUG: 1326085
Signed-off-by: Susant Palai <spalai@redhat.com>
Reviewed-on: http://review.gluster.org/13970
Smoke: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'libglusterfs/src/syncop.c')
| -rw-r--r-- | libglusterfs/src/syncop.c | 79 | 
1 files changed, 79 insertions, 0 deletions
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index 63b9973a2d1..4fa23002e24 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -3062,3 +3062,82 @@ syncop_fxattrop (xlator_t *subvol, fd_t *fd, gf_xattrop_flags_t flags,          return args.op_ret;  } + +int32_t +syncop_getactivelk_cbk (call_frame_t *frame, +                         void *cookie, +                         xlator_t *this, +                         int32_t op_ret, +                         int32_t op_errno, +                         lock_migration_info_t *locklist, dict_t *xdata) +{ +        struct syncargs *args = NULL; +        lock_migration_info_t   *tmp = NULL; +        lock_migration_info_t   *entry = NULL; + +        args = cookie; + +        INIT_LIST_HEAD (&args->locklist.list); + +        args->op_ret   = op_ret; +        args->op_errno = op_errno; +        if (xdata) +                args->xdata  = dict_ref (xdata); + +        if (op_ret > 0) { +                list_for_each_entry (tmp, &locklist->list, list) { +                        entry = GF_CALLOC (1, sizeof (lock_migration_info_t), +                                          gf_common_mt_char); + +                        if (!entry) { +                                gf_msg (THIS->name, GF_LOG_ERROR, 0, 0, +                                        "lock mem allocation  failed"); +                                gf_free_mig_locks (&args->locklist); + +                                break; +                        } + +                        INIT_LIST_HEAD (&entry->list); + +                        entry->flock = tmp->flock; + +                        entry->client_uid = gf_strdup (tmp->client_uid); + +                        list_add_tail (&entry->list, &args->locklist.list); + +                } +        } + +        __wake (args); + +        return 0; + +} + +int +syncop_getactivelk (xlator_t *subvol, loc_t *loc, +                    lock_migration_info_t *locklist,  dict_t *xdata_in, +                    dict_t **xdata_out) +{ +        struct syncargs args = {0, }; + +        SYNCOP (subvol, (&args), syncop_getactivelk_cbk, +                subvol->fops->getactivelk, +                loc, xdata_in); + +        if (locklist) +                list_splice_init (&args.locklist.list, &locklist->list); +        else +                gf_free_mig_locks (&args.locklist) ; + +        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; + +}  | 
