afr: some minor itable related cleanups

- this->itable always needs to be allocated, hence move it outside
afr_selfheal_daemon_init().
- Invoke afr_selfheal_daemon_init() only for self-heal daemon case.
- remove redundant itable allocation in afr_discover().
- destroy itable in fini.

Updates bz#1193929
Change-Id: Ib28b50b607386f5a5aa7d2f743c8b506ccb10eae
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
This commit is contained in:
Ravishankar N 2018-12-11 15:32:03 +05:30 committed by Amar Tumballi
parent 607bbd935f
commit 52d3f82db2
4 changed files with 17 additions and 12 deletions

View File

@ -3209,8 +3209,6 @@ afr_discover(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req)
}
if (__is_root_gfid(loc->inode->gfid)) {
if (!this->itable)
this->itable = loc->inode->table;
if (!priv->root_inode)
priv->root_inode = inode_ref(loc->inode);

View File

@ -16,7 +16,6 @@
#include "afr-messages.h"
#include <glusterfs/byte-order.h>
#define SHD_INODE_LRU_LIMIT 2048
#define AFR_EH_SPLIT_BRAIN_LIMIT 1024
#define AFR_STATISTICS_HISTORY_SIZE 50
@ -722,9 +721,9 @@ afr_shd_ta_unset_xattrs(xlator_t *this, loc_t *loc, dict_t **xdata, int healer)
}
ret = dict_set_bin(xattr, priv->pending_key[i], raw,
AFR_NUM_CHANGE_LOGS * sizeof (int));
AFR_NUM_CHANGE_LOGS * sizeof(int));
if (ret) {
GF_FREE (raw);
GF_FREE(raw);
goto out;
}
@ -1210,10 +1209,6 @@ afr_selfheal_daemon_init(xlator_t *this)
priv = this->private;
shd = &priv->shd;
this->itable = inode_table_new(SHD_INODE_LRU_LIMIT, this);
if (!this->itable)
goto out;
shd->index_healers = GF_CALLOC(sizeof(*shd->index_healers),
priv->child_count,
gf_afr_mt_subvol_healer_t);

View File

@ -559,12 +559,20 @@ init(xlator_t *this)
goto out;
}
ret = afr_selfheal_daemon_init(this);
if (ret) {
this->itable = inode_table_new(SHD_INODE_LRU_LIMIT, this);
if (!this->itable) {
ret = -ENOMEM;
goto out;
}
if (priv->shd.iamshd) {
ret = afr_selfheal_daemon_init(this);
if (ret) {
ret = -ENOMEM;
goto out;
}
}
/* keep more local here as we may need them for self-heal etc */
this->local_pool = mem_pool_new(afr_local_t, 512);
if (!this->local_pool) {
@ -593,7 +601,10 @@ fini(xlator_t *this)
UNLOCK(&priv->lock);
this->private = NULL;
afr_priv_destroy(priv);
// if (this->itable);//I don't see any destroy func
if (this->itable) {
inode_table_destroy(this->itable);
this->itable = NULL;
}
return;
}

View File

@ -22,6 +22,7 @@
#include "afr-self-heald.h"
#include "afr-messages.h"
#define SHD_INODE_LRU_LIMIT 1
#define AFR_PATHINFO_HEADER "REPLICATE:"
#define AFR_SH_READDIR_SIZE_KEY "self-heal-readdir-size"
#define AFR_SH_DATA_DOMAIN_FMT "%s:self-heal"