This is an automated email from the ASF dual-hosted git repository.
jvanderzee 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 42114d4de3 Rename `Stripe` to `StripeSM` (#11562)
42114d4de3 is described below
commit 42114d4de3278a99450552daabd66056514f1057
Author: JosiahWI <[email protected]>
AuthorDate: Thu Jul 18 05:10:09 2024 -0500
Rename `Stripe` to `StripeSM` (#11562)
* Rename `Stripe` to `StripeSM`
* Update documentation for name change
* Apply formatting
---
.../cache-architecture/architecture.en.rst | 22 +++----
.../cache-architecture/core-cache-functions.en.rst | 2 +-
.../cache-architecture/data-structures.en.rst | 26 ++++-----
include/iocore/cache/CacheVC.h | 2 +-
src/iocore/cache/AggregateWriteBuffer.h | 4 +-
src/iocore/cache/Cache.cc | 32 +++++-----
src/iocore/cache/CacheDir.cc | 52 ++++++++---------
src/iocore/cache/CacheHosting.cc | 4 +-
src/iocore/cache/CacheRead.cc | 4 +-
src/iocore/cache/CacheTest.cc | 8 +--
src/iocore/cache/CacheVC.cc | 8 +--
src/iocore/cache/CacheWrite.cc | 54 ++++++++---------
src/iocore/cache/P_CacheDir.h | 46 +++++++--------
src/iocore/cache/P_CacheDisk.h | 2 +-
src/iocore/cache/P_CacheHosting.h | 4 +-
src/iocore/cache/P_CacheInternal.h | 32 +++++-----
src/iocore/cache/P_CacheVol.h | 58 +++++++++---------
src/iocore/cache/P_RamCache.h | 2 +-
src/iocore/cache/RamCacheCLFUS.cc | 6 +-
src/iocore/cache/RamCacheLRU.cc | 10 ++--
src/iocore/cache/Stripe.cc | 68 +++++++++++-----------
src/iocore/cache/unit_tests/test_CacheDir.cc | 6 +-
src/iocore/cache/unit_tests/test_Stripe.cc | 24 ++++----
src/iocore/cache/unit_tests/test_doubles.h | 2 +-
src/traffic_cache_tool/CacheDefs.cc | 62 ++++++++++----------
src/traffic_cache_tool/CacheDefs.h | 18 +++---
src/traffic_cache_tool/CacheScan.h | 6 +-
src/traffic_cache_tool/CacheTool.cc | 40 ++++++-------
28 files changed, 302 insertions(+), 302 deletions(-)
diff --git a/doc/developer-guide/cache-architecture/architecture.en.rst
b/doc/developer-guide/cache-architecture/architecture.en.rst
index 89dc36ffee..d7cfae3638 100644
--- a/doc/developer-guide/cache-architecture/architecture.en.rst
+++ b/doc/developer-guide/cache-architecture/architecture.en.rst
@@ -126,7 +126,7 @@ span of bytes. Internally each stripe is treated almost
entirely independently.
The data structures described in this section are duplicated for each stripe.
Internally the term *volume* is used for these stripes and implemented
primarily
-in :cpp:class:`Stripe`. What a user thinks of as a volume (and what this
document
+in :cpp:class:`StripeSM`. What a user thinks of as a volume (and what this
document
calls a *cache volume*) is represented by :cpp:class:`CacheVol`.
.. note::
@@ -280,11 +280,11 @@ start
The offset for the start of the content, after the stripe metadata.
length
- Total number of bytes in the stripe. :cpp:member:`Stripe::len`.
+ Total number of bytes in the stripe. :cpp:member:`StripeSM::len`.
data length
Total number of blocks in the stripe available for content storage.
- :cpp:member:`Stripe::data_blocks`.
+ :cpp:member:`StripeSM::data_blocks`.
.. note::
@@ -505,7 +505,7 @@ Disk Failure
The cache is designed to be relatively resistant to disk failures. Because each
:term:`storage unit` in each :term:`cache volume` is mostly independent, the
-loss of a disk simply means that the corresponding :cpp:class:`Stripe`
instances
+loss of a disk simply means that the corresponding :cpp:class:`StripeSM`
instances
(one per cache volume that uses the storage unit) becomes unusable. The primary
issue is updating the volume assignment table to both preserve assignments for
objects on still operational volumes while distributing the assignments from
the
@@ -778,7 +778,7 @@ The basic steps to a cache lookup are:
#. The cache stripe is determined (based on the cache key).
- The :term:`cache key` is used as a hash key in to an array of
:cpp:class:`Stripe` instances by
+ The :term:`cache key` is used as a hash key in to an array of
:cpp:class:`StripeSM` instances by
:func:`Cache::key_to_stripe`. The construction and arrangement of this
array is the essence of how
volumes are assigned.
@@ -939,7 +939,7 @@ Aggregation Buffer
------------------
Disk writes to cache are handled through an *aggregation buffer*. There is one
-for each :cpp:class:`Stripe` instance. To minimize the number of system calls
data
+for each :cpp:class:`StripeSM` instance. To minimize the number of system
calls data
is written to disk in units of roughly :ref:`target fragment size
<target-fragment-size>`
bytes. The algorithm used is simple: data is piled up in the aggregation buffer
until no more will fit without going over the target fragment size, at which
@@ -974,11 +974,11 @@ In some cases this is not acceptable and the object is
*evacuated* by reading
it from the cache and then writing it back to cache which moves the physical
storage of the object from in front of the write cursor to behind the write
cursor. Objects that are evacuated are handled in this way based on data in
-stripe data structures (attached to the :cpp:class:`Stripe` instance).
+stripe data structures (attached to the :cpp:class:`StripeSM` instance).
Evacuation data structures are defined by dividing up the volume content into
a disjoint and contiguous set of regions of ``EVACUATION_BUCKET_SIZE`` bytes.
-The :cpp:member:`Stripe::evacuate` member is an array with an element for each
+The :cpp:member:`StripeSM::evacuate` member is an array with an element for
each
evacuation region. Each element is a doubly linked list of
:cpp:class:`EvacuationBlock`
instances. Each instance contains a :cpp:class:`Dir` that specifies the
fragment
to evacuate. It is assumed that an evacuation block is placed in the evacuation
@@ -1004,14 +1004,14 @@ if the count goes to zero. If the ``EvacuationBlock``
already exists with a
count of zero, the count is not modified and the number of readers is not
tracked, so the evacuation is valid as long as the object exists.
-Evacuation is driven by cache writes, essentially in
:cpp:member:`Stripe::aggWrite`.
+Evacuation is driven by cache writes, essentially in
:cpp:member:`StripeSM::aggWrite`.
This method processes the pending cache virtual connections that are trying to
write to the stripe. Some of these may be evacuation virtual connections. If so
then the completion callback for that virtual connection is called as the data
is put in to the aggregation buffer.
When no more cache virtual connections can be processed (due to an empty queue
-or the aggregation buffer filling) then :cpp:member:`Stripe::evac_range` is
called
+or the aggregation buffer filling) then :cpp:member:`StripeSM::evac_range` is
called
to clear the range to be overwritten plus an additional
:c:macro:`EVACUATION_SIZE`
range. The buckets covering that range are checked. If there are any items in
the buckets a new cache virtual connection (a *doc evacuator*) is created and
@@ -1021,7 +1021,7 @@ the read completes it is checked for validity and if
valid, the cache virtual
connection for it is placed at the front of the write queue for the stripe and
the write aggregation resumed.
-Before doing a write, the method :cpp:member:`Stripe::evac_range()` is called
to
+Before doing a write, the method :cpp:member:`StripeSM::evac_range()` is
called to
start an evacuation. If any fragments are found in the buckets in the range the
earliest such fragment (smallest offset, closest to the write cursor) is
selected and read from disk and the aggregation buffer write is suspended. The
diff --git a/doc/developer-guide/cache-architecture/core-cache-functions.en.rst
b/doc/developer-guide/cache-architecture/core-cache-functions.en.rst
index fe9726e9b7..bcba1e35f2 100644
--- a/doc/developer-guide/cache-architecture/core-cache-functions.en.rst
+++ b/doc/developer-guide/cache-architecture/core-cache-functions.en.rst
@@ -96,7 +96,7 @@ Core Cache Types
Core Cache Functions
====================
-.. cpp:function:: int dir_probe(const CacheKey * key, Stripe * d, Dir *
result, Dir ** last_collision)
+.. cpp:function:: int dir_probe(const CacheKey * key, StripeSM * d, Dir *
result, Dir ** last_collision)
Probe the stripe directory for a candidate directory entry.
diff --git a/doc/developer-guide/cache-architecture/data-structures.en.rst
b/doc/developer-guide/cache-architecture/data-structures.en.rst
index 4c504e21e1..0cbee69c08 100644
--- a/doc/developer-guide/cache-architecture/data-structures.en.rst
+++ b/doc/developer-guide/cache-architecture/data-structures.en.rst
@@ -27,9 +27,9 @@ Data Structures
hide empty members
- CacheHostRecord *-- "*" Stripe : stripe >
+ CacheHostRecord *-- "*" StripeSM : stripe >
CacheHostRecord *-- "*" CacheVol : cp >
- CacheVol *-- "*" Stripe : stripe >
+ CacheVol *-- "*" StripeSM : stripe >
.. var:: size_t STORE_BLOCK_SIZE = 8192
@@ -58,7 +58,7 @@ Data Structures
The cache volumes that are part of this cache host record.
- .. member:: Stripe ** vols
+ .. member:: StripeSM ** vols
The stripes that are part of the cache volumes. This is the union over
the stripes of
:member:`CacheHostRecord::cp`
@@ -133,7 +133,7 @@ Data Structures
* Timestamps for request and response from :term:`origin server`.
-.. class:: Stripe
+.. class:: StripeSM
This represents a :term:`storage unit` inside a :term:`cache volume`.
@@ -279,11 +279,11 @@ Data Structures
.. class:: DiskStripeBlock
- A description of a span stripe (Stripe) block . This is a serialized data
structure.
+ A description of a span stripe (StripeSM) block . This is a serialized data
structure.
.. member:: uint64_t offset
- Offset in the span of the start of the span stripe (Stripe) block, in
bytes.
+ Offset in the span of the start of the span stripe (StripeSM) block, in
bytes.
.. member:: uint64_t len
@@ -356,7 +356,7 @@ Data Structures
.. member:: int new_block
- Indicates if this is a new stripe rather than an existing one. In case a
stripe is new ATS decides to clear that stripe(:class:`Stripe`)
+ Indicates if this is a new stripe rather than an existing one. In case a
stripe is new ATS decides to clear that stripe(:class:`StripeSM`)
.. member:: LINK<DiskStripeBlockQueue> link
@@ -372,7 +372,7 @@ Data Structures
.. member:: int vol_number
- Identification number of the stripe (:class:`Stripe`)
+ Identification number of the stripe (:class:`StripeSM`)
.. member:: uint64_t size
@@ -407,11 +407,11 @@ Data Structures
.. member:: int num_vols
- Number of stripes(:class:`Stripe`) contained in this volume
+ Number of stripes(:class:`StripeSM`) contained in this volume
- .. member:: Stripe** vols
+ .. member:: StripeSM** vols
- :class:`Stripe` represents a single stripe in the disk. vols contains
all the stripes this volume is made up of
+ :class:`StripeSM` represents a single stripe in the disk. vols contains
all the stripes this volume is made up of
.. member:: DiskStripe** disk_vols
@@ -466,9 +466,9 @@ Data Structures
A generic class:`CacheHostRecord` that contains all cache volumes that
are not explicitly
assigned in :file:`hosting.config`.
- .. function:: Stripe * key_to_stripe(CryptoHash * key, const char * host,
int host_len)
+ .. function:: StripeSM * key_to_stripe(CryptoHash * key, const char * host,
int host_len)
- Compute the stripe (:code:`Stripe *`) for a cache :arg:`key` and
:arg:`host`. The :arg:`host` is
+ Compute the stripe (:code:`StripeSM *`) for a cache :arg:`key` and
:arg:`host`. The :arg:`host` is
used to find the appropriate :class:`CacheHostRecord` instance. From
there the stripe
assignment slot is determined by taking bits 64..83 (20 bits) of the
cache :arg:`key` modulo
the stripe assignment array count (:code:`STRIPE_HASH_TABLE_SIZE`).
These bits are the third 32
diff --git a/include/iocore/cache/CacheVC.h b/include/iocore/cache/CacheVC.h
index e9384fdd44..5b862065de 100644
--- a/include/iocore/cache/CacheVC.h
+++ b/include/iocore/cache/CacheVC.h
@@ -260,7 +260,7 @@ struct CacheVC : public CacheVConnection {
uint32_t write_len; // for communicating with agg_copy
uint32_t agg_len; // for communicating with aggWrite
uint32_t write_serial; // serial of the final write for SYNC
- Stripe *stripe;
+ StripeSM *stripe;
Dir *last_collision;
Event *trigger;
CacheKey *read_key;
diff --git a/src/iocore/cache/AggregateWriteBuffer.h
b/src/iocore/cache/AggregateWriteBuffer.h
index ad99b03ce0..998b081260 100644
--- a/src/iocore/cache/AggregateWriteBuffer.h
+++ b/src/iocore/cache/AggregateWriteBuffer.h
@@ -80,7 +80,7 @@ public:
* have a correct len field, and its headers and data must follow it. This
* requires a pointer to a full document buffer - not just the Doc struct.
* @param approx_size The approximate size of all headers and data as
- * determined by Stripe::round_to_approx_size. The document may not need
+ * determined by StripeSM::round_to_approx_size. The document may not need
* this much space.
*
*/
@@ -100,7 +100,7 @@ public:
* The new document will be uninitialized.
*
* @param approx_size The approximate size of all headers and data as
- * determined by Stripe::round_to_approx_size. The document may not need
+ * determined by StripeSM::round_to_approx_size. The document may not need
* this much space.
* @return Returns a non-owning pointer to the new document.
*/
diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index c263b7d55c..2045edf825 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -95,7 +95,7 @@ bool CacheProcessor::check
= false;
int CacheProcessor::start_internal_flags = 0;
int CacheProcessor::auto_clear_flag = 0;
CacheProcessor cacheProcessor;
-Stripe **gstripes = nullptr;
+StripeSM **gstripes = nullptr;
std::atomic<int> gnstripes = 0;
ClassAllocator<CacheVC>
cacheVConnectionAllocator("cacheVConnection");
ClassAllocator<CacheEvacuateDocVC>
cacheEvacuateDocVConnectionAllocator("cacheEvacuateDocVC");
@@ -229,8 +229,8 @@ CachePeriodicMetricsUpdate()
if (cacheProcessor.initialized == CACHE_INITIALIZED) {
for (int i = 0; i < gnstripes; ++i) {
- Stripe *v = gstripes[i];
- int64_t used = cache_bytes_used(i);
+ StripeSM *v = gstripes[i];
+ int64_t used = cache_bytes_used(i);
Metrics::Gauge::increment(v->cache_vol->vol_rsb.bytes_used, used); //
This assumes they start at zero
total_sum += used;
@@ -559,8 +559,8 @@ CacheProcessor::diskInitialized()
}
}
- gstripes = static_cast<Stripe **>(ats_malloc(gnstripes * sizeof(Stripe *)));
- memset(gstripes, 0, gnstripes * sizeof(Stripe *));
+ gstripes = static_cast<StripeSM **>(ats_malloc(gnstripes * sizeof(StripeSM
*)));
+ memset(gstripes, 0, gnstripes * sizeof(StripeSM *));
gnstripes = 0;
for (i = 0; i < gndisks; i++) {
CacheDisk *d = gdisks[i];
@@ -631,7 +631,7 @@ CacheProcessor::cacheInitialized()
}
// scan the rest of the stripes.
for (int i = 1; i < gnstripes; i++) {
- Stripe *v = gstripes[i];
+ StripeSM *v = gstripes[i];
if (v->header->version < cacheProcessor.min_stripe_version) {
cacheProcessor.min_stripe_version = v->header->version;
}
@@ -689,8 +689,8 @@ CacheProcessor::cacheInitialized()
uint64_t total_ram_cache_bytes = 0;
for (int i = 0; i < gnstripes; i++) {
- Stripe *stripe = gstripes[i];
- int64_t ram_cache_bytes = 0;
+ StripeSM *stripe = gstripes[i];
+ int64_t ram_cache_bytes = 0;
if (stripe->cache_vol->ramcache_enabled) {
if (http_ram_cache_size == 0) {
@@ -873,10 +873,10 @@ build_vol_hash_table(CacheHostRecord *cp)
{
int num_vols = cp->num_vols;
unsigned int *mapping = static_cast<unsigned int
*>(ats_malloc(sizeof(unsigned int) * num_vols));
- Stripe **p = static_cast<Stripe **>(ats_malloc(sizeof(Stripe *)
* num_vols));
+ StripeSM **p = static_cast<StripeSM **>(ats_malloc(sizeof(StripeSM
*) * num_vols));
memset(mapping, 0, num_vols * sizeof(unsigned int));
- memset(p, 0, num_vols * sizeof(Stripe *));
+ memset(p, 0, num_vols * sizeof(StripeSM *));
uint64_t total = 0;
int bad_vols = 0;
int map = 0;
@@ -1181,13 +1181,13 @@ Cache::open(bool clear, bool /* fix ATS_UNUSED */)
CacheVol *cp = cp_list.head;
for (; cp; cp = cp->link.next) {
if (cp->scheme == scheme) {
- cp->stripes = static_cast<Stripe **>(ats_malloc(cp->num_vols *
sizeof(Stripe *)));
+ cp->stripes = static_cast<StripeSM **>(ats_malloc(cp->num_vols *
sizeof(StripeSM *)));
int vol_no = 0;
for (i = 0; i < gndisks; i++) {
if (cp->disk_stripes[i] && !DISK_BAD(cp->disk_stripes[i]->disk)) {
DiskStripeBlockQueue *q = cp->disk_stripes[i]->dpb_queue.head;
for (; q; q = q->link.next) {
- cp->stripes[vol_no] = new Stripe();
+ cp->stripes[vol_no] = new StripeSM();
CacheDisk *d = cp->disk_stripes[i]->disk;
cp->stripes[vol_no]->disk = d;
cp->stripes[vol_no]->fd = d->fd;
@@ -1226,8 +1226,8 @@ Cache::lookup(Continuation *cont, const CacheKey *key,
CacheFragType type, const
return ACTION_RESULT_DONE;
}
- Stripe *stripe = key_to_stripe(key, hostname, host_len);
- CacheVC *c = new_CacheVC(cont);
+ StripeSM *stripe = key_to_stripe(key, hostname, host_len);
+ CacheVC *c = new_CacheVC(cont);
SET_CONTINUATION_HANDLER(c, &CacheVC::openReadStartHead);
c->vio.op = VIO::READ;
c->op_type = static_cast<int>(CacheOpType::Lookup);
@@ -1263,7 +1263,7 @@ Cache::remove(Continuation *cont, const CacheKey *key,
CacheFragType type, const
CACHE_TRY_LOCK(lock, cont->mutex, this_ethread());
ink_assert(lock.is_locked());
- Stripe *stripe = key_to_stripe(key, hostname, host_len);
+ StripeSM *stripe = key_to_stripe(key, hostname, host_len);
// coverity[var_decl]
Dir result;
dir_clear(&result); // initialized here, set result empty so we can
recognize missed lock
@@ -1807,7 +1807,7 @@ rebuild_host_table(Cache *cache)
}
// if generic_host_rec.stripes == nullptr, what do we do???
-Stripe *
+StripeSM *
Cache::key_to_stripe(const CacheKey *key, const char *hostname, int host_len)
{
ReplaceablePtr<CacheHostTable>::ScopedReader hosttable(&this->hosttable);
diff --git a/src/iocore/cache/CacheDir.cc b/src/iocore/cache/CacheDir.cc
index 0cb0d80486..d892130110 100644
--- a/src/iocore/cache/CacheDir.cc
+++ b/src/iocore/cache/CacheDir.cc
@@ -214,7 +214,7 @@ dir_bucket_loop_check(Dir *start_dir, Dir *seg)
// adds all the directory entries
// in a segment to the segment freelist
void
-dir_init_segment(int s, Stripe *stripe)
+dir_init_segment(int s, StripeSM *stripe)
{
stripe->header->freelist[s] = 0;
Dir *seg = stripe->dir_segment(s);
@@ -231,7 +231,7 @@ dir_init_segment(int s, Stripe *stripe)
// break the infinite loop in directory entries
// Note : abuse of the token bit in dir entries
int
-dir_bucket_loop_fix(Dir *start_dir, int s, Stripe *stripe)
+dir_bucket_loop_fix(Dir *start_dir, int s, StripeSM *stripe)
{
if (!dir_bucket_loop_check(start_dir, stripe->dir_segment(s))) {
Warning("Dir loop exists, clearing segment %d", s);
@@ -242,7 +242,7 @@ dir_bucket_loop_fix(Dir *start_dir, int s, Stripe *stripe)
}
int
-dir_freelist_length(Stripe *stripe, int s)
+dir_freelist_length(StripeSM *stripe, int s)
{
int free = 0;
Dir *seg = stripe->dir_segment(s);
@@ -258,7 +258,7 @@ dir_freelist_length(Stripe *stripe, int s)
}
int
-dir_bucket_length(Dir *b, int s, Stripe *stripe)
+dir_bucket_length(Dir *b, int s, StripeSM *stripe)
{
Dir *e = b;
int i = 0;
@@ -278,7 +278,7 @@ dir_bucket_length(Dir *b, int s, Stripe *stripe)
}
int
-check_dir(Stripe *stripe)
+check_dir(StripeSM *stripe)
{
int i, s;
Dbg(dbg_ctl_cache_check_dir, "inside check dir");
@@ -301,7 +301,7 @@ check_dir(Stripe *stripe)
}
inline void
-unlink_from_freelist(Dir *e, int s, Stripe *stripe)
+unlink_from_freelist(Dir *e, int s, StripeSM *stripe)
{
Dir *seg = stripe->dir_segment(s);
Dir *p = dir_from_offset(dir_prev(e), seg);
@@ -317,7 +317,7 @@ unlink_from_freelist(Dir *e, int s, Stripe *stripe)
}
inline Dir *
-dir_delete_entry(Dir *e, Dir *p, int s, Stripe *stripe)
+dir_delete_entry(Dir *e, Dir *p, int s, StripeSM *stripe)
{
Dir *seg = stripe->dir_segment(s);
int no = dir_next(e);
@@ -347,7 +347,7 @@ dir_delete_entry(Dir *e, Dir *p, int s, Stripe *stripe)
}
inline void
-dir_clean_bucket(Dir *b, int s, Stripe *stripe)
+dir_clean_bucket(Dir *b, int s, StripeSM *stripe)
{
Dir *e = b, *p = nullptr;
Dir *seg = stripe->dir_segment(s);
@@ -380,7 +380,7 @@ dir_clean_bucket(Dir *b, int s, Stripe *stripe)
}
void
-dir_clean_segment(int s, Stripe *stripe)
+dir_clean_segment(int s, StripeSM *stripe)
{
Dir *seg = stripe->dir_segment(s);
for (int64_t i = 0; i < stripe->buckets; i++) {
@@ -390,7 +390,7 @@ dir_clean_segment(int s, Stripe *stripe)
}
void
-dir_clean_vol(Stripe *stripe)
+dir_clean_vol(StripeSM *stripe)
{
for (int64_t i = 0; i < stripe->segments; i++) {
dir_clean_segment(i, stripe);
@@ -399,7 +399,7 @@ dir_clean_vol(Stripe *stripe)
}
void
-dir_clear_range(off_t start, off_t end, Stripe *stripe)
+dir_clear_range(off_t start, off_t end, StripeSM *stripe)
{
for (off_t i = 0; i < stripe->buckets * DIR_DEPTH * stripe->segments; i++) {
Dir *e = dir_index(stripe, i);
@@ -426,7 +426,7 @@ check_bucket_not_contains(Dir *b, Dir *e, Dir *seg)
}
void
-freelist_clean(int s, Stripe *stripe)
+freelist_clean(int s, StripeSM *stripe)
{
dir_clean_segment(s, stripe);
if (stripe->header->freelist[s]) {
@@ -450,7 +450,7 @@ freelist_clean(int s, Stripe *stripe)
}
inline Dir *
-freelist_pop(int s, Stripe *stripe)
+freelist_pop(int s, StripeSM *stripe)
{
Dir *seg = stripe->dir_segment(s);
Dir *e = dir_from_offset(stripe->header->freelist[s], seg);
@@ -472,7 +472,7 @@ freelist_pop(int s, Stripe *stripe)
}
int
-dir_segment_accounted(int s, Stripe *stripe, int offby, int *f, int *u, int
*et, int *v, int *av, int *as)
+dir_segment_accounted(int s, StripeSM *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;
@@ -525,7 +525,7 @@ dir_segment_accounted(int s, Stripe *stripe, int offby, int
*f, int *u, int *et,
}
void
-dir_free_entry(Dir *e, int s, Stripe *stripe)
+dir_free_entry(Dir *e, int s, StripeSM *stripe)
{
Dir *seg = stripe->dir_segment(s);
unsigned int fo = stripe->header->freelist[s];
@@ -538,7 +538,7 @@ dir_free_entry(Dir *e, int s, Stripe *stripe)
}
int
-dir_probe(const CacheKey *key, Stripe *stripe, Dir *result, Dir
**last_collision)
+dir_probe(const CacheKey *key, StripeSM *stripe, Dir *result, Dir
**last_collision)
{
ink_assert(stripe->mutex->thread_holding == this_ethread());
int s = key->slice32(0) % stripe->segments;
@@ -607,7 +607,7 @@ Lagain:
}
int
-dir_insert(const CacheKey *key, Stripe *stripe, Dir *to_part)
+dir_insert(const CacheKey *key, StripeSM *stripe, Dir *to_part)
{
ink_assert(stripe->mutex->thread_holding == this_ethread());
int s = key->slice32(0) % stripe->segments, l;
@@ -675,7 +675,7 @@ Lfill:
}
int
-dir_overwrite(const CacheKey *key, Stripe *stripe, Dir *dir, Dir *overwrite,
bool must_overwrite)
+dir_overwrite(const CacheKey *key, StripeSM *stripe, Dir *dir, Dir *overwrite,
bool must_overwrite)
{
ink_assert(stripe->mutex->thread_holding == this_ethread());
int s = key->slice32(0) % stripe->segments, l;
@@ -762,7 +762,7 @@ Lfill:
}
int
-dir_delete(const CacheKey *key, Stripe *stripe, Dir *del)
+dir_delete(const CacheKey *key, StripeSM *stripe, Dir *del)
{
ink_assert(stripe->mutex->thread_holding == this_ethread());
int s = key->slice32(0) % stripe->segments;
@@ -802,7 +802,7 @@ dir_delete(const CacheKey *key, Stripe *stripe, Dir *del)
// Lookaside Cache
int
-dir_lookaside_probe(const CacheKey *key, Stripe *stripe, Dir *result,
EvacuationBlock **eblock)
+dir_lookaside_probe(const CacheKey *key, StripeSM *stripe, Dir *result,
EvacuationBlock **eblock)
{
ink_assert(stripe->mutex->thread_holding == this_ethread());
int i = key->slice32(3) % LOOKASIDE_SIZE;
@@ -825,7 +825,7 @@ dir_lookaside_probe(const CacheKey *key, Stripe *stripe,
Dir *result, Evacuation
}
int
-dir_lookaside_insert(EvacuationBlock *eblock, Stripe *stripe, Dir *to)
+dir_lookaside_insert(EvacuationBlock *eblock, StripeSM *stripe, Dir *to)
{
CacheKey *key = &eblock->evac_frags.earliest_key;
DDbg(dbg_ctl_dir_lookaside, "insert %X %X, offset %d phase %d",
key->slice32(0), key->slice32(1), (int)dir_offset(to),
@@ -844,7 +844,7 @@ dir_lookaside_insert(EvacuationBlock *eblock, Stripe
*stripe, Dir *to)
}
int
-dir_lookaside_fixup(const CacheKey *key, Stripe *stripe)
+dir_lookaside_fixup(const CacheKey *key, StripeSM *stripe)
{
ink_assert(stripe->mutex->thread_holding == this_ethread());
int i = key->slice32(3) % LOOKASIDE_SIZE;
@@ -867,7 +867,7 @@ dir_lookaside_fixup(const CacheKey *key, Stripe *stripe)
}
void
-dir_lookaside_cleanup(Stripe *stripe)
+dir_lookaside_cleanup(StripeSM *stripe)
{
ink_assert(stripe->mutex->thread_holding == this_ethread());
for (auto &i : stripe->lookaside) {
@@ -890,7 +890,7 @@ dir_lookaside_cleanup(Stripe *stripe)
}
void
-dir_lookaside_remove(const CacheKey *key, Stripe *stripe)
+dir_lookaside_remove(const CacheKey *key, StripeSM *stripe)
{
ink_assert(stripe->mutex->thread_holding == this_ethread());
int i = key->slice32(3) % LOOKASIDE_SIZE;
@@ -932,7 +932,7 @@ CacheSync::aio_write(int fd, char *b, int n, off_t o)
}
uint64_t
-dir_entries_used(Stripe *stripe)
+dir_entries_used(StripeSM *stripe)
{
uint64_t full = 0;
uint64_t sfull = 0;
@@ -1006,7 +1006,7 @@ Lrestart:
return EVENT_CONT;
}
- Stripe *stripe = gstripes[stripe_index]; // must be named "vol" to make STAT
macros work.
+ StripeSM *stripe = gstripes[stripe_index]; // must be named "vol" to make
STAT macros work.
if (event == AIO_EVENT_DONE) {
// AIO Thread
diff --git a/src/iocore/cache/CacheHosting.cc b/src/iocore/cache/CacheHosting.cc
index 8aa673fd60..97a1df6eb2 100644
--- a/src/iocore/cache/CacheHosting.cc
+++ b/src/iocore/cache/CacheHosting.cc
@@ -441,7 +441,7 @@ CacheHostRecord::Init(CacheType typ)
Warning("error: No volumes found for Cache Type %d", type);
return -1;
}
- stripes = static_cast<Stripe **>(ats_malloc(num_vols * sizeof(Stripe
*)));
+ stripes = static_cast<StripeSM **>(ats_malloc(num_vols * sizeof(StripeSM
*)));
int counter = 0;
for (i = 0; i < num_cachevols; i++) {
CacheVol *cachep1 = cp[i];
@@ -563,7 +563,7 @@ CacheHostRecord::Init(matcher_line *line_info, CacheType
typ)
if (!num_vols) {
return -1;
}
- stripes = static_cast<Stripe **>(ats_malloc(num_vols * sizeof(Stripe
*)));
+ stripes = static_cast<StripeSM **>(ats_malloc(num_vols * sizeof(StripeSM
*)));
int counter = 0;
for (i = 0; i < num_cachevols; i++) {
CacheVol *cachep = cp[i];
diff --git a/src/iocore/cache/CacheRead.cc b/src/iocore/cache/CacheRead.cc
index 7297971138..e71b4ff6b2 100644
--- a/src/iocore/cache/CacheRead.cc
+++ b/src/iocore/cache/CacheRead.cc
@@ -48,7 +48,7 @@ Cache::open_read(Continuation *cont, const CacheKey *key,
CacheFragType type, co
}
ink_assert(caches[type] == this);
- Stripe *stripe = key_to_stripe(key, hostname, host_len);
+ StripeSM *stripe = key_to_stripe(key, hostname, host_len);
Dir result, *last_collision = nullptr;
ProxyMutex *mutex = cont->mutex.get();
OpenDirEntry *od = nullptr;
@@ -116,7 +116,7 @@ Cache::open_read(Continuation *cont, const CacheKey *key,
CacheHTTPHdr *request,
}
ink_assert(caches[type] == this);
- Stripe *stripe = key_to_stripe(key, hostname, host_len);
+ StripeSM *stripe = key_to_stripe(key, hostname, host_len);
Dir result, *last_collision = nullptr;
ProxyMutex *mutex = cont->mutex.get();
OpenDirEntry *od = nullptr;
diff --git a/src/iocore/cache/CacheTest.cc b/src/iocore/cache/CacheTest.cc
index 072a27834b..0461991268 100644
--- a/src/iocore/cache/CacheTest.cc
+++ b/src/iocore/cache/CacheTest.cc
@@ -432,10 +432,10 @@
REGRESSION_TEST(cache_disk_replacement_stability)(RegressionTest *t, int level,
static uint64_t DEFAULT_STRIPE_SIZE = 1024ULL * 1024 * 1024 * 911; // 911G
CacheDisk disk; // Only
need one because it's just checked for failure.
CacheHostRecord hr1, hr2;
- Stripe *sample;
+ StripeSM *sample;
static int const sample_idx = 16;
- Stripe stripes[MAX_VOLS];
- Stripe *stripe_ptrs[MAX_VOLS]; // array of pointers.
+ StripeSM stripes[MAX_VOLS];
+ StripeSM *stripe_ptrs[MAX_VOLS]; // array of pointers.
char buff[2048];
// Only run at the highest levels.
@@ -550,7 +550,7 @@ test_RamCache(RegressionTest *t, RamCache *cache, const
char *name, int64_t cach
{
bool pass = true;
CacheKey key;
- Stripe *stripe = theCache->key_to_stripe(&key,
"example.com", sizeof("example.com") - 1);
+ StripeSM *stripe = theCache->key_to_stripe(&key,
"example.com", sizeof("example.com") - 1);
std::vector<Ptr<IOBufferData>> data;
cache->init(cache_size, stripe);
diff --git a/src/iocore/cache/CacheVC.cc b/src/iocore/cache/CacheVC.cc
index 12d3db4e03..b0fde6ef5c 100644
--- a/src/iocore/cache/CacheVC.cc
+++ b/src/iocore/cache/CacheVC.cc
@@ -97,7 +97,7 @@ extern int64_t cache_config_ram_cache_cutoff;
* vol_map - precalculated map
* offset - offset to start looking at (and data at this location has not been
read yet). */
static off_t
-next_in_map(Stripe *stripe, char *vol_map, off_t offset)
+next_in_map(StripeSM *stripe, char *vol_map, off_t offset)
{
off_t start_offset = stripe->vol_offset_to_offset(0);
off_t new_off = (offset - start_offset);
@@ -113,16 +113,16 @@ next_in_map(Stripe *stripe, char *vol_map, off_t offset)
}
// Function in CacheDir.cc that we need for make_vol_map().
-int dir_bucket_loop_fix(Dir *start_dir, int s, Stripe *stripe);
+int dir_bucket_loop_fix(Dir *start_dir, int s, StripeSM *stripe);
// TODO: If we used a bit vector, we could make a smaller map structure.
// TODO: If we saved a high water mark we could have a smaller buf, and avoid
searching it
// when we are asked about the highest interesting offset.
/* Make map of what blocks in partition are used.
*
- * d - Stripe to make a map of. */
+ * d - StripeSM to make a map of. */
static char *
-make_vol_map(Stripe *stripe)
+make_vol_map(StripeSM *stripe)
{
// Map will be one byte for each SCAN_BUF_SIZE bytes.
off_t start_offset = stripe->vol_offset_to_offset(0);
diff --git a/src/iocore/cache/CacheWrite.cc b/src/iocore/cache/CacheWrite.cc
index f947bacbfd..a965a2e786 100644
--- a/src/iocore/cache/CacheWrite.cc
+++ b/src/iocore/cache/CacheWrite.cc
@@ -274,7 +274,7 @@ CacheVC::handleWrite(int event, Event * /* e ATS_UNUSED */)
}
EvacuationBlock *
-Stripe::force_evacuate_head(Dir const *evac_dir, int pinned)
+StripeSM::force_evacuate_head(Dir const *evac_dir, int pinned)
{
auto bucket = dir_evac_bucket(evac_dir);
if (!evac_bucket_valid(bucket)) {
@@ -305,7 +305,7 @@ Stripe::force_evacuate_head(Dir const *evac_dir, int pinned)
}
void
-Stripe::scan_for_pinned_documents()
+StripeSM::scan_for_pinned_documents()
{
if (cache_config_permit_pinning) {
// we can't evacuate anything between header->write_pos and
@@ -341,7 +341,7 @@ Stripe::scan_for_pinned_documents()
eventProcessor.schedule_xxx().
*/
int
-Stripe::aggWriteDone(int event, Event *e)
+StripeSM::aggWriteDone(int event, Event *e)
{
cancel_trigger();
@@ -403,7 +403,7 @@ Stripe::aggWriteDone(int event, Event *e)
}
CacheEvacuateDocVC *
-new_DocEvacuator(int nbytes, Stripe *stripe)
+new_DocEvacuator(int nbytes, StripeSM *stripe)
{
CacheEvacuateDocVC *c = new_CacheEvacuateDocVC(stripe);
c->op_type = static_cast<int>(CacheOpType::Evacuate);
@@ -418,7 +418,7 @@ new_DocEvacuator(int nbytes, Stripe *stripe)
}
static int
-evacuate_fragments(CacheKey *key, CacheKey *earliest_key, int force, Stripe
*stripe)
+evacuate_fragments(CacheKey *key, CacheKey *earliest_key, int force, StripeSM
*stripe)
{
Dir dir, *last_collision = nullptr;
int i = 0;
@@ -455,7 +455,7 @@ evacuate_fragments(CacheKey *key, CacheKey *earliest_key,
int force, Stripe *str
}
int
-Stripe::evacuateWrite(CacheEvacuateDocVC *evacuator, int event, Event *e)
+StripeSM::evacuateWrite(CacheEvacuateDocVC *evacuator, int event, Event *e)
{
// push to front of aggregation write list, so it is written first
@@ -473,7 +473,7 @@ Stripe::evacuateWrite(CacheEvacuateDocVC *evacuator, int
event, Event *e)
}
int
-Stripe::evacuateDocReadDone(int event, Event *e)
+StripeSM::evacuateDocReadDone(int event, Event *e)
{
cancel_trigger();
if (event != AIO_EVENT_DONE) {
@@ -567,7 +567,7 @@ Ldone:
}
int
-Stripe::evac_range(off_t low, off_t high, int evac_phase)
+StripeSM::evac_range(off_t low, off_t high, int evac_phase)
{
off_t s = this->offset_to_vol_offset(low);
off_t e = this->offset_to_vol_offset(high);
@@ -603,7 +603,7 @@ Stripe::evac_range(off_t low, off_t high, int evac_phase)
io.action = this;
io.thread = AIO_CALLBACK_THREAD_ANY;
DDbg(dbg_ctl_cache_evac, "evac_range evacuating %X %d",
(int)dir_tag(&first->dir), (int)dir_offset(&first->dir));
- SET_HANDLER(&Stripe::evacuateDocReadDone);
+ SET_HANDLER(&StripeSM::evacuateDocReadDone);
ink_assert(ink_aio_read(&io) >= 0);
return -1;
}
@@ -612,7 +612,7 @@ Stripe::evac_range(off_t low, off_t high, int evac_phase)
}
int
-Stripe::_agg_copy(CacheVC *vc)
+StripeSM::_agg_copy(CacheVC *vc)
{
if (vc->f.evacuator) {
return this->_copy_evacuator_to_aggregation(vc);
@@ -622,7 +622,7 @@ Stripe::_agg_copy(CacheVC *vc)
}
inline void
-Stripe::evacuate_cleanup_blocks(int i)
+StripeSM::evacuate_cleanup_blocks(int i)
{
EvacuationBlock *b = evac_bucket_valid(i) ? evacuate[i].head : nullptr;
while (b) {
@@ -640,7 +640,7 @@ Stripe::evacuate_cleanup_blocks(int i)
}
void
-Stripe::evacuate_cleanup()
+StripeSM::evacuate_cleanup()
{
int64_t eo = ((header->write_pos - start) / CACHE_BLOCK_SIZE) + 1;
int64_t e = dir_offset_evac_bucket(eo);
@@ -671,7 +671,7 @@ Stripe::evacuate_cleanup()
}
void
-Stripe::periodic_scan()
+StripeSM::periodic_scan()
{
evacuate_cleanup();
scan_for_pinned_documents();
@@ -682,7 +682,7 @@ Stripe::periodic_scan()
}
void
-Stripe::agg_wrap()
+StripeSM::agg_wrap()
{
header->write_pos = start;
header->phase = !header->phase;
@@ -692,7 +692,7 @@ Stripe::agg_wrap()
dir_lookaside_cleanup(this);
dir_clean_vol(this);
{
- Stripe *stripe = this;
+ StripeSM *stripe = this;
Metrics::Counter::increment(cache_rsb.directory_wrap);
Metrics::Counter::increment(stripe->cache_vol->vol_rsb.directory_wrap);
Note("Cache volume %d on disk '%s' wraps around",
stripe->cache_vol->vol_number, stripe->hash_text.get());
@@ -708,7 +708,7 @@ Stripe::agg_wrap()
the eventProcessor to schedule events
*/
int
-Stripe::aggWrite(int event, void * /* e ATS_UNUSED */)
+StripeSM::aggWrite(int event, void * /* e ATS_UNUSED */)
{
ink_assert(!is_io_in_progress());
@@ -788,7 +788,7 @@ Lagain:
for reads proceed independently.
*/
io.thread = AIO_CALLBACK_THREAD_AIO;
- SET_HANDLER(&Stripe::aggWriteDone);
+ SET_HANDLER(&StripeSM::aggWriteDone);
ink_aio_write(&io);
Lwait:
@@ -804,7 +804,7 @@ Lwait:
}
void
-Stripe::aggregate_pending_writes(Queue<CacheVC, Continuation::Link_link>
&tocall)
+StripeSM::aggregate_pending_writes(Queue<CacheVC, Continuation::Link_link>
&tocall)
{
for (auto *c = static_cast<CacheVC
*>(this->_write_buffer.get_pending_writers().head); c;) {
int writelen = c->agg_len;
@@ -1384,10 +1384,10 @@ Cache::open_write(Continuation *cont, const CacheKey
*key, CacheFragType frag_ty
intptr_t res = 0;
CacheVC *c = new_CacheVC(cont);
SCOPED_MUTEX_LOCK(lock, c->mutex, this_ethread());
- c->vio.op = VIO::WRITE;
- c->op_type = static_cast<int>(CacheOpType::Write);
- c->stripe = key_to_stripe(key, hostname, host_len);
- Stripe *stripe = c->stripe;
+ c->vio.op = VIO::WRITE;
+ c->op_type = static_cast<int>(CacheOpType::Write);
+ c->stripe = key_to_stripe(key, hostname, host_len);
+ StripeSM *stripe = c->stripe;
Metrics::Gauge::increment(cache_rsb.status[c->op_type].active);
Metrics::Gauge::increment(stripe->cache_vol->vol_rsb.status[c->op_type].active);
c->first_key = c->key = *key;
@@ -1463,11 +1463,11 @@ Cache::open_write(Continuation *cont, const CacheKey
*key, CacheHTTPInfo *info,
do {
rand_CacheKey(&c->key);
} while (DIR_MASK_TAG(c->key.slice32(2)) ==
DIR_MASK_TAG(c->first_key.slice32(2)));
- c->earliest_key = c->key;
- c->frag_type = CACHE_FRAG_TYPE_HTTP;
- c->stripe = key_to_stripe(key, hostname, host_len);
- Stripe *stripe = c->stripe;
- c->info = info;
+ c->earliest_key = c->key;
+ c->frag_type = CACHE_FRAG_TYPE_HTTP;
+ c->stripe = key_to_stripe(key, hostname, host_len);
+ StripeSM *stripe = c->stripe;
+ c->info = info;
if (c->info && (uintptr_t)info != CACHE_ALLOW_MULTIPLE_WRITES) {
/*
Update has the following code paths :
diff --git a/src/iocore/cache/P_CacheDir.h b/src/iocore/cache/P_CacheDir.h
index e9473984e8..d1056f8c33 100644
--- a/src/iocore/cache/P_CacheDir.h
+++ b/src/iocore/cache/P_CacheDir.h
@@ -33,7 +33,7 @@
// aio
#include "iocore/aio/AIO.h"
-class Stripe;
+class StripeSM;
struct InterimCacheVol;
struct CacheVC;
class CacheEvacuateDocVC;
@@ -205,7 +205,7 @@ struct Dir {
// INKqa11166 - Cache can not store 2 HTTP alternates simultaneously.
// To allow this, move the vector from the CacheVC to the OpenDirEntry.
// Each CacheVC now maintains a pointer to this vector. Adding/Deleting
-// alternates from this vector is done under the Stripe::lock. The alternate
+// alternates from this vector is done under the StripeSM::lock. The alternate
// is deleted/inserted into the vector just before writing the vector disk
// (CacheVC::updateVector).
LINK_FORWARD_DECLARATION(CacheVC, opendir_link) // forward declaration
@@ -266,29 +266,29 @@ struct CacheSync : public Continuation {
// Global Functions
-int dir_probe(const CacheKey *, Stripe *, Dir *, Dir **);
-int dir_insert(const CacheKey *key, Stripe *stripe, Dir *to_part);
-int dir_overwrite(const CacheKey *key, Stripe *stripe, Dir *to_part, Dir
*overwrite, bool must_overwrite = true);
-int dir_delete(const CacheKey *key, Stripe *stripe, Dir *del);
-int dir_lookaside_probe(const CacheKey *key, Stripe *stripe, Dir *result,
EvacuationBlock **eblock);
-int dir_lookaside_insert(EvacuationBlock *b, Stripe *stripe, Dir *to);
-int dir_lookaside_fixup(const CacheKey *key, Stripe *stripe);
-void dir_lookaside_cleanup(Stripe *stripe);
-void dir_lookaside_remove(const CacheKey *key, Stripe *stripe);
-void dir_free_entry(Dir *e, int s, Stripe *stripe);
-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);
+int dir_probe(const CacheKey *, StripeSM *, Dir *, Dir **);
+int dir_insert(const CacheKey *key, StripeSM *stripe, Dir *to_part);
+int dir_overwrite(const CacheKey *key, StripeSM *stripe, Dir *to_part, Dir
*overwrite, bool must_overwrite = true);
+int dir_delete(const CacheKey *key, StripeSM *stripe, Dir *del);
+int dir_lookaside_probe(const CacheKey *key, StripeSM *stripe, Dir *result,
EvacuationBlock **eblock);
+int dir_lookaside_insert(EvacuationBlock *b, StripeSM *stripe, Dir *to);
+int dir_lookaside_fixup(const CacheKey *key, StripeSM *stripe);
+void dir_lookaside_cleanup(StripeSM *stripe);
+void dir_lookaside_remove(const CacheKey *key, StripeSM *stripe);
+void dir_free_entry(Dir *e, int s, StripeSM *stripe);
+void dir_sync_init();
+int check_dir(StripeSM *stripe);
+void dir_clean_vol(StripeSM *stripe);
+void dir_clear_range(off_t start, off_t end, StripeSM *stripe);
+int dir_segment_accounted(int s, StripeSM *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(StripeSM *stripe);
void sync_cache_dir_on_shutdown();
-int dir_freelist_length(Stripe *stripe, int s);
+int dir_freelist_length(StripeSM *stripe, int s);
-int dir_bucket_length(Dir *b, int s, Stripe *stripe);
-int dir_freelist_length(Stripe *stripe, int s);
-void dir_clean_segment(int s, Stripe *stripe);
+int dir_bucket_length(Dir *b, int s, StripeSM *stripe);
+int dir_freelist_length(StripeSM *stripe, int s);
+void dir_clean_segment(int s, StripeSM *stripe);
// Inline Functions
diff --git a/src/iocore/cache/P_CacheDisk.h b/src/iocore/cache/P_CacheDisk.h
index f3bcea37e4..047926e880 100644
--- a/src/iocore/cache/P_CacheDisk.h
+++ b/src/iocore/cache/P_CacheDisk.h
@@ -36,7 +36,7 @@ extern int cache_config_max_disk_errors;
#define DISK_HEADER_MAGIC 0xABCD1237
-/* each disk vol block has a corresponding Stripe object */
+/* each disk vol block has a corresponding StripeSM object */
struct CacheDisk;
struct DiskStripeBlock {
diff --git a/src/iocore/cache/P_CacheHosting.h
b/src/iocore/cache/P_CacheHosting.h
index 358ae6b05f..99a81de2b7 100644
--- a/src/iocore/cache/P_CacheHosting.h
+++ b/src/iocore/cache/P_CacheHosting.h
@@ -30,7 +30,7 @@
#define CACHE_MEM_FREE_TIMEOUT HRTIME_SECONDS(1)
-class Stripe;
+class StripeSM;
struct CacheVol;
struct CacheHostResult;
@@ -51,7 +51,7 @@ struct CacheHostRecord {
}
CacheType type = CACHE_NONE_TYPE;
- Stripe **stripes = nullptr;
+ StripeSM **stripes = nullptr;
int num_vols = 0;
unsigned short *vol_hash_table = nullptr;
CacheVol **cp = nullptr;
diff --git a/src/iocore/cache/P_CacheInternal.h
b/src/iocore/cache/P_CacheInternal.h
index 24585f2642..fa78d1009d 100644
--- a/src/iocore/cache/P_CacheInternal.h
+++ b/src/iocore/cache/P_CacheInternal.h
@@ -149,7 +149,7 @@ extern CacheSync *cacheDirSync;
// Function Prototypes
int cache_write(CacheVC *, CacheHTTPInfoVector *);
int get_alternate_index(CacheHTTPInfoVector *cache_vector,
CacheKey key);
-CacheEvacuateDocVC *new_DocEvacuator(int nbytes, Stripe *stripe);
+CacheEvacuateDocVC *new_DocEvacuator(int nbytes, StripeSM *stripe);
// inline Functions
@@ -176,7 +176,7 @@ free_CacheVCCommon(CacheVC *cont)
static DbgCtl dbg_ctl{"cache_free"};
Dbg(dbg_ctl, "free %p", cont);
ProxyMutex *mutex = cont->mutex.get();
- Stripe *stripe = cont->stripe;
+ StripeSM *stripe = cont->stripe;
if (stripe) {
Metrics::Gauge::decrement(cache_rsb.status[cont->op_type].active);
@@ -377,17 +377,17 @@ CacheVC::writer_done()
}
inline int
-Stripe::close_write(CacheVC *cont)
+StripeSM::close_write(CacheVC *cont)
{
return open_dir.close_write(cont);
}
// Returns 0 on success or a positive error code on failure
inline int
-Stripe::open_write(CacheVC *cont, int allow_if_writers, int max_writers)
+StripeSM::open_write(CacheVC *cont, int allow_if_writers, int max_writers)
{
- Stripe *stripe = this;
- bool agg_error = false;
+ StripeSM *stripe = this;
+ bool agg_error = false;
if (!cont->f.remove) {
agg_error = (!cont->f.update &&
this->_write_buffer.get_bytes_pending_aggregation() >
cache_config_agg_write_backlog);
#ifdef CACHE_AGG_FAIL_RATE
@@ -409,7 +409,7 @@ Stripe::open_write(CacheVC *cont, int allow_if_writers, int
max_writers)
}
inline int
-Stripe::close_write_lock(CacheVC *cont)
+StripeSM::close_write_lock(CacheVC *cont)
{
EThread *t = cont->mutex->thread_holding;
CACHE_TRY_LOCK(lock, mutex, t);
@@ -420,7 +420,7 @@ Stripe::close_write_lock(CacheVC *cont)
}
inline int
-Stripe::open_write_lock(CacheVC *cont, int allow_if_writers, int max_writers)
+StripeSM::open_write_lock(CacheVC *cont, int allow_if_writers, int max_writers)
{
EThread *t = cont->mutex->thread_holding;
CACHE_TRY_LOCK(lock, mutex, t);
@@ -431,7 +431,7 @@ Stripe::open_write_lock(CacheVC *cont, int
allow_if_writers, int max_writers)
}
inline OpenDirEntry *
-Stripe::open_read_lock(CryptoHash *key, EThread *t)
+StripeSM::open_read_lock(CryptoHash *key, EThread *t)
{
CACHE_TRY_LOCK(lock, mutex, t);
if (!lock.is_locked()) {
@@ -441,7 +441,7 @@ Stripe::open_read_lock(CryptoHash *key, EThread *t)
}
inline int
-Stripe::begin_read_lock(CacheVC *cont)
+StripeSM::begin_read_lock(CacheVC *cont)
{
// no need for evacuation as the entire document is already in memory
if (cont->f.single_fragment) {
@@ -457,7 +457,7 @@ Stripe::begin_read_lock(CacheVC *cont)
}
inline int
-Stripe::close_read_lock(CacheVC *cont)
+StripeSM::close_read_lock(CacheVC *cont)
{
EThread *t = cont->mutex->thread_holding;
CACHE_TRY_LOCK(lock, mutex, t);
@@ -468,7 +468,7 @@ Stripe::close_read_lock(CacheVC *cont)
}
inline int
-dir_delete_lock(CacheKey *key, Stripe *stripe, ProxyMutex *m, Dir *del)
+dir_delete_lock(CacheKey *key, StripeSM *stripe, ProxyMutex *m, Dir *del)
{
EThread *thread = m->thread_holding;
CACHE_TRY_LOCK(lock, stripe->mutex, thread);
@@ -479,7 +479,7 @@ dir_delete_lock(CacheKey *key, Stripe *stripe, ProxyMutex
*m, Dir *del)
}
inline int
-dir_insert_lock(CacheKey *key, Stripe *stripe, Dir *to_part, ProxyMutex *m)
+dir_insert_lock(CacheKey *key, StripeSM *stripe, Dir *to_part, ProxyMutex *m)
{
EThread *thread = m->thread_holding;
CACHE_TRY_LOCK(lock, stripe->mutex, thread);
@@ -490,7 +490,7 @@ dir_insert_lock(CacheKey *key, Stripe *stripe, Dir
*to_part, ProxyMutex *m)
}
inline int
-dir_overwrite_lock(CacheKey *key, Stripe *stripe, Dir *to_part, ProxyMutex *m,
Dir *overwrite, bool must_overwrite = true)
+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);
@@ -563,7 +563,7 @@ CacheRemoveCont::event_handler(int event, void *data)
}
struct CacheHostRecord;
-class Stripe;
+class StripeSM;
class CacheHostTable;
struct Cache {
@@ -600,7 +600,7 @@ struct Cache {
int open_done();
- Stripe *key_to_stripe(const CacheKey *key, const char *hostname, int
host_len);
+ StripeSM *key_to_stripe(const CacheKey *key, const char *hostname, int
host_len);
Cache() {}
};
diff --git a/src/iocore/cache/P_CacheVol.h b/src/iocore/cache/P_CacheVol.h
index 2f1e8377a8..02dd78d07b 100644
--- a/src/iocore/cache/P_CacheVol.h
+++ b/src/iocore/cache/P_CacheVol.h
@@ -73,7 +73,7 @@
// Documents
struct Cache;
-class Stripe;
+class StripeSM;
struct CacheDisk;
struct StripeInitInfo;
struct DiskStripe;
@@ -125,7 +125,7 @@ struct EvacuationBlock {
LINK(EvacuationBlock, link);
};
-class Stripe : public Continuation
+class StripeSM : public Continuation
{
public:
char *path = nullptr;
@@ -269,10 +269,10 @@ public:
off_t vol_offset_to_offset(off_t pos) const;
off_t vol_relative_length(off_t start_offset) const;
- Stripe() : Continuation(new_ProxyMutex())
+ StripeSM() : Continuation(new_ProxyMutex())
{
open_dir.mutex = mutex;
- SET_HANDLER(&Stripe::aggWrite);
+ SET_HANDLER(&StripeSM::aggWrite);
}
Queue<CacheVC, Continuation::Link_link> &get_pending_writers();
@@ -349,7 +349,7 @@ struct CacheVol {
off_t size = 0;
int num_vols = 0;
bool ramcache_enabled = true;
- Stripe **stripes = nullptr;
+ StripeSM **stripes = nullptr;
DiskStripe **disk_stripes = nullptr;
LINK(CacheVol, link);
// per volume stats
@@ -360,7 +360,7 @@ struct CacheVol {
// Global Data
-extern Stripe **gstripes;
+extern StripeSM **gstripes;
extern std::atomic<int> gnstripes;
extern ClassAllocator<OpenDirEntry> openDirEntryAllocator;
extern ClassAllocator<EvacuationBlock> evacuationBlockAllocator;
@@ -370,74 +370,74 @@ extern unsigned short *vol_hash_table;
// inline Functions
inline int
-Stripe::headerlen() const
+StripeSM::headerlen() const
{
return ROUND_TO_STORE_BLOCK(sizeof(StripteHeaderFooter) + sizeof(uint16_t) *
(this->segments - 1));
}
inline Dir *
-Stripe::dir_segment(int s) const
+StripeSM::dir_segment(int s) const
{
return (Dir *)(((char *)this->dir) + (s * this->buckets) * DIR_DEPTH *
SIZEOF_DIR);
}
inline size_t
-Stripe::dirlen() const
+StripeSM::dirlen() const
{
return this->headerlen() + ROUND_TO_STORE_BLOCK(((size_t)this->buckets) *
DIR_DEPTH * this->segments * SIZEOF_DIR) +
ROUND_TO_STORE_BLOCK(sizeof(StripteHeaderFooter));
}
inline int
-Stripe::direntries() const
+StripeSM::direntries() const
{
return this->buckets * DIR_DEPTH * this->segments;
}
inline int
-Stripe::vol_out_of_phase_valid(Dir const *e) const
+StripeSM::vol_out_of_phase_valid(Dir const *e) const
{
return (dir_offset(e) - 1 >= ((this->header->agg_pos - this->start) /
CACHE_BLOCK_SIZE));
}
inline int
-Stripe::vol_out_of_phase_agg_valid(Dir const *e) const
+StripeSM::vol_out_of_phase_agg_valid(Dir const *e) const
{
return (dir_offset(e) - 1 >= ((this->header->agg_pos - this->start +
AGG_SIZE) / CACHE_BLOCK_SIZE));
}
inline int
-Stripe::vol_out_of_phase_write_valid(Dir const *e) const
+StripeSM::vol_out_of_phase_write_valid(Dir const *e) const
{
return (dir_offset(e) - 1 >= ((this->header->write_pos - this->start) /
CACHE_BLOCK_SIZE));
}
inline int
-Stripe::vol_in_phase_valid(Dir const *e) const
+StripeSM::vol_in_phase_valid(Dir const *e) const
{
return (dir_offset(e) - 1 < ((this->header->write_pos +
this->_write_buffer.get_buffer_pos() - this->start) / CACHE_BLOCK_SIZE));
}
inline off_t
-Stripe::vol_offset(Dir const *e) const
+StripeSM::vol_offset(Dir const *e) const
{
return this->start + (off_t)dir_offset(e) * CACHE_BLOCK_SIZE -
CACHE_BLOCK_SIZE;
}
inline off_t
-Stripe::offset_to_vol_offset(off_t pos) const
+StripeSM::offset_to_vol_offset(off_t pos) const
{
return ((pos - this->start + CACHE_BLOCK_SIZE) / CACHE_BLOCK_SIZE);
}
inline off_t
-Stripe::vol_offset_to_offset(off_t pos) const
+StripeSM::vol_offset_to_offset(off_t pos) const
{
return this->start + pos * CACHE_BLOCK_SIZE - CACHE_BLOCK_SIZE;
}
inline int
-Stripe::vol_in_phase_agg_buf_valid(Dir const *e) const
+StripeSM::vol_in_phase_agg_buf_valid(Dir const *e) const
{
return (this->vol_offset(e) >= this->header->write_pos &&
this->vol_offset(e) < (this->header->write_pos +
this->_write_buffer.get_buffer_pos()));
@@ -445,7 +445,7 @@ Stripe::vol_in_phase_agg_buf_valid(Dir const *e) const
// length of the partition not including the offset of location 0.
inline off_t
-Stripe::vol_relative_length(off_t start_offset) const
+StripeSM::vol_relative_length(off_t start_offset) const
{
return (this->len + this->skip) - start_offset;
}
@@ -453,7 +453,7 @@ Stripe::vol_relative_length(off_t start_offset) const
// inline Functions
inline EvacuationBlock *
-evacuation_block_exists(Dir const *dir, Stripe *stripe)
+evacuation_block_exists(Dir const *dir, StripeSM *stripe)
{
auto bucket = dir_evac_bucket(dir);
if (stripe->evac_bucket_valid(bucket)) {
@@ -468,7 +468,7 @@ evacuation_block_exists(Dir const *dir, Stripe *stripe)
}
inline void
-Stripe::cancel_trigger()
+StripeSM::cancel_trigger()
{
if (trigger) {
trigger->cancel_action();
@@ -500,13 +500,13 @@ free_EvacuationBlock(EvacuationBlock *b, EThread *t)
}
inline OpenDirEntry *
-Stripe::open_read(const CryptoHash *key) const
+StripeSM::open_read(const CryptoHash *key) const
{
return open_dir.open_read(key);
}
inline int
-Stripe::within_hit_evacuate_window(Dir const *xdir) const
+StripeSM::within_hit_evacuate_window(Dir const *xdir) const
{
off_t oft = dir_offset(xdir) - 1;
off_t write_off = (header->write_pos + AGG_SIZE - start) / CACHE_BLOCK_SIZE;
@@ -518,38 +518,38 @@ Stripe::within_hit_evacuate_window(Dir const *xdir) const
}
inline uint32_t
-Stripe::round_to_approx_size(uint32_t l) const
+StripeSM::round_to_approx_size(uint32_t l) const
{
uint32_t ll = round_to_approx_dir_size(l);
return ROUND_TO_SECTOR(this, ll);
}
inline bool
-Stripe::evac_bucket_valid(off_t bucket) const
+StripeSM::evac_bucket_valid(off_t bucket) const
{
return (bucket >= 0 && bucket < evacuate_size);
}
inline int
-Stripe::is_io_in_progress() const
+StripeSM::is_io_in_progress() const
{
return io.aiocb.aio_fildes != AIO_NOT_IN_PROGRESS;
}
inline void
-Stripe::set_io_not_in_progress()
+StripeSM::set_io_not_in_progress()
{
io.aiocb.aio_fildes = AIO_NOT_IN_PROGRESS;
}
inline Queue<CacheVC, Continuation::Link_link> &
-Stripe::get_pending_writers()
+StripeSM::get_pending_writers()
{
return this->_write_buffer.get_pending_writers();
}
inline int
-Stripe::get_agg_buf_pos() const
+StripeSM::get_agg_buf_pos() const
{
return this->_write_buffer.get_buffer_pos();
}
diff --git a/src/iocore/cache/P_RamCache.h b/src/iocore/cache/P_RamCache.h
index e2cc8ed717..724e4fe240 100644
--- a/src/iocore/cache/P_RamCache.h
+++ b/src/iocore/cache/P_RamCache.h
@@ -36,7 +36,7 @@ public:
virtual int fixup(const CryptoHash *key, uint64_t old_auxkey, uint64_t
new_auxkey) = 0;
virtual int64_t size() const
= 0;
- virtual void init(int64_t max_bytes, Stripe *stripe) = 0;
+ virtual void init(int64_t max_bytes, StripeSM *stripe) = 0;
virtual ~RamCache(){};
};
diff --git a/src/iocore/cache/RamCacheCLFUS.cc
b/src/iocore/cache/RamCacheCLFUS.cc
index 8bf55d117e..cba3b863fd 100644
--- a/src/iocore/cache/RamCacheCLFUS.cc
+++ b/src/iocore/cache/RamCacheCLFUS.cc
@@ -90,12 +90,12 @@ public:
int fixup(const CryptoHash *key, uint64_t old_auxkey, uint64_t
new_auxkey) override;
int64_t size() const override;
- void init(int64_t max_bytes, Stripe *stripe) override;
+ void init(int64_t max_bytes, StripeSM *stripe) override;
void compress_entries(EThread *thread, int do_at_most = INT_MAX);
// TODO move it to private.
- Stripe *stripe = nullptr; // for stats
+ StripeSM *stripe = nullptr; // for stats
private:
int64_t _max_bytes = 0;
int64_t _bytes = 0;
@@ -203,7 +203,7 @@ RamCacheCLFUS::_resize_hashtable()
}
void
-RamCacheCLFUS::init(int64_t abytes, Stripe *astripe)
+RamCacheCLFUS::init(int64_t abytes, StripeSM *astripe)
{
ink_assert(astripe != nullptr);
stripe = astripe;
diff --git a/src/iocore/cache/RamCacheLRU.cc b/src/iocore/cache/RamCacheLRU.cc
index 7a2b9037dd..efe175d32a 100644
--- a/src/iocore/cache/RamCacheLRU.cc
+++ b/src/iocore/cache/RamCacheLRU.cc
@@ -46,15 +46,15 @@ struct RamCacheLRU : public RamCache {
int fixup(const CryptoHash *key, uint64_t old_auxkey, uint64_t
new_auxkey) override;
int64_t size() const override;
- void init(int64_t max_bytes, Stripe *stripe) override;
+ void init(int64_t max_bytes, StripeSM *stripe) override;
// private
std::vector<bool> *seen = nullptr;
Que(RamCacheLRUEntry, lru_link) lru;
DList(RamCacheLRUEntry, hash_link) *bucket = nullptr;
- int nbuckets = 0;
- int ibuckets = 0;
- Stripe *stripe = nullptr;
+ int nbuckets = 0;
+ int ibuckets = 0;
+ StripeSM *stripe = nullptr;
void resize_hashtable();
RamCacheLRUEntry *remove(RamCacheLRUEntry *e);
@@ -120,7 +120,7 @@ RamCacheLRU::resize_hashtable()
}
void
-RamCacheLRU::init(int64_t abytes, Stripe *astripe)
+RamCacheLRU::init(int64_t abytes, StripeSM *astripe)
{
stripe = astripe;
max_bytes = abytes;
diff --git a/src/iocore/cache/Stripe.cc b/src/iocore/cache/Stripe.cc
index 5c35c0d82a..2f37dfadd8 100644
--- a/src/iocore/cache/Stripe.cc
+++ b/src/iocore/cache/Stripe.cc
@@ -88,7 +88,7 @@ struct StripeInitInfo {
//
int
-Stripe::begin_read(CacheVC *cont) const
+StripeSM::begin_read(CacheVC *cont) const
{
ink_assert(cont->mutex->thread_holding == this_ethread());
ink_assert(mutex->thread_holding == this_ethread());
@@ -119,7 +119,7 @@ Stripe::begin_read(CacheVC *cont) const
}
int
-Stripe::close_read(CacheVC *cont) const
+StripeSM::close_read(CacheVC *cont) const
{
EThread *t = cont->mutex->thread_holding;
ink_assert(t == this_ethread());
@@ -150,12 +150,12 @@ Stripe::close_read(CacheVC *cont) const
Add AIO task to clear Dir.
*/
int
-Stripe::clear_dir_aio()
+StripeSM::clear_dir_aio()
{
size_t dir_len = this->dirlen();
this->_clear_init();
- SET_HANDLER(&Stripe::handle_dir_clear);
+ SET_HANDLER(&StripeSM::handle_dir_clear);
io.aiocb.aio_fildes = fd;
io.aiocb.aio_buf = raw_dir;
@@ -173,7 +173,7 @@ Stripe::clear_dir_aio()
Clear Dir directly. This is mainly used by unit tests. The clear_dir_aio()
is the suitable function in most cases.
*/
int
-Stripe::clear_dir()
+StripeSM::clear_dir()
{
size_t dir_len = this->dirlen();
this->_clear_init();
@@ -187,7 +187,7 @@ Stripe::clear_dir()
}
int
-Stripe::init(char *s, off_t blocks, off_t dir_skip, bool clear)
+StripeSM::init(char *s, off_t blocks, off_t dir_skip, bool clear)
{
char *seed_str = disk->hash_base_string ?
disk->hash_base_string : s;
const size_t hash_seed_size = strlen(seed_str);
@@ -244,7 +244,7 @@ Stripe::init(char *s, off_t blocks, off_t dir_skip, bool
clear)
off_t as = skip;
Dbg(dbg_ctl_cache_init, "reading directory '%s'", hash_text.get());
- SET_HANDLER(&Stripe::handle_header_read);
+ SET_HANDLER(&StripeSM::handle_header_read);
init_info->vol_aio[0].aiocb.aio_offset = as;
init_info->vol_aio[1].aiocb.aio_offset = as + footer_offset;
off_t bs = skip + this->dirlen();
@@ -265,7 +265,7 @@ Stripe::init(char *s, off_t blocks, off_t dir_skip, bool
clear)
}
int
-Stripe::handle_dir_clear(int event, void *data)
+StripeSM::handle_dir_clear(int event, void *data)
{
size_t dir_len = this->dirlen();
AIOCallback *op;
@@ -288,7 +288,7 @@ Stripe::handle_dir_clear(int event, void *data)
return EVENT_DONE;
}
set_io_not_in_progress();
- SET_HANDLER(&Stripe::dir_init_done);
+ SET_HANDLER(&StripeSM::dir_init_done);
dir_init_done(EVENT_IMMEDIATE, nullptr);
/* mark the volume as bad */
}
@@ -296,7 +296,7 @@ Stripe::handle_dir_clear(int event, void *data)
}
int
-Stripe::handle_dir_read(int event, void *data)
+StripeSM::handle_dir_read(int event, void *data)
{
AIOCallback *op = static_cast<AIOCallback *>(data);
@@ -327,9 +327,9 @@ Stripe::handle_dir_read(int event, void *data)
}
int
-Stripe::recover_data()
+StripeSM::recover_data()
{
- SET_HANDLER(&Stripe::handle_recover_from_data);
+ SET_HANDLER(&StripeSM::handle_recover_from_data);
return handle_recover_from_data(EVENT_IMMEDIATE, nullptr);
}
@@ -370,7 +370,7 @@ Stripe::recover_data()
*/
int
-Stripe::handle_recover_from_data(int event, void * /* data ATS_UNUSED */)
+StripeSM::handle_recover_from_data(int event, void * /* data ATS_UNUSED */)
{
uint32_t got_len = 0;
uint32_t max_sync_serial = header->sync_serial;
@@ -378,7 +378,7 @@ Stripe::handle_recover_from_data(int event, void * /* data
ATS_UNUSED */)
if (event == EVENT_IMMEDIATE) {
if (header->sync_serial == 0) {
io.aiocb.aio_buf = nullptr;
- SET_HANDLER(&Stripe::handle_recover_write_dir);
+ SET_HANDLER(&StripeSM::handle_recover_write_dir);
return handle_recover_write_dir(EVENT_IMMEDIATE, nullptr);
}
// initialize
@@ -556,7 +556,7 @@ Stripe::handle_recover_from_data(int event, void * /* data
ATS_UNUSED */)
Ldone: {
/* if we come back to the starting position, then we don't have to recover
anything */
if (recover_pos == header->write_pos && recover_wrapped) {
- SET_HANDLER(&Stripe::handle_recover_write_dir);
+ SET_HANDLER(&StripeSM::handle_recover_write_dir);
if (dbg_ctl_cache_init.on()) {
Note("recovery wrapped around. nothing to clear\n");
}
@@ -617,7 +617,7 @@ Ldone: {
init_info->vol_aio[2].aiocb.aio_nbytes = footerlen;
init_info->vol_aio[2].aiocb.aio_offset = ss + dirlen - footerlen;
- SET_HANDLER(&Stripe::handle_recover_write_dir);
+ SET_HANDLER(&StripeSM::handle_recover_write_dir);
ink_assert(ink_aio_write(init_info->vol_aio));
return EVENT_CONT;
}
@@ -631,7 +631,7 @@ Lclear:
}
int
-Stripe::handle_recover_write_dir(int /* event ATS_UNUSED */, void * /* data
ATS_UNUSED */)
+StripeSM::handle_recover_write_dir(int /* event ATS_UNUSED */, void * /* data
ATS_UNUSED */)
{
if (io.aiocb.aio_buf) {
free(static_cast<char *>(io.aiocb.aio_buf));
@@ -641,12 +641,12 @@ Stripe::handle_recover_write_dir(int /* event ATS_UNUSED
*/, void * /* data ATS_
set_io_not_in_progress();
scan_pos = header->write_pos;
periodic_scan();
- SET_HANDLER(&Stripe::dir_init_done);
+ SET_HANDLER(&StripeSM::dir_init_done);
return dir_init_done(EVENT_IMMEDIATE, nullptr);
}
int
-Stripe::handle_header_read(int event, void *data)
+StripeSM::handle_header_read(int event, void *data)
{
AIOCallback *op;
StripteHeaderFooter *hf[4];
@@ -673,7 +673,7 @@ Stripe::handle_header_read(int event, void *data)
if (hf[0]->sync_serial == hf[1]->sync_serial &&
(hf[0]->sync_serial >= hf[2]->sync_serial || hf[2]->sync_serial !=
hf[3]->sync_serial)) {
- SET_HANDLER(&Stripe::handle_dir_read);
+ SET_HANDLER(&StripeSM::handle_dir_read);
if (dbg_ctl_cache_init.on()) {
Note("using directory A for '%s'", hash_text.get());
}
@@ -682,7 +682,7 @@ Stripe::handle_header_read(int event, void *data)
}
// try B
else if (hf[2]->sync_serial == hf[3]->sync_serial) {
- SET_HANDLER(&Stripe::handle_dir_read);
+ SET_HANDLER(&StripeSM::handle_dir_read);
if (dbg_ctl_cache_init.on()) {
Note("using directory B for '%s'", hash_text.get());
}
@@ -704,7 +704,7 @@ Stripe::handle_header_read(int event, void *data)
}
int
-Stripe::dir_init_done(int /* event ATS_UNUSED */, void * /* data ATS_UNUSED */)
+StripeSM::dir_init_done(int /* event ATS_UNUSED */, void * /* data ATS_UNUSED
*/)
{
if (!cache->cache_read_done) {
eventProcessor.schedule_in(this, HRTIME_MSECONDS(5), ET_CALL);
@@ -713,14 +713,14 @@ Stripe::dir_init_done(int /* event ATS_UNUSED */, void *
/* data ATS_UNUSED */)
int i = gnstripes++;
ink_assert(!gstripes[i]);
gstripes[i] = this;
- SET_HANDLER(&Stripe::aggWrite);
+ SET_HANDLER(&StripeSM::aggWrite);
cache->vol_initialized(fd != -1);
return EVENT_DONE;
}
}
int
-Stripe::dir_check(bool /* fix ATS_UNUSED */) // TODO: we should eliminate this
parameter ?
+StripeSM::dir_check(bool /* fix ATS_UNUSED */) // TODO: we should eliminate
this parameter ?
{
static int const SEGMENT_HISTOGRAM_WIDTH = 16;
int hist[SEGMENT_HISTOGRAM_WIDTH + 1] = {0};
@@ -876,7 +876,7 @@ Stripe::dir_check(bool /* fix ATS_UNUSED */) // TODO: we
should eliminate this p
}
void
-Stripe::_clear_init()
+StripeSM::_clear_init()
{
size_t dir_len = this->dirlen();
memset(this->raw_dir, 0, dir_len);
@@ -895,7 +895,7 @@ Stripe::_clear_init()
}
void
-Stripe::_init_dir()
+StripeSM::_init_dir()
{
int b, s, l;
@@ -912,7 +912,7 @@ Stripe::_init_dir()
}
void
-Stripe::_init_data_internal()
+StripeSM::_init_data_internal()
{
// step1: calculate the number of entries.
off_t total_entries = (this->len - (this->start - this->skip)) /
cache_config_min_average_object_size;
@@ -927,7 +927,7 @@ Stripe::_init_data_internal()
}
void
-Stripe::_init_data()
+StripeSM::_init_data()
{
// iteratively calculate start + buckets
this->_init_data_internal();
@@ -936,7 +936,7 @@ Stripe::_init_data()
}
bool
-Stripe::add_writer(CacheVC *vc)
+StripeSM::add_writer(CacheVC *vc)
{
ink_assert(vc);
this->_write_buffer.add_bytes_pending_aggregation(vc->agg_len);
@@ -972,7 +972,7 @@ Stripe::add_writer(CacheVC *vc)
}
void
-Stripe::shutdown(EThread *shutdown_thread)
+StripeSM::shutdown(EThread *shutdown_thread)
{
// the process is going down, do a blocking call
// dont release the volume's lock, there could
@@ -1077,7 +1077,7 @@ update_document_key(CacheVC *vc, Doc *doc)
}
int
-Stripe::_copy_writer_to_aggregation(CacheVC *vc)
+StripeSM::_copy_writer_to_aggregation(CacheVC *vc)
{
off_t doc_offset{this->header->write_pos + this->get_agg_buf_pos()};
uint32_t len = vc->write_len + vc->header_len + vc->frag_len +
sizeof(Doc);
@@ -1149,7 +1149,7 @@ Stripe::_copy_writer_to_aggregation(CacheVC *vc)
}
int
-Stripe::_copy_evacuator_to_aggregation(CacheVC *vc)
+StripeSM::_copy_evacuator_to_aggregation(CacheVC *vc)
{
Doc *doc = reinterpret_cast<Doc *>(vc->buf->data());
int approx_size = this->round_to_approx_size(doc->len);
@@ -1170,7 +1170,7 @@ Stripe::_copy_evacuator_to_aggregation(CacheVC *vc)
}
bool
-Stripe::flush_aggregate_write_buffer()
+StripeSM::flush_aggregate_write_buffer()
{
// set write limit
this->header->agg_pos = this->header->write_pos +
this->_write_buffer.get_buffer_pos();
@@ -1188,7 +1188,7 @@ Stripe::flush_aggregate_write_buffer()
}
bool
-Stripe::copy_from_aggregate_write_buffer(char *dest, Dir const &dir, size_t
nbytes) const
+StripeSM::copy_from_aggregate_write_buffer(char *dest, Dir const &dir, size_t
nbytes) const
{
if (!dir_agg_buf_valid(this, &dir)) {
return false;
diff --git a/src/iocore/cache/unit_tests/test_CacheDir.cc
b/src/iocore/cache/unit_tests/test_CacheDir.cc
index e3d350df3f..1524f87ad7 100644
--- a/src/iocore/cache/unit_tests/test_CacheDir.cc
+++ b/src/iocore/cache/unit_tests/test_CacheDir.cc
@@ -54,7 +54,7 @@ regress_rand_CacheKey(const CacheKey *key)
}
void
-dir_corrupt_bucket(Dir *b, int s, Stripe *stripe)
+dir_corrupt_bucket(Dir *b, int s, StripeSM *stripe)
{
int l = (static_cast<int>(dir_bucket_length(b, s, stripe) *
ts::Random::drandom()));
Dir *e = b;
@@ -80,8 +80,8 @@ public:
REQUIRE(CacheProcessor::IsCacheEnabled() == CACHE_INITIALIZED);
REQUIRE(gnstripes >= 1);
- Stripe *stripe = gstripes[0];
- EThread *thread = this_ethread();
+ StripeSM *stripe = gstripes[0];
+ EThread *thread = this_ethread();
MUTEX_TRY_LOCK(lock, stripe->mutex, thread);
if (!lock.is_locked()) {
CONT_SCHED_LOCK_RETRY(this);
diff --git a/src/iocore/cache/unit_tests/test_Stripe.cc
b/src/iocore/cache/unit_tests/test_Stripe.cc
index fb07824d36..b7aeffd646 100644
--- a/src/iocore/cache/unit_tests/test_Stripe.cc
+++ b/src/iocore/cache/unit_tests/test_Stripe.cc
@@ -81,18 +81,18 @@ std::array<AddWriterBranchTest, 32>
add_writer_branch_test_cases = {
}
};
-/* Catch test helper to provide a Stripe with a valid file descriptor.
+/* Catch test helper to provide a StripeSM with a valid file descriptor.
*
* The file will be deleted automatically when the application ends normally.
- * If the Stripe already has a valid file descriptor, that file will NOT be
+ * If the StripeSM already has a valid file descriptor, that file will NOT be
* closed.
*
- * @param stripe: A Stripe object with no valid file descriptor.
+ * @param stripe: A StripeSM object with no valid file descriptor.
* @return The std::FILE* stream if successful, otherwise the Catch test will
* be failed at the point of error.
*/
static std::FILE *
-attach_tmpfile_to_stripe(Stripe &stripe)
+attach_tmpfile_to_stripe(StripeSM &stripe)
{
auto *file{std::tmpfile()};
REQUIRE(file != nullptr);
@@ -105,7 +105,7 @@ attach_tmpfile_to_stripe(Stripe &stripe)
// We can't return a stripe from this function because the copy
// and move constructors are deleted.
static std::FILE *
-init_stripe_for_writing(Stripe &stripe, StripteHeaderFooter &header, CacheVol
&cache_vol)
+init_stripe_for_writing(StripeSM &stripe, StripteHeaderFooter &header,
CacheVol &cache_vol)
{
stripe.cache_vol = &cache_vol;
cache_rsb.write_bytes =
Metrics::Counter::createPtr("unit_test.write.bytes");
@@ -135,10 +135,10 @@ init_stripe_for_writing(Stripe &stripe,
StripteHeaderFooter &header, CacheVol &c
return attach_tmpfile_to_stripe(stripe);
}
-TEST_CASE("The behavior of Stripe::add_writer.")
+TEST_CASE("The behavior of StripeSM::add_writer.")
{
- FakeVC vc;
- Stripe stripe;
+ FakeVC vc;
+ StripeSM stripe;
SECTION("Branch tests.")
{
@@ -189,12 +189,12 @@ TEST_CASE("The behavior of Stripe::add_writer.")
}
}
-// This test case demonstrates how to set up a Stripe and make
+// This test case demonstrates how to set up a StripeSM and make
// a call to aggWrite without causing memory errors. It uses a
-// tmpfile for the Stripe to write to.
+// tmpfile for the StripeSM to write to.
TEST_CASE("aggWrite behavior with f.evacuator unset")
{
- Stripe stripe;
+ StripeSM stripe;
StripteHeaderFooter header;
CacheVol cache_vol;
auto *file{init_stripe_for_writing(stripe, header, cache_vol)};
@@ -304,7 +304,7 @@ TEST_CASE("aggWrite behavior with f.evacuator unset")
// only on the presence of the f.evacuator flag.
TEST_CASE("aggWrite behavior with f.evacuator set")
{
- Stripe stripe;
+ StripeSM stripe;
StripteHeaderFooter header;
CacheVol cache_vol;
auto *file{init_stripe_for_writing(stripe, header, cache_vol)};
diff --git a/src/iocore/cache/unit_tests/test_doubles.h
b/src/iocore/cache/unit_tests/test_doubles.h
index 3ab4e1f8cd..65337efba2 100644
--- a/src/iocore/cache/unit_tests/test_doubles.h
+++ b/src/iocore/cache/unit_tests/test_doubles.h
@@ -94,7 +94,7 @@ public:
class WaitingVC final : public FakeVC
{
public:
- WaitingVC(Stripe *stripe)
+ WaitingVC(StripeSM *stripe)
{
SET_HANDLER(&WaitingVC::handle_call);
this->stripe = stripe;
diff --git a/src/traffic_cache_tool/CacheDefs.cc
b/src/traffic_cache_tool/CacheDefs.cc
index 52863c5d58..3622b053c4 100644
--- a/src/traffic_cache_tool/CacheDefs.cc
+++ b/src/traffic_cache_tool/CacheDefs.cc
@@ -178,7 +178,7 @@ int OPEN_RW_FLAG = O_RDONLY;
namespace ct
{
bool
-Stripe::validate_sync_serial()
+StripeSM::validate_sync_serial()
{
// check if A sync_serials match and A is at least as updated as B
return (_meta[0][0].sync_serial == _meta[0][1].sync_serial &&
@@ -188,7 +188,7 @@ Stripe::validate_sync_serial()
}
Errata
-Stripe::clear()
+StripeSM::clear()
{
Errata zret;
alignas(512) static char zero[CacheStoreBlocks::SCALE]; // should be all
zero, it's static.
@@ -203,17 +203,17 @@ Stripe::clear()
return zret;
}
-Stripe::Chunk::~Chunk()
+StripeSM::Chunk::~Chunk()
{
this->clear();
}
void
-Stripe::Chunk::append(MemSpan<void> m)
+StripeSM::Chunk::append(MemSpan<void> m)
{
_chain.push_back(m);
}
void
-Stripe::Chunk::clear()
+StripeSM::Chunk::clear()
{
for (auto &m : _chain) {
free(const_cast<void *>(m.data()));
@@ -221,7 +221,7 @@ Stripe::Chunk::clear()
_chain.clear();
}
-Stripe::Stripe(Span *span, const Bytes &start, const CacheStoreBlocks &len) :
_span(span), _start(start), _len(len)
+StripeSM::StripeSM(Span *span, const Bytes &start, const CacheStoreBlocks
&len) : _span(span), _start(start), _len(len)
{
swoc::bwprint(hashText, "{} {}:{}", span->_path.view(), _start.count(),
_len.count());
CryptoContext().hash_immediate(hash_id, hashText.data(),
static_cast<int>(hashText.size()));
@@ -229,14 +229,14 @@ Stripe::Stripe(Span *span, const Bytes &start, const
CacheStoreBlocks &len) : _s
}
bool
-Stripe::isFree() const
+StripeSM::isFree() const
{
return 0 == _vol_idx;
}
// TODO: Implement the whole logic
Errata
-Stripe::InitializeMeta()
+StripeSM::InitializeMeta()
{
Errata zret;
// memset(this->raw_dir, 0, dir_len);
@@ -266,7 +266,7 @@ Stripe::InitializeMeta()
// Need to be bit more robust at some point.
bool
-Stripe::validateMeta(StripeMeta const *meta)
+StripeSM::validateMeta(StripeMeta const *meta)
{
// Need to be bit more robust at some point.
return StripeMeta::MAGIC == meta->magic && meta->version._major <=
ts::CACHE_DB_MAJOR_VERSION &&
@@ -275,7 +275,7 @@ Stripe::validateMeta(StripeMeta const *meta)
}
bool
-Stripe::probeMeta(MemSpan<void> &mem, StripeMeta const *base_meta)
+StripeSM::probeMeta(MemSpan<void> &mem, StripeMeta const *base_meta)
{
while (mem.size() >= sizeof(StripeMeta)) {
StripeMeta const *meta = static_cast<StripeMeta *>(mem.data());
@@ -291,7 +291,7 @@ Stripe::probeMeta(MemSpan<void> &mem, StripeMeta const
*base_meta)
}
Errata
-Stripe::updateHeaderFooter()
+StripeSM::updateHeaderFooter()
{
Errata zret;
this->vol_init_data();
@@ -357,14 +357,14 @@ Stripe::updateHeaderFooter()
}
size_t
-Stripe::vol_dirlen()
+StripeSM::vol_dirlen()
{
return vol_headerlen() + ROUND_TO_STORE_BLOCK(((size_t)this->_buckets) *
DIR_DEPTH * this->_segments * SIZEOF_DIR) +
ROUND_TO_STORE_BLOCK(sizeof(StripeMeta));
}
void
-Stripe::vol_init_data_internal()
+StripeSM::vol_init_data_internal()
{
this->_buckets =
((this->_len.count() * 8192 - (this->_content - this->_start)) /
cache_config_min_average_object_size) / DIR_DEPTH;
@@ -374,7 +374,7 @@ Stripe::vol_init_data_internal()
}
void
-Stripe::vol_init_data()
+StripeSM::vol_init_data()
{
// iteratively calculate start + buckets
this->vol_init_data_internal();
@@ -383,7 +383,7 @@ Stripe::vol_init_data()
}
void
-Stripe::updateLiveData([[maybe_unused]] enum Copy c)
+StripeSM::updateLiveData([[maybe_unused]] enum Copy c)
{
// CacheStoreBlocks delta{_meta_pos[c][FOOT] - _meta_pos[c][HEAD]};
CacheStoreBlocks header_len(0);
@@ -418,31 +418,31 @@ dir_compare_tag(const CacheDirEntry *e, const CryptoHash
*key)
}
int
-vol_in_phase_valid(Stripe *stripe, CacheDirEntry *e)
+vol_in_phase_valid(StripeSM *stripe, CacheDirEntry *e)
{
return (dir_offset(e) - 1 < ((stripe->_meta[0][0].write_pos +
stripe->agg_buf_pos - stripe->_start) / CACHE_BLOCK_SIZE));
}
int
-vol_out_of_phase_valid(Stripe *stripe, CacheDirEntry *e)
+vol_out_of_phase_valid(StripeSM *stripe, CacheDirEntry *e)
{
return (dir_offset(e) - 1 >= ((stripe->_meta[0][0].agg_pos - stripe->_start)
/ CACHE_BLOCK_SIZE));
}
bool
-Stripe::dir_valid(CacheDirEntry *_e)
+StripeSM::dir_valid(CacheDirEntry *_e)
{
return (this->_meta[0][0].phase == dir_phase(_e) ? vol_in_phase_valid(this,
_e) : vol_out_of_phase_valid(this, _e));
}
Bytes
-Stripe::stripe_offset(CacheDirEntry *e)
+StripeSM::stripe_offset(CacheDirEntry *e)
{
return this->_content + Bytes((dir_offset(e) * CACHE_BLOCK_SIZE) -
CACHE_BLOCK_SIZE);
}
int
-Stripe::dir_probe(CryptoHash *key, [[maybe_unused]] CacheDirEntry *result,
[[maybe_unused]] CacheDirEntry **last_collision)
+StripeSM::dir_probe(CryptoHash *key, [[maybe_unused]] CacheDirEntry *result,
[[maybe_unused]] CacheDirEntry **last_collision)
{
int segment = key->slice32(0) % this->_segments;
int bucket = key->slice32(1) % this->_buckets;
@@ -495,7 +495,7 @@ Stripe::dir_probe(CryptoHash *key, [[maybe_unused]]
CacheDirEntry *result, [[may
}
CacheDirEntry *
-Stripe::dir_delete_entry(CacheDirEntry *e, CacheDirEntry *p, int s)
+StripeSM::dir_delete_entry(CacheDirEntry *e, CacheDirEntry *p, int s)
{
CacheDirEntry *seg = this->dir_segment(s);
int no = dir_next(e);
@@ -525,7 +525,7 @@ Stripe::dir_delete_entry(CacheDirEntry *e, CacheDirEntry
*p, int s)
}
void
-Stripe::walk_all_buckets()
+StripeSM::walk_all_buckets()
{
for (int s = 0; s < this->_segments; s++) {
if (walk_bucket_chain(s)) {
@@ -535,7 +535,7 @@ Stripe::walk_all_buckets()
}
bool
-Stripe::walk_bucket_chain(int s)
+StripeSM::walk_bucket_chain(int s)
{
CacheDirEntry *seg = this->dir_segment(s);
std::bitset<65536> b_bitset;
@@ -571,7 +571,7 @@ Stripe::walk_bucket_chain(int s)
}
void
-Stripe::dir_free_entry(CacheDirEntry *e, int s)
+StripeSM::dir_free_entry(CacheDirEntry *e, int s)
{
CacheDirEntry *seg = this->dir_segment(s);
unsigned int fo = this->freelist[s];
@@ -586,7 +586,7 @@ Stripe::dir_free_entry(CacheDirEntry *e, int s)
// adds all the directory entries
// in a segment to the segment freelist
void
-Stripe::dir_init_segment(int s)
+StripeSM::dir_init_segment(int s)
{
this->freelist[s] = 0;
CacheDirEntry *seg = this->dir_segment(s);
@@ -601,7 +601,7 @@ Stripe::dir_init_segment(int s)
}
void
-Stripe::init_dir()
+StripeSM::init_dir()
{
for (int s = 0; s < this->_segments; s++) {
this->freelist[s] = 0;
@@ -618,7 +618,7 @@ Stripe::init_dir()
}
Errata
-Stripe::loadDir()
+StripeSM::loadDir()
{
Errata zret;
int64_t dirlen = this->vol_dirlen();
@@ -669,7 +669,7 @@ dir_bucket_loop_check(CacheDirEntry *start_dir,
CacheDirEntry *seg)
#endif
int
-Stripe::dir_freelist_length(int s)
+StripeSM::dir_freelist_length(int s)
{
int free = 0;
CacheDirEntry *seg = this->dir_segment(s);
@@ -685,7 +685,7 @@ Stripe::dir_freelist_length(int s)
}
int
-Stripe::check_loop(int s)
+StripeSM::check_loop(int s)
{
// look for loop in the segment
// rewrite the freelist if loop is present
@@ -716,7 +716,7 @@ compare_ushort(void const *a, void const *b)
}
void
-Stripe::dir_check()
+StripeSM::dir_check()
{
static int const SEGMENT_HISTOGRAM_WIDTH = 16;
int hist[SEGMENT_HISTOGRAM_WIDTH + 1] = {0};
@@ -873,7 +873,7 @@ Stripe::dir_check()
}
Errata
-Stripe::loadMeta()
+StripeSM::loadMeta()
{
// Read from disk in chunks of this size. This needs to be a multiple of
both the
// store block size and the directory entry size so neither goes across read
boundaries.
diff --git a/src/traffic_cache_tool/CacheDefs.h
b/src/traffic_cache_tool/CacheDefs.h
index 733fcfe4b0..db76bb99f0 100644
--- a/src/traffic_cache_tool/CacheDefs.h
+++ b/src/traffic_cache_tool/CacheDefs.h
@@ -137,7 +137,7 @@ struct SpanHeader {
CacheStripeDescriptor stripes[1];
};
-/** Stripe data, serialized format.
+/** StripeSM data, serialized format.
@internal StripeHeaderFooter
*/
@@ -441,7 +441,7 @@ dir_to_offset(const CacheDirEntry *d, const CacheDirEntry
*seg)
#endif
}
-struct Stripe;
+struct StripeSM;
struct Span {
Span(swoc::file::path const &path) : _path(path) {}
Errata load();
@@ -455,8 +455,8 @@ struct Span {
/// This is broken and needs to be cleaned up.
void clearPermanently();
- swoc::Rv<Stripe *> allocStripe(int vol_idx, const CacheStripeBlocks &len);
- Errata updateHeader(); ///< Update serialized header and write
to disk.
+ swoc::Rv<StripeSM *> allocStripe(int vol_idx, const CacheStripeBlocks &len);
+ Errata updateHeader(); ///< Update serialized header and write
to disk.
swoc::file::path _path; ///< File system location of span.
ats_scoped_fd _fd; ///< Open file descriptor for span.
@@ -472,10 +472,10 @@ struct Span {
std::unique_ptr<ts::SpanHeader> _header;
/// Live information about stripes.
/// Seeded from @a _header and potentially augmented with direct probing.
- std::list<Stripe *> _stripes;
+ std::list<StripeSM *> _stripes;
};
/*
---------------------------------------------------------------------------------------
*/
-struct Stripe {
+struct StripeSM {
/// Meta data is stored in 4 copies A/B and Header/Footer.
enum Copy { A = 0, B = 1 };
enum { HEAD = 0, FOOT = 1 };
@@ -496,7 +496,7 @@ struct Stripe {
};
/// Construct from span header data.
- Stripe(Span *span, const Bytes &start, const CacheStoreBlocks &len);
+ StripeSM(Span *span, const Bytes &start, const CacheStoreBlocks &len);
/// Is stripe unallocated?
bool isFree() const;
@@ -532,8 +532,8 @@ struct Stripe {
Bytes _content; ///< Start of content.
CacheStoreBlocks _len; ///< Length of stripe.
uint8_t _vol_idx = 0; ///< Volume index.
- uint8_t _type = 0; ///< Stripe type.
- int8_t _idx = -1; ///< Stripe index in span.
+ uint8_t _type = 0; ///< StripeSM type.
+ int8_t _idx = -1; ///< StripeSM index in span.
int agg_buf_pos = 0;
int64_t _buckets = 0; ///< Number of buckets per segment.
diff --git a/src/traffic_cache_tool/CacheScan.h
b/src/traffic_cache_tool/CacheScan.h
index 47a96c4e3b..b40bdc7801 100644
--- a/src/traffic_cache_tool/CacheScan.h
+++ b/src/traffic_cache_tool/CacheScan.h
@@ -39,17 +39,17 @@ namespace ct
{
class CacheScan
{
- Stripe *stripe = nullptr;
+ StripeSM *stripe = nullptr;
url_matcher *u_matcher = nullptr;
public:
- CacheScan(Stripe *str, swoc::file::path const &path) : stripe(str)
+ CacheScan(StripeSM *str, swoc::file::path const &path) : stripe(str)
{
if (!path.empty()) {
u_matcher = new url_matcher(path);
}
};
- CacheScan(Stripe *str) : stripe(str) {}
+ CacheScan(StripeSM *str) : stripe(str) {}
~CacheScan() { delete u_matcher; }
Errata Scan(bool search = false);
Errata get_alternates(const char *buf, int length, bool search);
diff --git a/src/traffic_cache_tool/CacheTool.cc
b/src/traffic_cache_tool/CacheTool.cc
index 271c643e7f..99af762fb8 100644
--- a/src/traffic_cache_tool/CacheTool.cc
+++ b/src/traffic_cache_tool/CacheTool.cc
@@ -75,9 +75,9 @@ namespace ct
/// A live volume.
/// Volume data based on data from loaded spans.
struct Volume {
- int _idx; ///< Volume index.
- CacheStoreBlocks _size; ///< Amount of storage allocated.
- std::vector<Stripe *> _stripes;
+ int _idx; ///< Volume index.
+ CacheStoreBlocks _size; ///< Amount of storage allocated.
+ std::vector<StripeSM *> _stripes;
/// Remove all data related to @a span.
// void clearSpan(Span *span);
@@ -89,7 +89,7 @@ struct Volume {
void
Volume::clearSpan(Span* span)
{
- auto spot = std::remove_if(_stripes.begin(), _stripes.end(),
[span,this](Stripe* stripe) { return stripe->_span == span ? ( this->_size -=
stripe->_len , true ) : false; });
+ auto spot = std::remove_if(_stripes.begin(), _stripes.end(),
[span,this](StripeSM* stripe) { return stripe->_span == span ? ( this->_size -=
stripe->_len , true ) : false; });
_stripes.erase(spot, _stripes.end());
}
#endif
@@ -197,16 +197,16 @@ struct Cache {
void clearAllocation();
enum class SpanDumpDepth { SPAN, STRIPE, DIRECTORY };
- void dumpSpans(SpanDumpDepth depth);
- void dumpVolumes();
- void build_stripe_hash_table();
- Stripe *key_to_stripe(CryptoHash *key, const char *hostname, int host_len);
+ void dumpSpans(SpanDumpDepth depth);
+ void dumpVolumes();
+ void build_stripe_hash_table();
+ StripeSM *key_to_stripe(CryptoHash *key, const char *hostname, int host_len);
// ts::CacheStripeBlocks calcTotalSpanPhysicalSize();
ts::CacheStripeBlocks calcTotalSpanConfiguredSize();
std::list<Span *> _spans;
std::map<int, Volume> _volumes;
- std::vector<Stripe *> globalVec_stripe;
+ std::vector<StripeSM *> globalVec_stripe;
std::unordered_set<ts::CacheURL *> URLset;
unsigned short *stripes_hash_table;
};
@@ -483,7 +483,7 @@ Cache::loadSpanDirect(swoc::file::path const &path, int
vol_idx, [[maybe_unused]
int nspb = span->_header->num_diskvol_blks;
for (auto i = 0; i < nspb; ++i) {
ts::CacheStripeDescriptor &raw = span->_header->stripes[i];
- Stripe *stripe = new Stripe(span.get(), raw.offset,
raw.len);
+ StripeSM *stripe = new StripeSM(span.get(),
raw.offset, raw.len);
stripe->_idx = i;
if (raw.free == 0) {
stripe->_vol_idx = raw.vol_idx;
@@ -776,11 +776,11 @@ Span::loadDevice()
return zret;
}
-swoc::Rv<Stripe *>
+swoc::Rv<StripeSM *>
Span::allocStripe(int vol_idx, const CacheStripeBlocks &len)
{
for (auto spot = _stripes.begin(), limit = _stripes.end(); spot != limit;
++spot) {
- Stripe *stripe = *spot;
+ StripeSM *stripe = *spot;
if (stripe->isFree()) {
if (len < stripe->_len) {
// If the remains would be less than a stripe block, just take it all.
@@ -789,7 +789,7 @@ Span::allocStripe(int vol_idx, const CacheStripeBlocks &len)
stripe->_type = 1;
return stripe;
} else {
- Stripe *ns = new Stripe(this, stripe->_start, len);
+ StripeSM *ns = new StripeSM(this, stripe->_start, len);
stripe->_start += len;
stripe->_len -= len;
ns->_vol_idx = vol_idx;
@@ -806,14 +806,14 @@ Span::allocStripe(int vol_idx, const CacheStripeBlocks
&len)
bool
Span::isEmpty() const
{
- return std::all_of(_stripes.begin(), _stripes.end(), [](Stripe *s) { return
s->_vol_idx == 0; });
+ return std::all_of(_stripes.begin(), _stripes.end(), [](StripeSM *s) {
return s->_vol_idx == 0; });
}
Errata
Span::clear()
{
- Stripe *stripe;
- std::for_each(_stripes.begin(), _stripes.end(), [](Stripe *s) { delete s; });
+ StripeSM *stripe;
+ std::for_each(_stripes.begin(), _stripes.end(), [](StripeSM *s) { delete s;
});
_stripes.clear();
// Gah, due to lack of anything better, TS depends on the number of usable
blocks to be consistent
@@ -822,7 +822,7 @@ Span::clear()
// The maximum number of volumes that can store stored, accounting for the
space used to store the descriptors.
int n = (eff - sizeof(ts::SpanHeader)) / (CacheStripeBlocks::SCALE +
sizeof(CacheStripeDescriptor));
_offset = _base + round_up(sizeof(ts::SpanHeader) + (n - 1) *
sizeof(CacheStripeDescriptor));
- stripe = new Stripe(this, _offset, _len - _offset);
+ stripe = new StripeSM(this, _offset, _len - _offset);
stripe->vol_init_data();
stripe->InitializeMeta();
_stripes.push_back(stripe);
@@ -1021,7 +1021,7 @@ Cache::build_stripe_hash_table()
ats_free(rtable);
}
-Stripe *
+StripeSM *
Cache::key_to_stripe(CryptoHash *key, [[maybe_unused]] const char *hostname,
[[maybe_unused]] int host_len)
{
uint32_t h = (key->slice32(2) >> DIR_TAG_WIDTH) % STRIPE_HASH_TABLE_SIZE;
@@ -1201,7 +1201,7 @@ Find_Stripe(swoc::file::path const &input_file_path)
ctx.update(host->url.data(), host->url.size());
ctx.update(&host->port, sizeof(host->port));
ctx.finalize(hashT);
- Stripe *stripe_ = cache.key_to_stripe(&hashT, host->url.data(),
host->url.size());
+ StripeSM *stripe_ = cache.key_to_stripe(&hashT, host->url.data(),
host->url.size());
w.print("{}", hashT);
printf("hash of %.*s is %.*s: Stripe %s \n",
static_cast<int>(host->url.size()), host->url.data(),
static_cast<int>(w.size()), w.data(), stripe_->hashText.data());
@@ -1317,7 +1317,7 @@ Get_Response(swoc::file::path const &input_file_path)
ctx.update(host->url.data(), host->url.size());
ctx.update(&host->port, sizeof(host->port));
ctx.finalize(hashT);
- Stripe *stripe_ = cache.key_to_stripe(&hashT, host->url.data(),
host->url.size());
+ StripeSM *stripe_ = cache.key_to_stripe(&hashT, host->url.data(),
host->url.size());
w.print("{}", hashT);
printf("hash of %.*s is %.*s: Stripe %s \n",
static_cast<int>(host->url.size()), host->url.data(),
static_cast<int>(w.size()), w.data(), stripe_->hashText.data());