"Fossies" - the Fresh Open Source Software Archive

Member "glusterfs-8.2/libglusterfs/src/glusterfs/cluster-syncop.h" (16 Sep 2020, 10849 Bytes) of package /linux/misc/glusterfs-8.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "cluster-syncop.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2   Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
    3   This file is part of GlusterFS.
    4 
    5   This file is licensed to you under your choice of the GNU Lesser
    6   General Public License, version 3 or any later version (LGPLv3 or
    7   later), or the GNU General Public License, version 2 (GPLv2), in all
    8   cases as published by the Free Software Foundation.
    9 */
   10 
   11 #ifndef _CLUSTER_SYNCOP_H
   12 #define _CLUSTER_SYNCOP_H
   13 
   14 #include <sys/time.h>
   15 #include <pthread.h>
   16 #include <ucontext.h>
   17 
   18 #include "glusterfs/defaults.h"
   19 #include "glusterfs/default-args.h"
   20 #include "glusterfs/syncop.h"
   21 
   22 /*********************************************************************
   23  *
   24  * PARALLEL_FOP_ONLIST:
   25  *          Performs file operations in parallel on bricks.
   26  * This macro expects a helper function(func) to implement the
   27  * functionality.
   28  *
   29  ********************************************************************/
   30 #define PARALLEL_FOP_ONLIST(subvols, on, numsubvols, replies, frame, func,     \
   31                             args...)                                           \
   32     do {                                                                       \
   33         int __i = 0;                                                           \
   34         int __count = 0;                                                       \
   35         cluster_local_t __local = {                                            \
   36             0,                                                                 \
   37         };                                                                     \
   38         void *__old_local = frame->local;                                      \
   39                                                                                \
   40         __local.replies = replies;                                             \
   41         cluster_replies_wipe(replies, numsubvols);                             \
   42         for (__i = 0; __i < numsubvols; __i++)                                 \
   43             INIT_LIST_HEAD(&replies[__i].entries.list);                        \
   44         if (syncbarrier_init(&__local.barrier))                                \
   45             break;                                                             \
   46         frame->local = &__local;                                               \
   47         for (__i = 0; __i < numsubvols; __i++) {                               \
   48             if (on[__i]) {                                                     \
   49                 __count++;                                                     \
   50             }                                                                  \
   51         }                                                                      \
   52         __local.barrier.waitfor = __count;                                     \
   53         for (__i = 0; __i < numsubvols; __i++) {                               \
   54             if (on[__i]) {                                                     \
   55                 func(frame, subvols[__i], __i, ##args);                        \
   56             }                                                                  \
   57         }                                                                      \
   58         syncbarrier_wait(&__local.barrier, __count);                           \
   59         syncbarrier_destroy(&__local.barrier);                                 \
   60         frame->local = __old_local;                                            \
   61         STACK_RESET(frame->root);                                              \
   62     } while (0)
   63 
   64 typedef struct cluster_local_ {
   65     default_args_cbk_t *replies;
   66     syncbarrier_t barrier;
   67 } cluster_local_t;
   68 
   69 int32_t
   70 cluster_lookup(xlator_t **subvols, unsigned char *on, int numsubvols,
   71                default_args_cbk_t *replies, unsigned char *output,
   72                call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata);
   73 int32_t
   74 cluster_setattr(xlator_t **subvols, unsigned char *on, int numsubvols,
   75                 default_args_cbk_t *replies, unsigned char *output,
   76                 call_frame_t *frame, xlator_t *this, loc_t *loc,
   77                 struct iatt *stbuf, int32_t valid, dict_t *xdata);
   78 int32_t
   79 cluster_getxattr(xlator_t **subvols, unsigned char *on, int numsubvols,
   80                  default_args_cbk_t *replies, unsigned char *output,
   81                  call_frame_t *frame, xlator_t *this, loc_t *loc,
   82                  const char *name, dict_t *xdata);
   83 int32_t
   84 cluster_setxattr(xlator_t **subvols, unsigned char *on, int numsubvols,
   85                  default_args_cbk_t *replies, unsigned char *output,
   86                  call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
   87                  int32_t flags, dict_t *xdata);
   88 
   89 int
   90 cluster_inodelk(xlator_t **subvols, unsigned char *on, int numsubvols,
   91                 default_args_cbk_t *replies, unsigned char *locked_on,
   92                 call_frame_t *frame, xlator_t *this, char *dom, inode_t *inode,
   93                 off_t off, size_t size);
   94 
   95 int
   96 cluster_uninodelk(xlator_t **subvols, unsigned char *locked_on, int numsubvols,
   97                   default_args_cbk_t *replies, unsigned char *output,
   98                   call_frame_t *frame, xlator_t *this, char *dom,
   99                   inode_t *inode, off_t off, size_t size);
  100 
  101 int
  102 cluster_entrylk(xlator_t **subvols, unsigned char *on, int numsubvols,
  103                 default_args_cbk_t *replies, unsigned char *locked_on,
  104                 call_frame_t *frame, xlator_t *this, char *dom, inode_t *inode,
  105                 const char *name);
  106 
  107 int32_t
  108 cluster_rmdir(xlator_t **subvols, unsigned char *on, int numsubvols,
  109               default_args_cbk_t *replies, unsigned char *output,
  110               call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
  111               dict_t *xdata);
  112 
  113 int32_t
  114 cluster_unlink(xlator_t **subvols, unsigned char *on, int numsubvols,
  115                default_args_cbk_t *replies, unsigned char *output,
  116                call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,
  117                dict_t *xdata);
  118 
  119 int
  120 cluster_mkdir(xlator_t **subvols, unsigned char *on, int numsubvols,
  121               default_args_cbk_t *replies, unsigned char *output,
  122               call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
  123               mode_t umask, dict_t *xdata);
  124 
  125 int32_t
  126 cluster_readlink(xlator_t **subvols, unsigned char *on, int numsubvols,
  127                  default_args_cbk_t *replies, unsigned char *output,
  128                  call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size,
  129                  dict_t *xdata);
  130 
  131 int
  132 cluster_symlink(xlator_t **subvols, unsigned char *on, int numsubvols,
  133                 default_args_cbk_t *replies, unsigned char *output,
  134                 call_frame_t *frame, xlator_t *this, const char *linkpath,
  135                 loc_t *loc, mode_t umask, dict_t *xdata);
  136 
  137 int32_t
  138 cluster_link(xlator_t **subvols, unsigned char *on, int numsubvols,
  139              default_args_cbk_t *replies, unsigned char *output,
  140              call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
  141              dict_t *xdata);
  142 
  143 int
  144 cluster_mknod(xlator_t **subvols, unsigned char *on, int numsubvols,
  145               default_args_cbk_t *replies, unsigned char *output,
  146               call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
  147               dev_t rdev, mode_t umask, dict_t *xdata);
  148 
  149 int
  150 cluster_unentrylk(xlator_t **subvols, unsigned char *locked_on, int numsubvols,
  151                   default_args_cbk_t *replies, unsigned char *output,
  152                   call_frame_t *frame, xlator_t *this, char *dom,
  153                   inode_t *inode, const char *name);
  154 
  155 int
  156 cluster_tryentrylk(xlator_t **subvols, unsigned char *on, int numsubvols,
  157                    default_args_cbk_t *replies, unsigned char *locked_on,
  158                    call_frame_t *frame, xlator_t *this, char *dom,
  159                    inode_t *inode, const char *name);
  160 
  161 int32_t
  162 cluster_fxattrop(xlator_t **subvols, unsigned char *on, int numsubvols,
  163                  default_args_cbk_t *replies, unsigned char *output,
  164                  call_frame_t *frame, xlator_t *this, fd_t *fd,
  165                  gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata);
  166 
  167 int32_t
  168 cluster_xattrop(xlator_t **subvols, unsigned char *on, int numsubvols,
  169                 default_args_cbk_t *replies, unsigned char *output,
  170                 call_frame_t *frame, xlator_t *this, loc_t *loc,
  171                 gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata);
  172 
  173 int32_t
  174 cluster_fstat(xlator_t **subvols, unsigned char *on, int numsubvols,
  175               default_args_cbk_t *replies, unsigned char *output,
  176               call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata);
  177 
  178 int32_t
  179 cluster_ftruncate(xlator_t **subvols, unsigned char *on, int numsubvols,
  180                   default_args_cbk_t *replies, unsigned char *output,
  181                   call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
  182                   dict_t *xdata);
  183 
  184 int32_t
  185 cluster_open(xlator_t **subvols, unsigned char *on, int numsubvols,
  186              default_args_cbk_t *replies, unsigned char *output,
  187              call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
  188              fd_t *fd, dict_t *xdata);
  189 
  190 int
  191 cluster_tryinodelk(xlator_t **subvols, unsigned char *on, int numsubvols,
  192                    default_args_cbk_t *replies, unsigned char *locked_on,
  193                    call_frame_t *frame, xlator_t *this, char *dom,
  194                    inode_t *inode, off_t off, size_t size);
  195 
  196 int32_t
  197 cluster_fsetattr(xlator_t **subvols, unsigned char *on, int numsubvols,
  198                  default_args_cbk_t *replies, unsigned char *output,
  199                  call_frame_t *frame, xlator_t *this, fd_t *fd,
  200                  struct iatt *stbuf, int32_t valid, dict_t *xdata);
  201 
  202 int32_t
  203 cluster_put(xlator_t **subvols, unsigned char *on, int numsubvols,
  204             default_args_cbk_t *replies, unsigned char *output,
  205             call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
  206             mode_t umask, uint32_t flags, struct iovec *vector, int32_t count,
  207             off_t offset, struct iobref *iobref, dict_t *xattr, dict_t *xdata);
  208 
  209 void
  210 cluster_replies_wipe(default_args_cbk_t *replies, int num_subvols);
  211 
  212 int32_t
  213 cluster_fop_success_fill(default_args_cbk_t *replies, int numsubvols,
  214                          unsigned char *success);
  215 
  216 int32_t
  217 cluster_xattrop_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
  218                     int32_t op_ret, int32_t op_errno, dict_t *dict,
  219                     dict_t *xdata);
  220 
  221 int
  222 cluster_tiebreaker_inodelk(xlator_t **subvols, unsigned char *on,
  223                            int numsubvols, default_args_cbk_t *replies,
  224                            unsigned char *locked_on, call_frame_t *frame,
  225                            xlator_t *this, char *dom, inode_t *inode, off_t off,
  226                            size_t size);
  227 #endif /* !_CLUSTER_SYNCOP_H */