This is an automated email from the ASF dual-hosted git repository.
masaori pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new d0b6a4b49b Cleanup: Remove unused dir_ functions (#11739)
d0b6a4b49b is described below
commit d0b6a4b49ba8f2738fe91606c9cea55b06220cec
Author: Masaori Koshiba <[email protected]>
AuthorDate: Tue Aug 27 07:25:10 2024 +0900
Cleanup: Remove unused dir_ functions (#11739)
---
src/iocore/cache/CacheDir.cc | 53 --------------------------------------
src/iocore/cache/P_CacheDir.h | 2 --
src/iocore/cache/P_CacheInternal.h | 33 ------------------------
3 files changed, 88 deletions(-)
diff --git a/src/iocore/cache/CacheDir.cc b/src/iocore/cache/CacheDir.cc
index e32e239dab..34aa8e6a9b 100644
--- a/src/iocore/cache/CacheDir.cc
+++ b/src/iocore/cache/CacheDir.cc
@@ -473,59 +473,6 @@ freelist_pop(int s, Stripe *stripe)
return e;
}
-int
-dir_segment_accounted(int s, Stripe *stripe, int offby, int *f, int *u, int
*et, int *v, int *av, int *as)
-{
- int free = dir_freelist_length(stripe, s);
- int used = 0, empty = 0;
- int valid = 0, agg_valid = 0;
- int64_t agg_size = 0;
- Dir *seg = stripe->dir_segment(s);
- for (int bi = 0; bi < stripe->buckets; bi++) {
- Dir *b = dir_bucket(bi, seg);
- Dir *e = b;
- while (e) {
- if (!dir_offset(e)) {
- ink_assert(e == b);
- empty++;
- } else {
- used++;
- if (dir_valid(stripe, e)) {
- valid++;
- }
- if (dir_agg_valid(stripe, e)) {
- agg_valid++;
- }
- agg_size += dir_approx_size(e);
- }
- e = next_dir(e, seg);
- if (!e) {
- break;
- }
- }
- }
- if (f) {
- *f = free;
- }
- if (u) {
- *u = used;
- }
- if (et) {
- *et = empty;
- }
- if (v) {
- *v = valid;
- }
- if (av) {
- *av = agg_valid;
- }
- if (as) {
- *as = used ? static_cast<int>(agg_size / used) : 0;
- }
- ink_assert(stripe->buckets * DIR_DEPTH - (free + used + empty) <= offby);
- return stripe->buckets * DIR_DEPTH - (free + used + empty) <= offby;
-}
-
void
dir_free_entry(Dir *e, int s, Stripe *stripe)
{
diff --git a/src/iocore/cache/P_CacheDir.h b/src/iocore/cache/P_CacheDir.h
index 0e5d78f0e7..7782712729 100644
--- a/src/iocore/cache/P_CacheDir.h
+++ b/src/iocore/cache/P_CacheDir.h
@@ -282,8 +282,6 @@ void dir_sync_init();
int check_dir(Stripe *stripe);
void dir_clean_vol(Stripe *stripe);
void dir_clear_range(off_t start, off_t end, Stripe *stripe);
-int dir_segment_accounted(int s, Stripe *stripe, int offby = 0, int *free
= nullptr, int *used = nullptr, int *empty = nullptr,
- int *valid = nullptr, int *agg_valid = nullptr,
int *avg_size = nullptr);
uint64_t dir_entries_used(Stripe *stripe);
void sync_cache_dir_on_shutdown();
diff --git a/src/iocore/cache/P_CacheInternal.h
b/src/iocore/cache/P_CacheInternal.h
index 4102daacd0..80e9f15634 100644
--- a/src/iocore/cache/P_CacheInternal.h
+++ b/src/iocore/cache/P_CacheInternal.h
@@ -382,39 +382,6 @@ CacheVC::writer_done()
return false;
}
-inline int
-dir_delete_lock(CacheKey *key, StripeSM *stripe, ProxyMutex *m, Dir *del)
-{
- EThread *thread = m->thread_holding;
- CACHE_TRY_LOCK(lock, stripe->mutex, thread);
- if (!lock.is_locked()) {
- return -1;
- }
- return dir_delete(key, stripe, del);
-}
-
-inline int
-dir_insert_lock(CacheKey *key, StripeSM *stripe, Dir *to_part, ProxyMutex *m)
-{
- EThread *thread = m->thread_holding;
- CACHE_TRY_LOCK(lock, stripe->mutex, thread);
- if (!lock.is_locked()) {
- return -1;
- }
- return dir_insert(key, stripe, to_part);
-}
-
-inline int
-dir_overwrite_lock(CacheKey *key, StripeSM *stripe, Dir *to_part, ProxyMutex
*m, Dir *overwrite, bool must_overwrite = true)
-{
- EThread *thread = m->thread_holding;
- CACHE_TRY_LOCK(lock, stripe->mutex, thread);
- if (!lock.is_locked()) {
- return -1;
- }
- return dir_overwrite(key, stripe, to_part, overwrite, must_overwrite);
-}
-
void inline rand_CacheKey(CacheKey *next_key)
{
EThread *ethread = this_ethread();