Skip to content

Commit

Permalink
Cleanup: Remove disk path copy from Stripe (#11895)
Browse files Browse the repository at this point in the history
  • Loading branch information
masaori335 authored Dec 5, 2024
1 parent 08c9689 commit 65531cb
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/iocore/cache/CacheDir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ freelist_clean(int s, Stripe *stripe)
if (stripe->header->freelist[s]) {
return;
}
Warning("cache directory overflow on '%s' segment %d, purging...", stripe->path, s);
Warning("cache directory overflow on '%s' segment %d, purging...", stripe->disk->path, s);
int n = 0;
Dir *seg = stripe->dir_segment(s);
for (int bi = 0; bi < stripe->buckets; bi++) {
Expand Down
2 changes: 1 addition & 1 deletion src/iocore/cache/CacheVC.cc
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ CacheVC::handleReadDone(int event, Event * /* e ATS_UNUSED */)
ink_assert(checksum == doc->checksum);
if (checksum != doc->checksum) {
Note("cache: checksum error for [%" PRIu64 " %" PRIu64 "] len %d, hlen %d, disk %s, offset %" PRIu64 " size %zu",
doc->first_key.b[0], doc->first_key.b[1], doc->len, doc->hlen, stripe->path, (uint64_t)io.aiocb.aio_offset,
doc->first_key.b[0], doc->first_key.b[1], doc->len, doc->hlen, stripe->disk->path, (uint64_t)io.aiocb.aio_offset,
(size_t)io.aiocb.aio_nbytes);
doc->magic = DOC_CORRUPT;
okay = 0;
Expand Down
3 changes: 1 addition & 2 deletions src/iocore/cache/Stripe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ struct StripeInitInfo {
//

Stripe::Stripe(CacheDisk *disk, off_t blocks, off_t dir_skip, int avg_obj_size, int fragment_size)
: path{ats_strdup(disk->path)},
fd{disk->fd},
: fd{disk->fd},
frag_size{fragment_size},
skip{ROUND_TO_STORE_BLOCK((dir_skip < START_POS ? START_POS : dir_skip))},
start{skip},
Expand Down
5 changes: 2 additions & 3 deletions src/iocore/cache/Stripe.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class Stripe
{
public:
ats_scoped_str hash_text;
char *path = nullptr;
int fd{-1};
int frag_size{-1};

Expand All @@ -101,8 +100,8 @@ class Stripe
off_t len{};
off_t data_blocks{};

CacheDisk *disk{};
uint32_t sector_size{};
CacheDisk *const disk{};
uint32_t sector_size{};

CacheVol *cache_vol{};

Expand Down
3 changes: 0 additions & 3 deletions src/iocore/cache/unit_tests/test_Stripe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ TEST_CASE("The behavior of StripeSM::add_writer.")
}

ats_free(stripe.raw_dir);
ats_free(stripe.path);
}

// This test case demonstrates how to set up a StripeSM and make
Expand Down Expand Up @@ -304,7 +303,6 @@ TEST_CASE("aggWrite behavior with f.evacuator unset")
}

ats_free(stripe.raw_dir);
ats_free(stripe.path);
}

// When f.evacuator is set, vc.buf must contain a Doc object including headers
Expand Down Expand Up @@ -403,5 +401,4 @@ TEST_CASE("aggWrite behavior with f.evacuator set")

delete[] source;
ats_free(stripe.raw_dir);
ats_free(stripe.path);
}

0 comments on commit 65531cb

Please sign in to comment.