Skip to content

Commit

Permalink
Fix DAX corruption when using libdeflate.
Browse files Browse the repository at this point in the history
Need to include the zlib header.
  • Loading branch information
unknownbrackets committed Feb 12, 2023
1 parent 2a26a15 commit 528c69b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/sector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,13 @@ void Sector::SevenZipTrial() {

void Sector::LibDeflateTrial() {
uint8_t *result = pool.Alloc();
size_t resultSize = libdeflate_deflate_compress(libdeflate_, buffer_, blockSize_, result, pool.bufferSize);
size_t resultSize;
if (flags_ & TASKFLAG_FMT_DAX) {
resultSize = libdeflate_zlib_compress(libdeflate_, buffer_, blockSize_, result, pool.bufferSize);
} else {
resultSize = libdeflate_deflate_compress(libdeflate_, buffer_, blockSize_, result, pool.bufferSize);
}

if (resultSize != 0) {
SubmitTrial(result, static_cast<uint32_t>(resultSize), SECTOR_FMT_DEFLATE);
} else {
Expand Down

0 comments on commit 528c69b

Please sign in to comment.