diff options
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heald.h')
| -rw-r--r-- | xlators/cluster/afr/src/afr-self-heald.h | 97 |
1 files changed, 66 insertions, 31 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heald.h b/xlators/cluster/afr/src/afr-self-heald.h index 5d7892fa785..18db728ea7b 100644 --- a/xlators/cluster/afr/src/afr-self-heald.h +++ b/xlators/cluster/afr/src/afr-self-heald.h @@ -1,40 +1,75 @@ /* - Copyright (c) 2010-2011 Gluster, Inc. <http://www.gluster.com> - This file is part of GlusterFS. - - GlusterFS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - GlusterFS is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see - <http://www.gnu.org/licenses/>. + 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 "xlator.h" +#ifndef _AFR_SELF_HEALD_H +#define _AFR_SELF_HEALD_H + +#include <pthread.h> + +typedef struct { + char *path; + int child; +} shd_event_t; + +typedef struct { + 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; + int child; +} crawl_event_t; + +struct subvol_healer { + xlator_t *this; + crawl_event_t crawl_event; + pthread_mutex_t mutex; + pthread_cond_t cond; + pthread_t thread; + int subvol; + gf_boolean_t local; + gf_boolean_t running; + gf_boolean_t rerun; +}; -#define IS_ROOT_PATH(path) (!strcmp (path, "/")) -#define IS_ENTRY_CWD(entry) (!strcmp (entry, ".")) -#define IS_ENTRY_PARENT(entry) (!strcmp (entry, "..")) -#define AFR_ALL_CHILDREN -1 +typedef struct { + struct subvol_healer *index_healers; + struct subvol_healer *full_healers; -typedef struct afr_crawl_data_ { - int child; - pid_t pid; -} afr_crawl_data_t; + eh_t *split_brain; + eh_t **statistics; + int timeout; + uint32_t max_threads; + uint32_t wait_qlength; + uint32_t halo_max_latency_msec; + gf_boolean_t iamshd; + gf_boolean_t enabled; +} afr_self_heald_t; -void afr_proactive_self_heal (xlator_t *this, int idx); +int +afr_selfheal_daemon_init(xlator_t *this); -void afr_build_root_loc (inode_t *inode, loc_t *loc); +int +afr_xl_op(xlator_t *this, dict_t *input, dict_t *output); -int afr_set_root_gfid (dict_t *dict); +int +afr_shd_gfid_to_path(xlator_t *this, xlator_t *subvol, uuid_t gfid, + char **path_p); -#endif /* __AFR_SELF_HEALD_H__ */ +int +afr_shd_entry_purge(xlator_t *subvol, inode_t *inode, char *name, + ia_type_t type); +#endif /* !_AFR_SELF_HEALD_H */ |
