From 31c059893cad8e80c4422d1543d939cac5209341 Mon Sep 17 00:00:00 2001 From: Bryan Call Date: Fri, 20 Mar 2026 09:56:08 -0700 Subject: [PATCH] Remove unused member variables across multiple subsystems Remove unused member variables and dead code identified by static analysis across core, cache, net, proxy, and plugin subsystems. Changes include removing unreferenced fields from Event, HttpSM, CacheVC, AIO, LogBuffer, ConnectingEntry, Http1 transactions, ParentConsistentHash, and SSLNetVConnection. Also removes a permanently dead #ifdef ONLY_USED_FOR_FIB_AND_BIN_HEAP block from Event.h. --- include/iocore/aio/AIO.h | 6 ++-- include/iocore/eventsystem/Event.h | 14 -------- include/proxy/ParentConsistentHash.h | 1 - include/proxy/http/ConnectingEntry.h | 1 - include/proxy/http/Http1ClientTransaction.h | 6 ---- include/proxy/http/Http1ServerTransaction.h | 6 ---- include/proxy/http/HttpSM.h | 11 ++---- include/proxy/logging/LogBuffer.h | 7 ++-- include/tscore/ink_aiocb.h | 2 -- src/iocore/aio/AIO.cc | 3 -- src/iocore/cache/CacheDir.cc | 1 - src/iocore/cache/CacheVC.h | 40 ++++++++++----------- src/iocore/net/P_SSLNetVConnection.h | 3 -- src/proxy/ParentConsistentHash.cc | 6 ++-- src/proxy/http/HttpSM.cc | 3 +- 15 files changed, 31 insertions(+), 79 deletions(-) diff --git a/include/iocore/aio/AIO.h b/include/iocore/aio/AIO.h index dfd14fa925b..56b116c5c55 100644 --- a/include/iocore/aio/AIO.h +++ b/include/iocore/aio/AIO.h @@ -58,7 +58,6 @@ struct ink_aiocb { off_t aio_offset = 0; /* file offset */ int aio_lio_opcode = 0; /* listio operation */ - int aio_state = 0; /* state flag for List I/O */ }; bool ink_aio_thread_num_set(int thread_num); @@ -80,9 +79,8 @@ struct AIOCallback : public Continuation { EThread *thread = AIO_CALLBACK_THREAD_ANY; AIOCallback *then = nullptr; // set on return from aio_read/aio_write - int64_t aio_result = 0; - AIO_Reqs *aio_req = nullptr; - ink_hrtime sleep_time = 0; + int64_t aio_result = 0; + AIO_Reqs *aio_req = nullptr; SLINK(AIOCallback, alink); /* for AIO_Reqs::aio_temp_list */ #if TS_USE_LINUX_IO_URING iovec iov = {}; // this is to support older kernels that only support readv/writev diff --git a/include/iocore/eventsystem/Event.h b/include/iocore/eventsystem/Event.h index 804040979c2..33bff3e62d4 100644 --- a/include/iocore/eventsystem/Event.h +++ b/include/iocore/eventsystem/Event.h @@ -267,20 +267,6 @@ class Event : public Action | UNIX/non-NT Interface | \*-------------------------------------------------------*/ -#ifdef ONLY_USED_FOR_FIB_AND_BIN_HEAP - void *node_pointer; - void - set_node_pointer(void *x) - { - node_pointer = x; - } - void * - get_node_pointer() - { - return node_pointer; - } -#endif - #if defined(__GNUC__) ~Event() override {} #endif diff --git a/include/proxy/ParentConsistentHash.h b/include/proxy/ParentConsistentHash.h index 4a38c16a615..1b0fee2e9b0 100644 --- a/include/proxy/ParentConsistentHash.h +++ b/include/proxy/ParentConsistentHash.h @@ -41,7 +41,6 @@ class ParentConsistentHash : public ParentSelectionStrategy std::unique_ptr hash[2]; std::unique_ptr chash[2]; pRecord *parents[2]; - bool foundParents[2][MAX_PARENTS]; bool ignore_query; int secondary_mode; ParentHashAlgorithm selected_algorithm; diff --git a/include/proxy/http/ConnectingEntry.h b/include/proxy/http/ConnectingEntry.h index 3b14fbb59b4..2b92d4a600f 100644 --- a/include/proxy/http/ConnectingEntry.h +++ b/include/proxy/http/ConnectingEntry.h @@ -54,7 +54,6 @@ class ConnectingEntry : public Continuation MIOBuffer *_netvc_read_buffer = nullptr; IOBufferReader *_netvc_reader = nullptr; Action *_pending_action = nullptr; - NetVCOptions opt; }; struct IpHelper { diff --git a/include/proxy/http/Http1ClientTransaction.h b/include/proxy/http/Http1ClientTransaction.h index 3fd9db4410e..daa210ddb06 100644 --- a/include/proxy/http/Http1ClientTransaction.h +++ b/include/proxy/http/Http1ClientTransaction.h @@ -41,10 +41,4 @@ class Http1ClientTransaction : public Http1Transaction void transaction_done() override; void increment_transactions_stat() override; void decrement_transactions_stat() override; - - //////////////////// - // Variables - -protected: - bool outbound_transparent{false}; }; diff --git a/include/proxy/http/Http1ServerTransaction.h b/include/proxy/http/Http1ServerTransaction.h index 7d3226d1243..5ad321cdae2 100644 --- a/include/proxy/http/Http1ServerTransaction.h +++ b/include/proxy/http/Http1ServerTransaction.h @@ -44,10 +44,4 @@ class Http1ServerTransaction : public Http1Transaction void transaction_done() override; void force_close(); - - //////////////////// - // Variables - -protected: - bool outbound_transparent{false}; }; diff --git a/include/proxy/http/HttpSM.h b/include/proxy/http/HttpSM.h index 3bbbd802a14..fc3e1252452 100644 --- a/include/proxy/http/HttpSM.h +++ b/include/proxy/http/HttpSM.h @@ -483,10 +483,9 @@ class HttpSM : public Continuation, public PluginUserArgs */ void setup_client_request_plugin_agents(HttpTunnelProducer *p, int num_header_bytes = 0); - HttpTransact::StateMachineAction_t last_action = HttpTransact::StateMachineAction_t::UNDEFINED; - int (HttpSM::*m_last_state)(int event, void *data) = nullptr; - virtual void set_next_state(); - void call_transact_and_set_next_state(TransactEntryFunc_t f); + HttpTransact::StateMachineAction_t last_action = HttpTransact::StateMachineAction_t::UNDEFINED; + virtual void set_next_state(); + void call_transact_and_set_next_state(TransactEntryFunc_t f); bool is_http_server_eos_truncation(HttpTunnelProducer *); bool is_bg_fill_necessary(HttpTunnelConsumer *c); @@ -564,11 +563,7 @@ class HttpSM : public Continuation, public PluginUserArgs APIHook const *cur_hook = nullptr; HttpHookState hook_state; - // Continuation time keeper - int64_t prev_hook_start_time = 0; - int reentrancy_count = 0; - int cur_hooks = 0; HttpApiState_t callout_state = HttpApiState_t::NO_CALLOUT; // api_hooks must not be changed directly diff --git a/include/proxy/logging/LogBuffer.h b/include/proxy/logging/LogBuffer.h index 5e85057db08..4f8295ae444 100644 --- a/include/proxy/logging/LogBuffer.h +++ b/include/proxy/logging/LogBuffer.h @@ -284,7 +284,7 @@ class LogBufferList class LogBufferIterator { public: - LogBufferIterator(LogBufferHeader *header, bool in_network_order = false); + LogBufferIterator(LogBufferHeader *header); ~LogBufferIterator(); LogEntryHeader *next(); @@ -295,7 +295,6 @@ class LogBufferIterator LogBufferIterator &operator=(const LogBufferIterator &) = delete; private: - bool m_in_network_order; char *m_next; unsigned m_iter_entry_count; unsigned m_buffer_entry_count; @@ -311,8 +310,8 @@ class LogBufferIterator within a given LogBuffer. -------------------------------------------------------------------------*/ -inline LogBufferIterator::LogBufferIterator(LogBufferHeader *header, bool in_network_order) - : m_in_network_order(in_network_order), m_next(nullptr), m_iter_entry_count(0), m_buffer_entry_count(0) +inline LogBufferIterator::LogBufferIterator(LogBufferHeader *header) + : m_next(nullptr), m_iter_entry_count(0), m_buffer_entry_count(0) { ink_assert(header); diff --git a/include/tscore/ink_aiocb.h b/include/tscore/ink_aiocb.h index ac587b0598b..3b5740a9230 100644 --- a/include/tscore/ink_aiocb.h +++ b/include/tscore/ink_aiocb.h @@ -49,6 +49,4 @@ struct ink_aiocb { off_t aio_offset; /* file offset */ int aio_lio_opcode; /* listio operation */ - int aio_state; /* state flag for List I/O */ - int aio__pad[1]; /* extension padding */ }; diff --git a/src/iocore/aio/AIO.cc b/src/iocore/aio/AIO.cc index 0f69f51d3ed..658494b51b7 100644 --- a/src/iocore/aio/AIO.cc +++ b/src/iocore/aio/AIO.cc @@ -109,7 +109,6 @@ struct AIO_Reqs { ASLL(AIOCallback, alink) aio_temp_list; ink_mutex aio_mutex; ink_cond aio_cond; - int index = 0; /* position of this struct in the aio_reqs array */ int pending = 0; /* number of outstanding requests on the disk */ int queued = 0; /* total number of aio_todo requests */ int filedes = -1; /* the file descriptor for the requests or status IO_NOT_IN_PROGRESS */ @@ -298,13 +297,11 @@ aio_init_fildes(int fildes, int fromAPI = 0) RecInt thread_num; if (fromAPI) { - request->index = 0; request->filedes = -1; aio_reqs[0] = request; thread_is_created = 1; thread_num = api_config_threads_per_disk; } else { - request->index = num_filedes; request->filedes = fildes; aio_reqs[num_filedes] = request; thread_num = cache_config_threads_per_disk; diff --git a/src/iocore/cache/CacheDir.cc b/src/iocore/cache/CacheDir.cc index 413d11c6219..1e1c79df070 100644 --- a/src/iocore/cache/CacheDir.cc +++ b/src/iocore/cache/CacheDir.cc @@ -123,7 +123,6 @@ OpenDir::signal_readers(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) while ((c = delayed_readers.dequeue())) { CACHE_TRY_LOCK(lock, c->mutex, t); if (lock.is_locked()) { - c->f.open_read_timeout = 0; c->handleEvent(EVENT_IMMEDIATE, nullptr); continue; } diff --git a/src/iocore/cache/CacheVC.h b/src/iocore/cache/CacheVC.h index 3ca74ce650b..bfd2d39b225 100644 --- a/src/iocore/cache/CacheVC.h +++ b/src/iocore/cache/CacheVC.h @@ -289,26 +289,26 @@ struct CacheVC : public CacheVConnection { union { uint32_t flags; struct { - unsigned int use_first_key : 1; - unsigned int overwrite : 1; // overwrite first_key Dir if it exists - unsigned int close_complete : 1; // WRITE_COMPLETE is final - unsigned int sync : 1; // write to be committed to durable storage before WRITE_COMPLETE - unsigned int evacuator : 1; - unsigned int single_fragment : 1; - unsigned int evac_vector : 1; - unsigned int lookup : 1; - unsigned int update : 1; - unsigned int remove : 1; - unsigned int remove_aborted_writers : 1; - unsigned int open_read_timeout : 1; // UNUSED - unsigned int data_done : 1; - unsigned int read_from_writer_called : 1; - unsigned int rewrite_resident_alt : 1; - unsigned int readers : 1; - unsigned int doc_from_ram_cache : 1; - unsigned int hit_evacuate : 1; - unsigned int compressed_in_ram : 1; // compressed state in ram cache - unsigned int allow_empty_doc : 1; // used for cache empty http document + unsigned int use_first_key : 1; + unsigned int overwrite : 1; // overwrite first_key Dir if it exists + unsigned int close_complete : 1; // WRITE_COMPLETE is final + unsigned int sync : 1; // write to be committed to durable storage before WRITE_COMPLETE + unsigned int evacuator : 1; + unsigned int single_fragment : 1; + unsigned int evac_vector : 1; + unsigned int lookup : 1; + unsigned int update : 1; + unsigned int remove : 1; + unsigned int remove_aborted_writers : 1; + unsigned int unused_open_read_timeout : 1; // UNUSED, reserved for bitfield layout + unsigned int data_done : 1; + unsigned int read_from_writer_called : 1; + unsigned int rewrite_resident_alt : 1; + unsigned int readers : 1; + unsigned int doc_from_ram_cache : 1; + unsigned int hit_evacuate : 1; + unsigned int compressed_in_ram : 1; // compressed state in ram cache + unsigned int allow_empty_doc : 1; // used for cache empty http document } f; }; // BTF optimization used to skip reading stuff in cache partition that doesn't contain any diff --git a/src/iocore/net/P_SSLNetVConnection.h b/src/iocore/net/P_SSLNetVConnection.h index fdc52726e49..3ff284ff8cc 100644 --- a/src/iocore/net/P_SSLNetVConnection.h +++ b/src/iocore/net/P_SSLNetVConnection.h @@ -254,9 +254,6 @@ class SSLNetVConnection : public UnixNetVConnection, SSLNetVConnection(const SSLNetVConnection &) = delete; SSLNetVConnection &operator=(const SSLNetVConnection &) = delete; - bool protocol_mask_set = false; - unsigned long protocol_mask = 0; - bool peer_provided_cert() const override { diff --git a/src/proxy/ParentConsistentHash.cc b/src/proxy/ParentConsistentHash.cc index ce0cc46c216..3d2be5173a1 100644 --- a/src/proxy/ParentConsistentHash.cc +++ b/src/proxy/ParentConsistentHash.cc @@ -42,10 +42,8 @@ ParentConsistentHash::ParentConsistentHash(ParentRecord *parent_record) selected_algorithm = parent_record->consistent_hash_algorithm; hash_seed0 = parent_record->consistent_hash_seed0; hash_seed1 = parent_record->consistent_hash_seed1; - ink_zero(foundParents); - - hash[PRIMARY] = createHashInstance(selected_algorithm, hash_seed0, hash_seed1); - chash[PRIMARY] = std::make_unique(parent_record->consistent_hash_replicas); + hash[PRIMARY] = createHashInstance(selected_algorithm, hash_seed0, hash_seed1); + chash[PRIMARY] = std::make_unique(parent_record->consistent_hash_replicas); for (i = 0; i < parent_record->num_parents; i++) { chash[PRIMARY]->insert(&(parent_record->parents[i]), parent_record->parents[i].weight, hash[PRIMARY].get()); diff --git a/src/proxy/http/HttpSM.cc b/src/proxy/http/HttpSM.cc index 0aa731a54fb..2bb745057df 100644 --- a/src/proxy/http/HttpSM.cc +++ b/src/proxy/http/HttpSM.cc @@ -5918,8 +5918,7 @@ HttpSM::do_api_callout_internal() } hook_state.init(cur_hook_id, http_global_hooks, _ua.get_txn() ? _ua.get_txn()->feature_hooks() : nullptr, &api_hooks); - cur_hook = nullptr; - cur_hooks = 0; + cur_hook = nullptr; return state_api_callout(0, nullptr); }