]> granicus.if.org Git - procps-ng/commitdiff
library: remove useless code for 2 'stacks_fetch' guys
authorJim Warner <james.warner@comcast.net>
Thu, 9 May 2019 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Thu, 16 May 2019 11:23:06 +0000 (21:23 +1000)
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 <pids> api
since there's no need to support any 'reset' function.

However, those <pids> 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 <james.warner@comcast.net>
proc/diskstats.c
proc/slabinfo.c

index 3ced1cd47172564696545160a5349f7f44b6194e..1349bad0ef9a20150fba8b01e9ef842cea63cd1e 100644 (file)
@@ -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);
 
index 92a838878c7507a0eafe9bb61dc2c638f8a5111b..f0a9cfd625373edccd15c9e0d74ec81edcbf9deb 100644 (file)
@@ -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);