diff options
| author | Sunil Kumar Acharya <sheggodu@redhat.com> | 2017-04-28 18:09:01 +0530 | 
|---|---|---|
| committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2017-10-06 01:42:06 +0000 | 
| commit | 12cfc1983fa1521d6da94ad488145182cf97db2c (patch) | |
| tree | 2249e81dd6176d6752b7155c835b0c9988ec505a /libglusterfs/src/cluster-syncop.h | |
| parent | deea16e59564575d5f211f4fb8e4e5597e570ad1 (diff) | |
cluster/ec: Improve performance with xattrop update
Existing EC code updates the xattr on the subvolume
in a sequential pattern resulting in very poor performance.
With this fix EC now updates the xattr on the subvolume
in parallel which improves the xattr update performance.
BUG: 1445663
Change-Id: I3fc40d66db0b88875ca96a9fa01002ba386c0486
Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
Diffstat (limited to 'libglusterfs/src/cluster-syncop.h')
| -rw-r--r-- | libglusterfs/src/cluster-syncop.h | 49 | 
1 files changed, 49 insertions, 0 deletions
diff --git a/libglusterfs/src/cluster-syncop.h b/libglusterfs/src/cluster-syncop.h index 7e17faae0e0..ff9387acace 100644 --- a/libglusterfs/src/cluster-syncop.h +++ b/libglusterfs/src/cluster-syncop.h @@ -20,6 +20,46 @@  #include "default-args.h"  #include "syncop.h" +/********************************************************************* + * + * PARALLEL_FOP_ONLIST: + *          Performs file operations in parallel on bricks. + * This macro expects a helper function(func) to implement the + * functionality. + * + ********************************************************************/ +#define PARALLEL_FOP_ONLIST(subvols, on, numsubvols, replies, frame,    \ +                            func, args ...)                             \ +do {                                                                    \ +        int __i = 0;                                                    \ +        int __count = 0;                                                \ +        cluster_local_t __local = {0,};                                 \ +        void    *__old_local = frame->local;                            \ +                                                                        \ +        __local.replies = replies;                                      \ +        cluster_replies_wipe (replies, numsubvols);                     \ +        for (__i = 0; __i < numsubvols; __i++)                          \ +                INIT_LIST_HEAD (&replies[__i].entries.list);            \ +        if (syncbarrier_init (&__local.barrier))                        \ +                break;                                                  \ +        frame->local = &__local;                                        \ +        for (__i = 0; __i < numsubvols; __i++) {                        \ +                if (on[__i]) {                                          \ +                        __count++;                                      \ +                }                                                       \ +        }                                                               \ +        __local.barrier.waitfor = __count;                              \ +        for (__i = 0; __i < numsubvols; __i++) {                        \ +                if (on[__i]) {                                          \ +                        func (frame, subvols[__i], __i, ## args);       \ +                }                                                       \ +        }                                                               \ +        syncbarrier_wait (&__local.barrier, __count);                   \ +        syncbarrier_destroy (&__local.barrier);                         \ +        frame->local = __old_local;                                     \ +        STACK_RESET (frame->root);                                      \ +} while (0) +  typedef struct cluster_local_ {          default_args_cbk_t *replies;          syncbarrier_t barrier; @@ -160,4 +200,13 @@ cluster_fsetattr (xlator_t **subvols, unsigned char *on, int numsubvols,  void  cluster_replies_wipe (default_args_cbk_t *replies, int num_subvols); + +int32_t +cluster_fop_success_fill (default_args_cbk_t *replies, int numsubvols, +                          unsigned char *success); + +int32_t +cluster_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, +                     int32_t op_ret, int32_t op_errno, dict_t *dict, +                     dict_t *xdata);  #endif /* !_CLUSTER_SYNCOP_H */  | 
