|
|
14f8ab |
From 416dfc70ef87400e1ddfd70e5b6e512d330b54a6 Mon Sep 17 00:00:00 2001
|
|
|
14f8ab |
From: Sheetal Pamecha <sheetal.pamecha08@gmail.com>
|
|
|
14f8ab |
Date: Tue, 2 Apr 2019 23:25:11 +0530
|
|
|
14f8ab |
Subject: [PATCH 43/52] inode: don't dump the whole table to CLI
|
|
|
14f8ab |
|
|
|
14f8ab |
dumping the whole inode table detail to screen doesn't solve any
|
|
|
14f8ab |
purpose. We should be getting only toplevel details on CLI, and
|
|
|
14f8ab |
then if one wants to debug further, then they need to get to
|
|
|
14f8ab |
'statedump' to get full details.
|
|
|
14f8ab |
|
|
|
14f8ab |
Patch on upstream master: https://review.gluster.org/#/c/glusterfs/+/22347/
|
|
|
14f8ab |
|
|
|
14f8ab |
BUG: 1578703
|
|
|
14f8ab |
Change-Id: Ie7e7f5a67c1606e3c18ce21ee6df6c7e4550c211
|
|
|
14f8ab |
Signed-off-by: Sheetal Pamecha <spamecha@redhat.com>
|
|
|
14f8ab |
Reviewed-on: https://code.engineering.redhat.com/gerrit/166768
|
|
|
14f8ab |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
14f8ab |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
14f8ab |
---
|
|
|
14f8ab |
cli/src/cli-rpc-ops.c | 23 ++++++++++++++++++++++-
|
|
|
14f8ab |
libglusterfs/src/inode.c | 13 +++++++++++++
|
|
|
14f8ab |
2 files changed, 35 insertions(+), 1 deletion(-)
|
|
|
14f8ab |
|
|
|
14f8ab |
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
|
|
|
14f8ab |
index 78043cd..12e7fcc 100644
|
|
|
14f8ab |
--- a/cli/src/cli-rpc-ops.c
|
|
|
14f8ab |
+++ b/cli/src/cli-rpc-ops.c
|
|
|
14f8ab |
@@ -7606,15 +7606,24 @@ cli_print_volume_status_itables(dict_t *dict, char *prefix)
|
|
|
14f8ab |
uint32_t active_size = 0;
|
|
|
14f8ab |
uint32_t lru_size = 0;
|
|
|
14f8ab |
uint32_t purge_size = 0;
|
|
|
14f8ab |
+ uint32_t lru_limit = 0;
|
|
|
14f8ab |
int i = 0;
|
|
|
14f8ab |
|
|
|
14f8ab |
GF_ASSERT(dict);
|
|
|
14f8ab |
GF_ASSERT(prefix);
|
|
|
14f8ab |
|
|
|
14f8ab |
+ snprintf(key, sizeof(key), "%s.lru_limit", prefix);
|
|
|
14f8ab |
+ ret = dict_get_uint32(dict, key, &lru_limit);
|
|
|
14f8ab |
+ if (ret)
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ cli_out("LRU limit : %u", lru_limit);
|
|
|
14f8ab |
+
|
|
|
14f8ab |
snprintf(key, sizeof(key), "%s.active_size", prefix);
|
|
|
14f8ab |
ret = dict_get_uint32(dict, key, &active_size);
|
|
|
14f8ab |
if (ret)
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+#ifdef DEBUG
|
|
|
14f8ab |
if (active_size != 0) {
|
|
|
14f8ab |
cli_out("Active inodes:");
|
|
|
14f8ab |
cli_out("%-40s %14s %14s %9s", "GFID", "Lookups", "Ref", "IA type");
|
|
|
14f8ab |
@@ -7626,10 +7635,16 @@ cli_print_volume_status_itables(dict_t *dict, char *prefix)
|
|
|
14f8ab |
}
|
|
|
14f8ab |
cli_out(" ");
|
|
|
14f8ab |
|
|
|
14f8ab |
+#else
|
|
|
14f8ab |
+ cli_out("Active Inodes : %u", active_size);
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+#endif
|
|
|
14f8ab |
snprintf(key, sizeof(key), "%s.lru_size", prefix);
|
|
|
14f8ab |
ret = dict_get_uint32(dict, key, &lru_size);
|
|
|
14f8ab |
if (ret)
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+#ifdef DEBUG
|
|
|
14f8ab |
if (lru_size != 0) {
|
|
|
14f8ab |
cli_out("LRU inodes:");
|
|
|
14f8ab |
cli_out("%-40s %14s %14s %9s", "GFID", "Lookups", "Ref", "IA type");
|
|
|
14f8ab |
@@ -7640,11 +7655,15 @@ cli_print_volume_status_itables(dict_t *dict, char *prefix)
|
|
|
14f8ab |
cli_print_volume_status_inode_entry(dict, key);
|
|
|
14f8ab |
}
|
|
|
14f8ab |
cli_out(" ");
|
|
|
14f8ab |
+#else
|
|
|
14f8ab |
+ cli_out("LRU Inodes : %u", lru_size);
|
|
|
14f8ab |
+#endif
|
|
|
14f8ab |
|
|
|
14f8ab |
snprintf(key, sizeof(key), "%s.purge_size", prefix);
|
|
|
14f8ab |
ret = dict_get_uint32(dict, key, &purge_size);
|
|
|
14f8ab |
if (ret)
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
+#ifdef DEBUG
|
|
|
14f8ab |
if (purge_size != 0) {
|
|
|
14f8ab |
cli_out("Purged inodes:");
|
|
|
14f8ab |
cli_out("%-40s %14s %14s %9s", "GFID", "Lookups", "Ref", "IA type");
|
|
|
14f8ab |
@@ -7654,7 +7673,9 @@ cli_print_volume_status_itables(dict_t *dict, char *prefix)
|
|
|
14f8ab |
snprintf(key, sizeof(key), "%s.purge%d", prefix, i);
|
|
|
14f8ab |
cli_print_volume_status_inode_entry(dict, key);
|
|
|
14f8ab |
}
|
|
|
14f8ab |
-
|
|
|
14f8ab |
+#else
|
|
|
14f8ab |
+ cli_out("Purge Inodes : %u", purge_size);
|
|
|
14f8ab |
+#endif
|
|
|
14f8ab |
out:
|
|
|
14f8ab |
return;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
|
|
|
14f8ab |
index 87f74e0..96ddea5 100644
|
|
|
14f8ab |
--- a/libglusterfs/src/inode.c
|
|
|
14f8ab |
+++ b/libglusterfs/src/inode.c
|
|
|
14f8ab |
@@ -2598,6 +2598,11 @@ inode_table_dump_to_dict(inode_table_t *itable, char *prefix, dict_t *dict)
|
|
|
14f8ab |
if (ret)
|
|
|
14f8ab |
return;
|
|
|
14f8ab |
|
|
|
14f8ab |
+ snprintf(key, sizeof(key), "%s.itable.lru_limit", prefix);
|
|
|
14f8ab |
+ ret = dict_set_uint32(dict, key, itable->lru_limit);
|
|
|
14f8ab |
+ if (ret)
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
snprintf(key, sizeof(key), "%s.itable.active_size", prefix);
|
|
|
14f8ab |
ret = dict_set_uint32(dict, key, itable->active_size);
|
|
|
14f8ab |
if (ret)
|
|
|
14f8ab |
@@ -2613,6 +2618,13 @@ inode_table_dump_to_dict(inode_table_t *itable, char *prefix, dict_t *dict)
|
|
|
14f8ab |
if (ret)
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
|
|
|
14f8ab |
+#ifdef DEBUG
|
|
|
14f8ab |
+ /* Dumping inode details in dictionary and sending it to CLI is not
|
|
|
14f8ab |
+ required as when a developer (or support team) asks for this command
|
|
|
14f8ab |
+ output, they just want to get top level detail of inode table.
|
|
|
14f8ab |
+ If one wants to debug, let them take statedump and debug, this
|
|
|
14f8ab |
+ wouldn't be available in CLI during production setup.
|
|
|
14f8ab |
+ */
|
|
|
14f8ab |
list_for_each_entry(inode, &itable->active, list)
|
|
|
14f8ab |
{
|
|
|
14f8ab |
snprintf(key, sizeof(key), "%s.itable.active%d", prefix, count++);
|
|
|
14f8ab |
@@ -2632,6 +2644,7 @@ inode_table_dump_to_dict(inode_table_t *itable, char *prefix, dict_t *dict)
|
|
|
14f8ab |
snprintf(key, sizeof(key), "%s.itable.purge%d", prefix, count++);
|
|
|
14f8ab |
inode_dump_to_dict(inode, key, dict);
|
|
|
14f8ab |
}
|
|
|
14f8ab |
+#endif
|
|
|
14f8ab |
|
|
|
14f8ab |
out:
|
|
|
14f8ab |
pthread_mutex_unlock(&itable->lock);
|
|
|
14f8ab |
--
|
|
|
14f8ab |
1.8.3.1
|
|
|
14f8ab |
|