mirror of
https://github.com/gluster/glusterfs.git
synced 2026-02-05 15:48:40 +01:00
inode: don't dump the whole table to CLI
dumping the whole inode table detail to screen doesn't solve any purpose. We should be getting only toplevel details on CLI, and then if one wants to debug further, then they need to get to 'statedump' to get full details. Fixes: bz#1580315 Change-Id: Iaf3de94602f9c76832c3c918ffe2ad13c0b0e448 Signed-off-by: Amar Tumballi <amarts@redhat.com>
This commit is contained in:
committed by
Atin Mukherjee
parent
7413d0c0c2
commit
6d6a3b298e
@@ -7606,15 +7606,24 @@ cli_print_volume_status_itables(dict_t *dict, char *prefix)
|
||||
uint32_t active_size = 0;
|
||||
uint32_t lru_size = 0;
|
||||
uint32_t purge_size = 0;
|
||||
uint32_t lru_limit = 0;
|
||||
int i = 0;
|
||||
|
||||
GF_ASSERT(dict);
|
||||
GF_ASSERT(prefix);
|
||||
|
||||
snprintf(key, sizeof(key), "%s.lru_limit", prefix);
|
||||
ret = dict_get_uint32(dict, key, &lru_limit);
|
||||
if (ret)
|
||||
goto out;
|
||||
cli_out("LRU limit : %u", lru_limit);
|
||||
|
||||
snprintf(key, sizeof(key), "%s.active_size", prefix);
|
||||
ret = dict_get_uint32(dict, key, &active_size);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (active_size != 0) {
|
||||
cli_out("Active inodes:");
|
||||
cli_out("%-40s %14s %14s %9s", "GFID", "Lookups", "Ref", "IA type");
|
||||
@@ -7625,11 +7634,17 @@ cli_print_volume_status_itables(dict_t *dict, char *prefix)
|
||||
cli_print_volume_status_inode_entry(dict, key);
|
||||
}
|
||||
cli_out(" ");
|
||||
#else
|
||||
cli_out("Active Inodes : %u", active_size);
|
||||
|
||||
#endif
|
||||
|
||||
snprintf(key, sizeof(key), "%s.lru_size", prefix);
|
||||
ret = dict_get_uint32(dict, key, &lru_size);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (lru_size != 0) {
|
||||
cli_out("LRU inodes:");
|
||||
cli_out("%-40s %14s %14s %9s", "GFID", "Lookups", "Ref", "IA type");
|
||||
@@ -7640,11 +7655,15 @@ cli_print_volume_status_itables(dict_t *dict, char *prefix)
|
||||
cli_print_volume_status_inode_entry(dict, key);
|
||||
}
|
||||
cli_out(" ");
|
||||
#else
|
||||
cli_out("LRU Inodes : %u", lru_size);
|
||||
#endif
|
||||
|
||||
snprintf(key, sizeof(key), "%s.purge_size", prefix);
|
||||
ret = dict_get_uint32(dict, key, &purge_size);
|
||||
if (ret)
|
||||
goto out;
|
||||
#ifdef DEBUG
|
||||
if (purge_size != 0) {
|
||||
cli_out("Purged inodes:");
|
||||
cli_out("%-40s %14s %14s %9s", "GFID", "Lookups", "Ref", "IA type");
|
||||
@@ -7654,6 +7673,9 @@ cli_print_volume_status_itables(dict_t *dict, char *prefix)
|
||||
snprintf(key, sizeof(key), "%s.purge%d", prefix, i);
|
||||
cli_print_volume_status_inode_entry(dict, key);
|
||||
}
|
||||
#else
|
||||
cli_out("Purge Inodes : %u", purge_size);
|
||||
#endif
|
||||
|
||||
out:
|
||||
return;
|
||||
|
||||
@@ -2498,6 +2498,11 @@ inode_table_dump_to_dict(inode_table_t *itable, char *prefix, dict_t *dict)
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
snprintf(key, sizeof(key), "%s.itable.lru_limit", prefix);
|
||||
ret = dict_set_uint32(dict, key, itable->lru_limit);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
snprintf(key, sizeof(key), "%s.itable.active_size", prefix);
|
||||
ret = dict_set_uint32(dict, key, itable->active_size);
|
||||
if (ret)
|
||||
@@ -2513,6 +2518,13 @@ inode_table_dump_to_dict(inode_table_t *itable, char *prefix, dict_t *dict)
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Dumping inode details in dictionary and sending it to CLI is not
|
||||
required as when a developer (or support team) asks for this command
|
||||
output, they just want to get top level detail of inode table.
|
||||
If one wants to debug, let them take statedump and debug, this
|
||||
wouldn't be available in CLI during production setup.
|
||||
*/
|
||||
list_for_each_entry(inode, &itable->active, list)
|
||||
{
|
||||
snprintf(key, sizeof(key), "%s.itable.active%d", prefix, count++);
|
||||
@@ -2532,6 +2544,7 @@ inode_table_dump_to_dict(inode_table_t *itable, char *prefix, dict_t *dict)
|
||||
snprintf(key, sizeof(key), "%s.itable.purge%d", prefix, count++);
|
||||
inode_dump_to_dict(inode, key, dict);
|
||||
}
|
||||
#endif
|
||||
|
||||
out:
|
||||
pthread_mutex_unlock(&itable->lock);
|
||||
|
||||
Reference in New Issue
Block a user