summaryrefslogtreecommitdiffstats
path: root/xlators/performance
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2012-08-13 14:05:17 +0530
committerAnand Avati <avati@redhat.com>2012-09-19 16:09:27 -0700
commita3c5722b39895f5fa4721cfae456e26bc758b33a (patch)
tree173687b47ff3851b5b29c2acd0299701c7721616 /xlators/performance
parent1c5dafc906833a4530142057061cd82b9d4a7ca6 (diff)
performance/io-cache: provide hook for dumping inode context
Change-Id: Idcf24200ad8f0cf018ab92118f6b77cc4b9edcab BUG: 843787 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.org/3816 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/performance')
-rw-r--r--xlators/performance/io-cache/src/io-cache.c67
1 files changed, 38 insertions, 29 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index 55a04f12f..0793e6043 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -1874,16 +1874,30 @@ out:
}
-void
-ioc_inode_dump (ioc_inode_t *ioc_inode, char *prefix)
+int
+ioc_inode_dump (xlator_t *this, inode_t *inode)
{
- char *path = NULL;
- int ret = -1;
+ char *path = NULL;
+ int ret = -1;
+ char key_prefix[GF_DUMP_MAX_BUF_LEN] = {0, };
+ uint64_t tmp_ioc_inode = 0;
+ ioc_inode_t *ioc_inode = NULL;
+ gf_boolean_t section_added = _gf_false;
+ char uuid_str[64] = {0,};
- if ((ioc_inode == NULL) || (prefix == NULL)) {
+ if (this == NULL || inode == NULL)
goto out;
- }
+
+ gf_proc_dump_build_key (key_prefix, "io-cache", "inode");
+
+ inode_ctx_get (inode, this, &tmp_ioc_inode);
+ ioc_inode = (ioc_inode_t *)(long)tmp_ioc_inode;
+ if (ioc_inode == NULL)
+ goto out;
+
+ gf_proc_dump_add_section (key_prefix);
+ section_added = _gf_true;
/* Similar to ioc_page_dump function its better to use
* pthread_mutex_trylock and not to use gf_log in statedump
@@ -1892,42 +1906,40 @@ ioc_inode_dump (ioc_inode_t *ioc_inode, char *prefix)
ret = pthread_mutex_trylock (&ioc_inode->inode_lock);
if (ret)
goto out;
+ else
{
gf_proc_dump_write ("inode.weight", "%d", ioc_inode->weight);
+
//inode_path takes blocking lock on the itable.
- ret = pthread_mutex_trylock (&ioc_inode->inode->table->lock);
- if (ret)
- goto unlock;
- {
- __inode_path (ioc_inode->inode, NULL, &path);
- }
- pthread_mutex_unlock (&ioc_inode->inode->table->lock);
+ __inode_path (ioc_inode->inode, NULL, &path);
if (path) {
gf_proc_dump_write ("path", "%s", path);
GF_FREE (path);
}
- gf_proc_dump_write ("uuid", "%s", uuid_utoa
- (ioc_inode->inode->gfid));
- __ioc_cache_dump (ioc_inode, prefix);
- __ioc_inode_waitq_dump (ioc_inode, prefix);
+ gf_proc_dump_write ("uuid", "%s", uuid_utoa_r
+ (ioc_inode->inode->gfid, uuid_str));
+ __ioc_cache_dump (ioc_inode, key_prefix);
+ __ioc_inode_waitq_dump (ioc_inode, key_prefix);
+
+ pthread_mutex_unlock (&ioc_inode->inode_lock);
}
-unlock:
- pthread_mutex_unlock (&ioc_inode->inode_lock);
out:
- if (ret && ioc_inode)
+ if (ret && ioc_inode) {
+ if (section_added == _gf_false)
+ gf_proc_dump_add_section (key_prefix);
gf_proc_dump_write ("Unable to print the status of ioc_inode",
"(Lock acquisition failed) %s",
- uuid_utoa (ioc_inode->inode->gfid));
- return;
+ uuid_utoa (inode->gfid));
+ }
+ return ret;
}
int
ioc_priv_dump (xlator_t *this)
{
ioc_table_t *priv = NULL;
- ioc_inode_t *ioc_inode = NULL;
char key_prefix[GF_DUMP_MAX_BUF_LEN] = {0, };
int ret = -1;
gf_boolean_t add_section = _gf_false;
@@ -1936,8 +1948,8 @@ ioc_priv_dump (xlator_t *this)
goto out;
priv = this->private;
- gf_proc_dump_build_key (key_prefix, "xlator.performance.io-cache",
- "priv");
+
+ gf_proc_dump_build_key (key_prefix, "io-cache", "priv");
gf_proc_dump_add_section (key_prefix);
add_section = _gf_true;
@@ -1952,10 +1964,6 @@ ioc_priv_dump (xlator_t *this)
gf_proc_dump_write ("cache_timeout", "%u", priv->cache_timeout);
gf_proc_dump_write ("min-file-size", "%u", priv->min_file_size);
gf_proc_dump_write ("max-file-size", "%u", priv->max_file_size);
-
- list_for_each_entry (ioc_inode, &priv->inodes, inode_list) {
- ioc_inode_dump (ioc_inode, key_prefix);
- }
}
pthread_mutex_unlock (&priv->table_lock);
out:
@@ -2034,6 +2042,7 @@ struct xlator_fops fops = {
struct xlator_dumpops dumpops = {
.priv = ioc_priv_dump,
+ .inodectx = ioc_inode_dump,
};
struct xlator_cbks cbks = {