From 22a3bcbd6d56f3da5d929251c3bdda3688874a24 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Thu, 9 May 2019 00:00:00 -0500 Subject: [PATCH] library: remove useless code for 2 'stacks_fetch' guys These changes are an outgrowth of the research/testing behind the previous commit. There is no commingling of select/reap stacks in interfaces beyond the api since there's no need to support any 'reset' function. However, those changes prompted a review of all interfaces offering that 'stacks_fetch' function, thus revealing 2 instances of useless logic/wasted efforts. Signed-off-by: Jim Warner --- proc/diskstats.c | 17 ----------------- proc/slabinfo.c | 17 ----------------- 2 files changed, 34 deletions(-) diff --git a/proc/diskstats.c b/proc/diskstats.c index 3ced1cd4..1349bad0 100644 --- a/proc/diskstats.c +++ b/proc/diskstats.c @@ -485,21 +485,6 @@ static inline struct diskstats_result *diskstats_itemize_stack ( } // end: diskstats_itemize_stack -static void diskstats_itemize_stacks_all ( - struct ext_support *this) -{ - struct stacks_extent *ext = this->extents; - - while (ext) { - int i; - for (i = 0; ext->stacks[i]; i++) - diskstats_itemize_stack(ext->stacks[i]->head, this->numitems, this->items); - ext = ext->next; - }; - this->dirty_stacks = 0; -} // end: diskstats_itemize_stacks_all - - static inline int diskstats_items_check_failed ( enum diskstats_item *items, int numitems) @@ -666,9 +651,7 @@ static int diskstats_stacks_fetch ( if (!info->fetch_ext.extents) { if (!(ext = diskstats_stacks_alloc(&info->fetch_ext, n_alloc))) return -1; // here, errno was set to ENOMEM - memset(info->fetch.anchor, 0, sizeof(void *) * n_alloc); memcpy(info->fetch.anchor, ext->stacks, sizeof(void *) * n_alloc); - diskstats_itemize_stacks_all(&info->fetch_ext); } diskstats_cleanup_stacks_all(&info->fetch_ext); diff --git a/proc/slabinfo.c b/proc/slabinfo.c index 92a83887..f0a9cfd6 100644 --- a/proc/slabinfo.c +++ b/proc/slabinfo.c @@ -568,21 +568,6 @@ static inline struct slabinfo_result *slabinfo_itemize_stack ( } // end: slabinfo_itemize_stack -static void slabinfo_itemize_stacks_all ( - struct ext_support *this) -{ - struct stacks_extent *ext = this->extents; - - while (ext) { - int i; - for (i = 0; ext->stacks[i]; i++) - slabinfo_itemize_stack(ext->stacks[i]->head, this->numitems, this->items); - ext = ext->next; - }; - this->dirty_stacks = 0; -} // end: slabinfo_itemize_stacks_all - - static inline int slabinfo_items_check_failed ( struct ext_support *this, enum slabinfo_item *items, @@ -697,9 +682,7 @@ static int slabinfo_stacks_fetch ( if (!info->fetch_ext.extents) { if (!(ext = slabinfo_stacks_alloc(&info->fetch_ext, n_alloc))) return -1; // here, errno was set to ENOMEM - memset(info->fetch.anchor, 0, sizeof(void *) * n_alloc); memcpy(info->fetch.anchor, ext->stacks, sizeof(void *) * n_alloc); - slabinfo_itemize_stacks_all(&info->fetch_ext); } slabinfo_cleanup_stacks_all(&info->fetch_ext);