"Fossies" - the Fresh Open Source Software Archive

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

    1 /*
    2    Copyright (c) 2008-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 
   11 #ifndef __INDEX_H__
   12 #define __INDEX_H__
   13 
   14 #include <glusterfs/xlator.h>
   15 #include <glusterfs/call-stub.h>
   16 #include <glusterfs/defaults.h>
   17 #include <glusterfs/byte-order.h>
   18 #include <glusterfs/common-utils.h>
   19 #include "index-mem-types.h"
   20 
   21 #define INDEX_THREAD_STACK_SIZE ((size_t)(1024 * 1024))
   22 
   23 typedef enum { UNKNOWN, IN, NOTIN } index_state_t;
   24 
   25 typedef enum {
   26     XATTROP_TYPE_UNSET = -1,
   27     XATTROP,
   28     DIRTY,
   29     ENTRY_CHANGES,
   30     XATTROP_TYPE_END
   31 } index_xattrop_type_t;
   32 
   33 typedef struct index_inode_ctx {
   34     gf_boolean_t processing;
   35     struct list_head callstubs;
   36     int state[XATTROP_TYPE_END];
   37     uuid_t virtual_pargfid; /* virtual gfid of dir under
   38                               .glusterfs/indices/entry-changes. */
   39 } index_inode_ctx_t;
   40 
   41 typedef struct index_fd_ctx {
   42     DIR *dir;
   43     off_t dir_eof;
   44 } index_fd_ctx_t;
   45 
   46 typedef struct index_priv {
   47     char *index_basepath;
   48     char *dirty_basepath;
   49     uuid_t index;
   50     gf_lock_t lock;
   51     uuid_t internal_vgfid[XATTROP_TYPE_END];
   52     struct list_head callstubs;
   53     pthread_mutex_t mutex;
   54     pthread_cond_t cond;
   55     dict_t *dirty_watchlist;
   56     dict_t *pending_watchlist;
   57     dict_t *complete_watchlist;
   58     int64_t pending_count;
   59     pthread_t thread;
   60     gf_boolean_t down;
   61     gf_atomic_t stub_cnt;
   62     int32_t curr_count;
   63 } index_priv_t;
   64 
   65 typedef struct index_local {
   66     inode_t *inode;
   67     dict_t *xdata;
   68 } index_local_t;
   69 
   70 #define INDEX_STACK_UNWIND(fop, frame, params...)                              \
   71     do {                                                                       \
   72         index_local_t *__local = NULL;                                         \
   73         if (frame) {                                                           \
   74             __local = frame->local;                                            \
   75             frame->local = NULL;                                               \
   76         }                                                                      \
   77         STACK_UNWIND_STRICT(fop, frame, params);                               \
   78         if (__local) {                                                         \
   79             inode_unref(__local->inode);                                       \
   80             if (__local->xdata)                                                \
   81                 dict_unref(__local->xdata);                                    \
   82             mem_put(__local);                                                  \
   83         }                                                                      \
   84     } while (0)
   85 
   86 #endif