summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2012-07-25 23:09:08 +0530
committerAnand Avati <avati@redhat.com>2012-07-25 14:52:48 -0700
commit12516e8af663032a0e6133f5f8f62f1078f9462d (patch)
tree16ae7c27294637f99a3a24abd04e2f78ca778449 /xlators/features
parent7cce8c843e9002f521da0e1af892914c5bd68737 (diff)
features/index: make pthread_attr_t local to init()
RC & FIX: No need to carry around pthread_attr_t in index_priv. So made it local to init() Tests: stepped through init() in gdb, it succeeded. Change-Id: I0525ac0676f9a329fccb0fd064933594ec117261 BUG: 843071 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/3729 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/index/src/index.c13
-rw-r--r--xlators/features/index/src/index.h1
2 files changed, 6 insertions, 8 deletions
diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c
index 0f00f7d93c4..7be09fadfff 100644
--- a/xlators/features/index/src/index.c
+++ b/xlators/features/index/src/index.c
@@ -1029,6 +1029,7 @@ init (xlator_t *this)
int ret = -1;
index_priv_t *priv = NULL;
pthread_t thread;
+ pthread_attr_t w_attr;
gf_boolean_t mutex_inited = _gf_false;
gf_boolean_t cond_inited = _gf_false;
gf_boolean_t attr_inited = _gf_false;
@@ -1063,15 +1064,14 @@ init (xlator_t *this)
}
mutex_inited = _gf_true;
- if ((ret = pthread_attr_init (&priv->w_attr)) != 0) {
+ if ((ret = pthread_attr_init (&w_attr)) != 0) {
gf_log (this->name, GF_LOG_ERROR,
"pthread_attr_init failed (%d)", ret);
goto out;
}
attr_inited = _gf_true;
- ret = pthread_attr_setstacksize (&priv->w_attr,
- INDEX_THREAD_STACK_SIZE);
+ ret = pthread_attr_setstacksize (&w_attr, INDEX_THREAD_STACK_SIZE);
if (ret == EINVAL) {
gf_log (this->name, GF_LOG_WARNING,
"Using default thread stack size");
@@ -1082,7 +1082,7 @@ init (xlator_t *this)
INIT_LIST_HEAD (&priv->callstubs);
this->private = priv;
- ret = pthread_create (&thread, &priv->w_attr, index_worker, this);
+ ret = pthread_create (&thread, &w_attr, index_worker, this);
if (ret) {
gf_log (this->name, GF_LOG_WARNING, "Failed to create "
"worker thread, aborting");
@@ -1095,12 +1095,12 @@ out:
pthread_cond_destroy (&priv->cond);
if (mutex_inited)
pthread_mutex_destroy (&priv->mutex);
- if (attr_inited)
- pthread_attr_destroy (&priv->w_attr);
if (priv)
GF_FREE (priv);
this->private = NULL;
}
+ if (attr_inited)
+ pthread_attr_destroy (&w_attr);
return ret;
}
@@ -1116,7 +1116,6 @@ fini (xlator_t *this)
LOCK_DESTROY (&priv->lock);
pthread_cond_destroy (&priv->cond);
pthread_mutex_destroy (&priv->mutex);
- pthread_attr_destroy (&priv->w_attr);
GF_FREE (priv);
out:
return;
diff --git a/xlators/features/index/src/index.h b/xlators/features/index/src/index.h
index 5d27b81f85b..36bc9acb74b 100644
--- a/xlators/features/index/src/index.h
+++ b/xlators/features/index/src/index.h
@@ -54,7 +54,6 @@ typedef struct index_priv {
struct list_head callstubs;
pthread_mutex_t mutex;
pthread_cond_t cond;
- pthread_attr_t w_attr;
} index_priv_t;
#define INDEX_STACK_UNWIND(fop, frame, params ...) \