diff options
author | Ravishankar N <ravishankar@redhat.com> | 2018-12-11 15:32:03 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-12-12 23:02:56 +0000 |
commit | 52d3f82db2f032eae1b60ffa2f283109858ce3df (patch) | |
tree | 2fa19f5f3838a8a3343a7a4b928007016960328d /xlators | |
parent | 607bbd935f102602810fdeb61079b85ecb58a118 (diff) | |
download | glusterfs-52d3f82db2f032eae1b60ffa2f283109858ce3df.tar.gz glusterfs-52d3f82db2f032eae1b60ffa2f283109858ce3df.tar.xz glusterfs-52d3f82db2f032eae1b60ffa2f283109858ce3df.zip |
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>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 2 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heald.c | 9 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.c | 17 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.h | 1 |
4 files changed, 17 insertions, 12 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index e1400acd9e..52c9f2cfd5 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -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); diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c index 8d6d383e87..c696614777 100644 --- a/xlators/cluster/afr/src/afr-self-heald.c +++ b/xlators/cluster/afr/src/afr-self-heald.c @@ -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); diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index c007ffef9f..4e20c7542c 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -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; } diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index f317320732..1a54d5d582 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -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" |