From 7e8eefca2caaaa61e1b31b747384f660c595d9c9 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Sun, 15 Dec 2013 08:05:04 +0530 Subject: heal: glfs-heal implementation Thanks a lot to Niels for helping me to get build stuff right. Change-Id: I634f24d90cd856ceab3cc0c6e9a91003f443403e BUG: 1147462 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/6529 Reviewed-by: Krutika Dhananjay Tested-by: Gluster Build System --- xlators/cluster/afr/src/afr-self-heal-common.c | 21 +++++++++++++-------- xlators/cluster/afr/src/afr-self-heal.h | 7 +++++++ xlators/cluster/afr/src/afr-self-heald.c | 2 -- xlators/cluster/afr/src/afr-self-heald.h | 6 ++++++ 4 files changed, 26 insertions(+), 10 deletions(-) (limited to 'xlators/cluster/afr/src') diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index 14a514beffa..6198d4cf72c 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -932,13 +932,14 @@ afr_selfheal_unlocked_inspect (call_frame_t *frame, xlator_t *this, if (replies[i].op_ret == -1) continue; - if (afr_is_data_set (this, replies[i].xdata)) + if (data_selfheal && afr_is_data_set (this, replies[i].xdata)) *data_selfheal = _gf_true; - if (afr_is_metadata_set (this, replies[i].xdata)) + if (metadata_selfheal && + afr_is_metadata_set (this, replies[i].xdata)) *metadata_selfheal = _gf_true; - if (afr_is_entry_set (this, replies[i].xdata)) + if (entry_selfheal && afr_is_entry_set (this, replies[i].xdata)) *entry_selfheal = _gf_true; valid_cnt ++; @@ -967,7 +968,8 @@ afr_selfheal_unlocked_inspect (call_frame_t *frame, xlator_t *this, priv->children[i]->name, uuid_utoa (replies[i].poststat.ia_gfid)); - *metadata_selfheal = _gf_true; + if (metadata_selfheal) + *metadata_selfheal = _gf_true; } if (!IA_EQUAL (first, replies[i].poststat, gid)) { @@ -978,7 +980,8 @@ afr_selfheal_unlocked_inspect (call_frame_t *frame, xlator_t *this, priv->children[i]->name, uuid_utoa (replies[i].poststat.ia_gfid)); - *metadata_selfheal = _gf_true; + if (metadata_selfheal) + *metadata_selfheal = _gf_true; } if (!IA_EQUAL (first, replies[i].poststat, prot)) { @@ -989,7 +992,8 @@ afr_selfheal_unlocked_inspect (call_frame_t *frame, xlator_t *this, priv->children[i]->name, uuid_utoa (replies[i].poststat.ia_gfid)); - *metadata_selfheal = _gf_true; + if (metadata_selfheal) + *metadata_selfheal = _gf_true; } if (IA_ISREG(first.ia_type) && @@ -1001,11 +1005,12 @@ afr_selfheal_unlocked_inspect (call_frame_t *frame, xlator_t *this, priv->children[i]->name, uuid_utoa (replies[i].poststat.ia_gfid)); - *data_selfheal = _gf_true; + if (data_selfheal) + *data_selfheal = _gf_true; } } - if (valid_cnt > 0) { + if (valid_cnt > 0 && link_inode) { *link_inode = afr_inode_link (inode, &first); if (!*link_inode) { ret = -EINVAL; diff --git a/xlators/cluster/afr/src/afr-self-heal.h b/xlators/cluster/afr/src/afr-self-heal.h index f208e6bc813..bb3f0e7029f 100644 --- a/xlators/cluster/afr/src/afr-self-heal.h +++ b/xlators/cluster/afr/src/afr-self-heal.h @@ -198,4 +198,11 @@ afr_mark_active_sinks (xlator_t *this, unsigned char *sources, gf_boolean_t afr_does_witness_exist (xlator_t *this, uint64_t *witness); + +int +afr_selfheal_unlocked_inspect (call_frame_t *frame, xlator_t *this, + uuid_t gfid, inode_t **link_inode, + gf_boolean_t *data_selfheal, + gf_boolean_t *metadata_selfheal, + gf_boolean_t *entry_selfheal); #endif /* !_AFR_SELFHEAL_H */ diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c index 10e19964ed9..a341015303c 100644 --- a/xlators/cluster/afr/src/afr-self-heald.c +++ b/xlators/cluster/afr/src/afr-self-heald.c @@ -40,8 +40,6 @@ #define NTH_INDEX_HEALER(this, n) &((((afr_private_t *)this->private))->shd.index_healers[n]) #define NTH_FULL_HEALER(this, n) &((((afr_private_t *)this->private))->shd.full_healers[n]) -int afr_shd_gfid_to_path (xlator_t *this, xlator_t *subvol, uuid_t gfid, char **path_p); - char * afr_subvol_name (xlator_t *this, int subvol) { diff --git a/xlators/cluster/afr/src/afr-self-heald.h b/xlators/cluster/afr/src/afr-self-heald.h index 59f06b79cff..02b26b8061f 100644 --- a/xlators/cluster/afr/src/afr-self-heald.h +++ b/xlators/cluster/afr/src/afr-self-heald.h @@ -67,4 +67,10 @@ 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 */ -- cgit