"Fossies" - the Fresh Open Source Software Archive

Member "glusterfs-8.2/xlators/mgmt/glusterd/src/glusterd-syncop.h" (16 Sep 2020, 4482 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 "glusterd-syncop.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2    Copyright (c) 2012-2012 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 #ifndef __RPC_SYNCOP_H
   11 #define __RPC_SYNCOP_H
   12 
   13 #include <glusterfs/syncop.h>
   14 #include "glusterd-sm.h"
   15 #include "glusterd.h"
   16 
   17 #define GD_SYNC_OPCODE_KEY "sync-mgmt-operation"
   18 
   19 /* gd_syncop_* */
   20 #define GD_SYNCOP(rpc, stb, cookie, cbk, req, prog, procnum, xdrproc)          \
   21     do {                                                                       \
   22         int ret = 0;                                                           \
   23         struct synctask *task = NULL;                                          \
   24         glusterd_conf_t *conf = THIS->private;                                 \
   25                                                                                \
   26         task = synctask_get();                                                 \
   27         stb->task = task;                                                      \
   28                                                                                \
   29         /*This is to ensure that the brick_op_cbk is able to                   \
   30          * take the big lock*/                                                 \
   31         synclock_unlock(&conf->big_lock);                                      \
   32         ret = gd_syncop_submit_request(rpc, req, stb, cookie, prog, procnum,   \
   33                                        cbk, (xdrproc_t)xdrproc);               \
   34         if (!ret)                                                              \
   35             synctask_yield(stb->task, NULL);                                   \
   36         else                                                                   \
   37             gf_asprintf(&stb->errstr,                                          \
   38                         "%s failed. Check log file"                            \
   39                         " for more details",                                   \
   40                         (prog)->progname);                                     \
   41         synclock_lock(&conf->big_lock);                                        \
   42     } while (0)
   43 
   44 #define GD_ALLOC_COPY_UUID(dst_ptr, uuid, ret)                                 \
   45     do {                                                                       \
   46         dst_ptr = GF_MALLOC(sizeof(*dst_ptr), gf_common_mt_uuid_t);            \
   47         if (dst_ptr) {                                                         \
   48             gf_uuid_copy(*dst_ptr, uuid);                                      \
   49             ret = 0;                                                           \
   50         } else {                                                               \
   51             ret = -1;                                                          \
   52         }                                                                      \
   53     } while (0)
   54 
   55 int32_t
   56 gd_syncop_brick_op_cbk(struct rpc_req *req, struct iovec *iov, int count,
   57                        void *myframe);
   58 
   59 int
   60 gd_syncop_submit_request(struct rpc_clnt *rpc, void *req, void *local,
   61                          void *cookie, rpc_clnt_prog_t *prog, int procnum,
   62                          fop_cbk_fn_t cbkfn, xdrproc_t xdrproc);
   63 int
   64 gd_syncop_mgmt_lock(glusterd_peerinfo_t *peerinfo, struct syncargs *arg,
   65                     uuid_t my_uuid, uuid_t recv_uuid);
   66 
   67 int
   68 gd_syncop_mgmt_unlock(glusterd_peerinfo_t *peerinfo, struct syncargs *arg,
   69                       uuid_t my_uuid, uuid_t recv_uuid);
   70 
   71 int
   72 gd_syncop_mgmt_stage_op(glusterd_peerinfo_t *peerinfo, struct syncargs *arg,
   73                         uuid_t my_uuid, uuid_t recv_uuid, int op,
   74                         dict_t *dict_out, dict_t *op_ctx);
   75 
   76 int
   77 gd_syncop_mgmt_commit_op(glusterd_peerinfo_t *peerinfo, struct syncargs *arg,
   78                          uuid_t my_uuid, uuid_t recv_uuid, int op,
   79                          dict_t *dict_out, dict_t *op_ctx);
   80 
   81 void
   82 gd_synctask_barrier_wait(struct syncargs *args, int count);
   83 
   84 int
   85 gd_brick_op_phase(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
   86                   char **op_errstr);
   87 
   88 int
   89 glusterd_syncop_aggr_rsp_dict(glusterd_op_t op, dict_t *aggr, dict_t *rsp);
   90 
   91 void
   92 gd_syncargs_init(struct syncargs *args, dict_t *op_ctx);
   93 #endif /* __RPC_SYNCOP_H */