diff options
| author | Gluster Ant <bugzilla-bot@gluster.org> | 2018-09-12 17:22:48 +0530 | 
|---|---|---|
| committer | Nigel Babu <nigelb@redhat.com> | 2018-09-12 17:22:48 +0530 | 
| commit | 45a71c0548b6fd2c757aa2e7b7671a1411948894 (patch) | |
| tree | 2a5a9b73bae47ab53a41166fd041a06612587f48 /libglusterfs/src/iobuf.h | |
| parent | be77dbbda692792335a8e9e7c02e0c281f003c40 (diff) | |
Land clang-format changes
Change-Id: I6f5d8140a06f3c1b2d196849299f8d483028d33b
Diffstat (limited to 'libglusterfs/src/iobuf.h')
| -rw-r--r-- | libglusterfs/src/iobuf.h | 209 | 
1 files changed, 110 insertions, 99 deletions
diff --git a/libglusterfs/src/iobuf.h b/libglusterfs/src/iobuf.h index 21184da1d2e..41ac5dd191c 100644 --- a/libglusterfs/src/iobuf.h +++ b/libglusterfs/src/iobuf.h @@ -32,8 +32,8 @@  #define MAP_ANONYMOUS MAP_ANON  #endif -#define GF_ALIGN_BUF(ptr,bound) ((void *)((unsigned long)(ptr + bound - 1) & \ -                                          (unsigned long)(~(bound - 1)))) +#define GF_ALIGN_BUF(ptr, bound)                                               \ +    ((void *)((unsigned long)(ptr + bound - 1) & (unsigned long)(~(bound - 1))))  #define GF_IOBUF_ALIGN_SIZE 512 @@ -50,133 +50,144 @@ struct iobuf_arena;  struct iobuf_pool;  struct iobuf_init_config { -        size_t   pagesize; -        int32_t  num_pages; +    size_t pagesize; +    int32_t num_pages;  };  struct iobuf { -        union { -                struct list_head      list; -                struct { -                        struct iobuf *next; -                        struct iobuf *prev; -                }; +    union { +        struct list_head list; +        struct { +            struct iobuf *next; +            struct iobuf *prev;          }; -        struct iobuf_arena  *iobuf_arena; +    }; +    struct iobuf_arena *iobuf_arena; -        gf_lock_t            lock; /* for ->ptr and ->ref */ -        gf_atomic_t          ref;  /* 0 == passive, >0 == active */ +    gf_lock_t lock;  /* for ->ptr and ->ref */ +    gf_atomic_t ref; /* 0 == passive, >0 == active */ -        void                *ptr;  /* usable memory region by the consumer */ +    void *ptr; /* usable memory region by the consumer */ -        void                *free_ptr; /* in case of stdalloc, this is the -                                          one to be freed */ +    void *free_ptr; /* in case of stdalloc, this is the +                       one to be freed */  }; -  struct iobuf_arena { -        union { -                struct list_head            list; -                struct { -                        struct iobuf_arena *next; -                        struct iobuf_arena *prev; -                }; +    union { +        struct list_head list; +        struct { +            struct iobuf_arena *next; +            struct iobuf_arena *prev;          }; - -        struct list_head    all_list; -        size_t              page_size;  /* size of all iobufs in this arena */ -        size_t              arena_size; -        /* this is equal to rounded_size * num_iobufs. -           (rounded_size comes with gf_iobuf_get_pagesize().) */ -        size_t              page_count; - -        struct iobuf_pool  *iobuf_pool; - -        void               *mem_base; -        struct iobuf       *iobufs;     /* allocated iobufs list */ - -        int                 active_cnt; -        struct iobuf        active;     /* head node iobuf -                                           (unused by itself) */ -        int                 passive_cnt; -        struct iobuf        passive;    /* head node iobuf -                                           (unused by itself) */ -        uint64_t            alloc_cnt;  /* total allocs in this pool */ -        int                 max_active; /* max active buffers at a given time */ +    }; + +    struct list_head all_list; +    size_t page_size; /* size of all iobufs in this arena */ +    size_t arena_size; +    /* this is equal to rounded_size * num_iobufs. +       (rounded_size comes with gf_iobuf_get_pagesize().) */ +    size_t page_count; + +    struct iobuf_pool *iobuf_pool; + +    void *mem_base; +    struct iobuf *iobufs; /* allocated iobufs list */ + +    int active_cnt; +    struct iobuf active; /* head node iobuf +                            (unused by itself) */ +    int passive_cnt; +    struct iobuf passive; /* head node iobuf +                             (unused by itself) */ +    uint64_t alloc_cnt;   /* total allocs in this pool */ +    int max_active;       /* max active buffers at a given time */  }; -  struct iobuf_pool { -        pthread_mutex_t     mutex; -        size_t              arena_size; /* size of memory region in -                                           arena */ -        size_t              default_page_size; /* default size of iobuf */ - -        int                 arena_cnt; -        struct list_head    all_arenas; -        struct list_head    arenas[GF_VARIABLE_IOBUF_COUNT]; -        /* array of arenas. Each element of the array is a list of arenas -           holding iobufs of particular page_size */ - -        struct list_head    filled[GF_VARIABLE_IOBUF_COUNT]; -        /* array of arenas without free iobufs */ - -        struct list_head    purge[GF_VARIABLE_IOBUF_COUNT]; -        /* array of of arenas which can be purged */ - -        uint64_t            request_misses; /* mostly the requests for higher -                                              value of iobufs */ -        int                 rdma_device_count; -        struct list_head    *mr_list[GF_RDMA_DEVICE_COUNT]; -        void                *device[GF_RDMA_DEVICE_COUNT]; -        int (*rdma_registration)(void **, void*); -        int (*rdma_deregistration)(struct list_head**, struct iobuf_arena *); - +    pthread_mutex_t mutex; +    size_t arena_size;        /* size of memory region in +                                 arena */ +    size_t default_page_size; /* default size of iobuf */ + +    int arena_cnt; +    struct list_head all_arenas; +    struct list_head arenas[GF_VARIABLE_IOBUF_COUNT]; +    /* array of arenas. Each element of the array is a list of arenas +       holding iobufs of particular page_size */ + +    struct list_head filled[GF_VARIABLE_IOBUF_COUNT]; +    /* array of arenas without free iobufs */ + +    struct list_head purge[GF_VARIABLE_IOBUF_COUNT]; +    /* array of of arenas which can be purged */ + +    uint64_t request_misses; /* mostly the requests for higher +                               value of iobufs */ +    int rdma_device_count; +    struct list_head *mr_list[GF_RDMA_DEVICE_COUNT]; +    void *device[GF_RDMA_DEVICE_COUNT]; +    int (*rdma_registration)(void **, void *); +    int (*rdma_deregistration)(struct list_head **, struct iobuf_arena *);  }; - -struct iobuf_pool *iobuf_pool_new (void); -void iobuf_pool_destroy (struct iobuf_pool *iobuf_pool); -struct iobuf *iobuf_get (struct iobuf_pool *iobuf_pool); -void iobuf_unref (struct iobuf *iobuf); -struct iobuf *iobuf_ref (struct iobuf *iobuf); -void iobuf_pool_destroy (struct iobuf_pool *iobuf_pool); -void iobuf_to_iovec(struct iobuf *iob, struct iovec *iov); +struct iobuf_pool * +iobuf_pool_new(void); +void +iobuf_pool_destroy(struct iobuf_pool *iobuf_pool); +struct iobuf * +iobuf_get(struct iobuf_pool *iobuf_pool); +void +iobuf_unref(struct iobuf *iobuf); +struct iobuf * +iobuf_ref(struct iobuf *iobuf); +void +iobuf_pool_destroy(struct iobuf_pool *iobuf_pool); +void +iobuf_to_iovec(struct iobuf *iob, struct iovec *iov);  #define iobuf_ptr(iob) ((iob)->ptr)  #define iobpool_default_pagesize(iobpool) ((iobpool)->default_page_size)  #define iobuf_pagesize(iob) (iob->iobuf_arena->page_size) -  struct iobref { -        gf_lock_t          lock; -        gf_atomic_t        ref; -        struct iobuf     **iobrefs; -	int                allocated; -	int                used; +    gf_lock_t lock; +    gf_atomic_t ref; +    struct iobuf **iobrefs; +    int allocated; +    int used;  }; -struct iobref *iobref_new (void); -struct iobref *iobref_ref (struct iobref *iobref); -void iobref_unref (struct iobref *iobref); -int iobref_add (struct iobref *iobref, struct iobuf *iobuf); -int iobref_merge (struct iobref *to, struct iobref *from); -void iobref_clear (struct iobref *iobref); +struct iobref * +iobref_new(void); +struct iobref * +iobref_ref(struct iobref *iobref); +void +iobref_unref(struct iobref *iobref); +int +iobref_add(struct iobref *iobref, struct iobuf *iobuf); +int +iobref_merge(struct iobref *to, struct iobref *from); +void +iobref_clear(struct iobref *iobref); -size_t iobuf_size (struct iobuf *iobuf); -size_t iobref_size (struct iobref *iobref); -void   iobuf_stats_dump (struct iobuf_pool *iobuf_pool); +size_t +iobuf_size(struct iobuf *iobuf); +size_t +iobref_size(struct iobref *iobref); +void +iobuf_stats_dump(struct iobuf_pool *iobuf_pool);  struct iobuf * -iobuf_get2 (struct iobuf_pool *iobuf_pool, size_t page_size); +iobuf_get2(struct iobuf_pool *iobuf_pool, size_t page_size);  struct iobuf * -iobuf_get_page_aligned (struct iobuf_pool *iobuf_pool, size_t page_size, -                        size_t align_size); +iobuf_get_page_aligned(struct iobuf_pool *iobuf_pool, size_t page_size, +                       size_t align_size);  int -iobuf_copy (struct iobuf_pool *iobuf_pool, const struct iovec *iovec_src, -            int iovcnt, struct iobref **iobref, struct iobuf **iobuf, -            struct iovec *iov_dst); +iobuf_copy(struct iobuf_pool *iobuf_pool, const struct iovec *iovec_src, +           int iovcnt, struct iobref **iobref, struct iobuf **iobuf, +           struct iovec *iov_dst);  #endif /* !_IOBUF_H_ */  | 
