summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-self-heald.h
blob: f591515669c08ead36b85c36f8a43b260c8be5d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
  Copyright (c) 2013 Red Hat, Inc. <http://www.redhat.com>
  This file is part of GlusterFS.

  This file is licensed to you under your choice of the GNU Lesser
  General Public License, version 3 or any later version (LGPLv3 or
  later), or the GNU General Public License, version 2 (GPLv2), in all
  cases as published by the Free Software Foundation.
*/


#ifndef _AFR_SELF_HEALD_H
#define _AFR_SELF_HEALD_H

#include <pthread.h>


typedef struct {
	int child;
	char *path;
} shd_event_t;

typedef struct {
	int      child;
	uint64_t healed_count;
        uint64_t split_brain_count;
        uint64_t heal_failed_count;

	/* If start_time is 0, it means crawler is not in progress
	   and stats are not valid */
	time_t   start_time;
	/* If start_time is NOT 0 and end_time is 0, it means
	   cralwer is in progress */
        time_t   end_time;
        char     *crawl_type;
} crawl_event_t;

struct subvol_healer {
	xlator_t        *this;
	int              subvol;
	gf_boolean_t     local;
	gf_boolean_t     running;
	gf_boolean_t     rerun;
	crawl_event_t    crawl_event;
	pthread_mutex_t  mutex;
	pthread_cond_t   cond;
	pthread_t        thread;
};

typedef struct {
	gf_boolean_t            iamshd;
	gf_boolean_t            enabled;
	int                     timeout;
	struct subvol_healer   *index_healers;
	struct subvol_healer   *full_healers;

        eh_t                    *split_brain;
        eh_t                    **statistics;
        uint32_t                max_threads;
        uint32_t                wait_qlength;
} afr_self_heald_t;


int
afr_selfheal_childup (xlator_t *this, int subvol);

int
afr_selfheal_daemon_init (xlator_t *this);

int
afr_xl_op (xlator_t *this, dict_t *input, dict_t *output);

int
afr_shd_gfid_to_path (xlator_t *this, xlator_t *subvol, uuid_t gfid,
                      char **path_p);

int
afr_shd_index_purge (xlator_t *subvol, inode_t *inode, char *name);
#endif /* !_AFR_SELF_HEALD_H */