| 1 |
/* |
| 2 |
Copyright (c) 2013 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 _AFR_SELF_HEALD_H |
| 12 |
#define _AFR_SELF_HEALD_H |
| 13 |
|
| 14 |
#include <pthread.h> |
| 15 |
|
| 16 |
typedef struct { |
| 17 |
char *path; |
| 18 |
int child; |
| 19 |
} shd_event_t; |
| 20 |
|
| 21 |
typedef struct { |
| 22 |
uint64_t healed_count; |
| 23 |
uint64_t split_brain_count; |
| 24 |
uint64_t heal_failed_count; |
| 25 |
|
| 26 |
/* If start_time is 0, it means crawler is not in progress |
| 27 |
and stats are not valid */ |
| 28 |
time_t start_time; |
| 29 |
/* If start_time is NOT 0 and end_time is 0, it means |
| 30 |
cralwer is in progress */ |
| 31 |
time_t end_time; |
| 32 |
char *crawl_type; |
| 33 |
int child; |
| 34 |
} crawl_event_t; |
| 35 |
|
| 36 |
struct subvol_healer { |
| 37 |
xlator_t *this; |
| 38 |
crawl_event_t crawl_event; |
| 39 |
pthread_mutex_t mutex; |
| 40 |
pthread_cond_t cond; |
| 41 |
pthread_t thread; |
| 42 |
int subvol; |
| 43 |
gf_boolean_t local; |
| 44 |
gf_boolean_t running; |
| 45 |
gf_boolean_t rerun; |
| 46 |
}; |
| 47 |
|
| 48 |
typedef struct { |
| 49 |
struct subvol_healer *index_healers; |
| 50 |
struct subvol_healer *full_healers; |
| 51 |
|
| 52 |
eh_t *split_brain; |
| 53 |
eh_t **statistics; |
| 54 |
time_t timeout; |
| 55 |
uint32_t max_threads; |
| 56 |
uint32_t wait_qlength; |
| 57 |
uint32_t halo_max_latency_msec; |
| 58 |
gf_boolean_t iamshd; |
| 59 |
gf_boolean_t enabled; |
| 60 |
} afr_self_heald_t; |
| 61 |
|
| 62 |
int |
| 63 |
afr_selfheal_daemon_init(xlator_t *this); |
| 64 |
|
| 65 |
int |
| 66 |
afr_xl_op(xlator_t *this, dict_t *input, dict_t *output); |
| 67 |
|
| 68 |
int |
| 69 |
afr_shd_entry_purge(xlator_t *subvol, inode_t *inode, char *name, |
| 70 |
ia_type_t type); |
| 71 |
#endif /* !_AFR_SELF_HEALD_H */ |