Skip to content

Commit

Permalink
Merge pull request #57 from OpenMPDK/wop_stability
Browse files Browse the repository at this point in the history
Fixed WOP stability issues
  • Loading branch information
ramachaitanyak authored May 23, 2024
2 parents 005511c + 55496be commit 1410af9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
6 changes: 3 additions & 3 deletions target/core/block_allocator/bitmap_allocator/bitmap_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ class QwordVector64Cell : public AllocatorType::BitMap,
* in a given cell of the bitmap. This behaves like a get operation
* @ return a n-bit value inside the cell represented by uint8_t
*/
uint8_t operator[](int index) const {
int byte_index = index / cells_per_qword_;
int shift = (index % cells_per_qword_) * bits_per_cell_;
uint8_t operator[](uint64_t index) const {
uint64_t byte_index = index / cells_per_qword_;
uint64_t shift = (index % cells_per_qword_) * bits_per_cell_;
return (data_[byte_index] >> shift) & read_cell_flag_;
}

Expand Down
16 changes: 7 additions & 9 deletions target/core/kvtrans/formatter/formatter_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ void Formatter::format_bdev_read_super_complete_cb(
}

// Free all the super block memory allocated
free(read_sb);
free(Formatter::written_super_block);
spdk_dma_free(read_sb);
spdk_dma_free(Formatter::written_super_block);


// Try to exit application
Expand Down Expand Up @@ -324,8 +324,8 @@ bool Formatter::read_and_print_super_block(

if (rc != 0) {
assert(("ERROR", false));
free(super_block);
free(Formatter::written_super_block);
spdk_dma_free(super_block);
spdk_dma_free(Formatter::written_super_block);
// return false;
}

Expand All @@ -346,7 +346,7 @@ void Formatter::format_bdev_write_super_complete_cb(
// Assert for now
assert(("ERROR", false));
// Free memory allocated for super_block
free(Formatter::written_super_block);
spdk_dma_free(Formatter::written_super_block);
// Free payload
delete payload;
}
Expand All @@ -357,7 +357,7 @@ void Formatter::format_bdev_write_super_complete_cb(
Formatter::read_and_print_super_block(payload);
} else {
// Free memory allocated for super_block
free(Formatter::written_super_block);
spdk_dma_free(Formatter::written_super_block);
// Free payload
delete payload;
// Check for app stop
Expand Down Expand Up @@ -397,7 +397,6 @@ bool Formatter::format_device(bool is_debug) {

int rc = 0;
int num_blocks = 0;
//bool is_debug = true;

// This API assumes that the device is already opened and
// all relevant details are computed
Expand All @@ -413,7 +412,6 @@ bool Formatter::format_device(bool is_debug) {
this->bdev_super_block_physical_start_block_;
cb_payload->debug = is_debug;


// Build and write super block
dss_super_block_t *super_block =
(dss_super_block_t *)spdk_dma_zmalloc(
Expand Down Expand Up @@ -456,7 +454,7 @@ bool Formatter::format_device(bool is_debug) {
cb_payload);

if (rc != 0) {
free(super_block);
spdk_dma_free(super_block);
Formatter::written_super_block = nullptr;
delete cb_payload;
assert(("ERROR", false));
Expand Down

0 comments on commit 1410af9

Please sign in to comment.