Skip to content

Commit

Permalink
Version 6.2.5.65
Browse files Browse the repository at this point in the history
- Removed unneeded allocations from the previous fixes for rebuilding
  a converted index.
  • Loading branch information
corwin committed Jul 21, 2021
1 parent e11cbd8 commit d4c7f65
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 81 deletions.
12 changes: 4 additions & 8 deletions kvdo.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%define spec_release 1
%define kmod_name kvdo
%define kmod_driver_version 6.2.5.62
%define kmod_driver_version 6.2.5.65
%define kmod_rpm_release %{spec_release}
%define kmod_kernel_version 3.10.0-693.el7

Expand Down Expand Up @@ -96,10 +96,6 @@ rm -rf $RPM_BUILD_ROOT
%{_usr}/src/%{kmod_name}-%{version}

%changelog
* Mon Jul 12 2021 - Red Hat VDO Team <[email protected]> - 6.2.5.62-1
- Fixed chapter computation for a converted sparse index.
- Fixed invalidation of converted chapters.
- Removed extraneous fields from the super block of a converted index.
- Fixed calculation of the number of expiring chapters in a converted
index.
- Fixed bugs rebuilding a converted index.
* Wed Jul 21 2021 - Red Hat VDO Team <[email protected]> - 6.2.5.65-1
- Removed unneeded allocations from the previous fixes for rebuilding
a converted index.
2 changes: 1 addition & 1 deletion uds/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
UDS_VERSION = 8.0.3.34
UDS_VERSION = 8.0.3.36

SOURCES = $(notdir $(wildcard $(src)/*.c)) murmur/MurmurHash3.c
SOURCES += $(addprefix util/,$(notdir $(wildcard $(src)/util/*.c)))
Expand Down
114 changes: 43 additions & 71 deletions uds/volume.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* $Id: //eng/uds-releases/jasper/src/uds/volume.c#25 $
* $Id: //eng/uds-releases/jasper/src/uds/volume.c#26 $
*/

#include "volume.h"
Expand Down Expand Up @@ -1093,12 +1093,7 @@ int findVolumeChapterBoundariesImpl(unsigned int chapterLimit,
Geometry *geometry,
void *aux)
{
uint64_t remappedVCN;
uint64_t zeroVCN;
uint64_t remappedPhysical = geometry->remappedPhysical;
unsigned int *physicalMap;
uint64_t firstVCN = UINT64_MAX;
unsigned int i;

if (chapterLimit == 0) {
*lowestVCN = 0;
Expand All @@ -1115,76 +1110,54 @@ int findVolumeChapterBoundariesImpl(unsigned int chapterLimit,
* lowest one.
*/

int result = ALLOCATE(chapterLimit, unsigned int,
"chapter mapping table", &physicalMap);
if (result != UDS_SUCCESS) {
return result;
}
for (i = 0; i < chapterLimit; i++) {
physicalMap[i] = i;
}

result = (*probeFunc)(aux, remappedPhysical, &remappedVCN);
// It doesn't matter if this results in a bad spot (UINT64_MAX).
int result = (*probeFunc)(aux, 0, &zeroVCN);
if (result != UDS_SUCCESS) {
FREE(physicalMap);
return result;
}
if (remappedPhysical == 0) {
zeroVCN = remappedVCN;
} else {
result = (*probeFunc)(aux, 0, &zeroVCN);
if (result != UDS_SUCCESS) {
FREE(physicalMap);
return result;
}
}
if (remappedVCN == geometry->remappedVirtual) {
// If the index has wrapped around since conversion, the
// remapped chapter has been expired so ignore it.
if (zeroVCN >= remappedVCN + geometry->chaptersPerVolume) {
chapterLimit -= 1;
memmove(physicalMap + remappedPhysical,
physicalMap + remappedPhysical + 1,
(chapterLimit - remappedPhysical) * sizeof(physicalMap[0]));
} else {
memmove(physicalMap + 1, physicalMap,
remappedPhysical * sizeof(physicalMap[0]));
physicalMap[0] = geometry->remappedPhysical;
}
}
// doesn't matter if this results in a bad spot (UINT64_MAX)
if (physicalMap[0] == 0) {
firstVCN = zeroVCN;
} else {
result = (*probeFunc)(aux, physicalMap[0], &firstVCN);
if (result != UDS_SUCCESS) {
FREE(physicalMap);
return result;
}
}

/*
* Binary search for end of the discontinuity in the monotonically
* increasing virtual chapter numbers; bad spots are treated as a span of
* UINT64_MAX values. In effect we're searching for the index of the
* smallest value less than firstVCN. In the case we go off the end it means
* smallest value less than zeroVCN. In the case we go off the end it means
* that chapter 0 has the lowest vcn.
*
* If a virtual chapter is out-of-order, it will be the one moved by
* conversion. Always skip over the moved chapter when searching,
* adding it to the range at the end if necessary.
*/

uint64_t movedChapter = UINT64_MAX;
if (geometry->remappedPhysical > 0) {
uint64_t remappedVCN;
result = (*probeFunc)(aux, geometry->remappedPhysical, &remappedVCN);
if (result != UDS_SUCCESS) {
return UDS_SUCCESS;
}

if (remappedVCN == geometry->remappedVirtual) {
movedChapter = geometry->remappedPhysical;
}
}

unsigned int leftChapter = 0;
unsigned int rightChapter = chapterLimit;

while (leftChapter < rightChapter) {
unsigned int chapter = (leftChapter + rightChapter) / 2;
uint64_t probeVCN;

result = (*probeFunc)(aux, physicalMap[chapter], &probeVCN);
unsigned int chapter = (leftChapter + rightChapter) / 2;
if (chapter == movedChapter) {
chapter--;
}
result = (*probeFunc)(aux, chapter, &probeVCN);
if (result != UDS_SUCCESS) {
FREE(physicalMap);
return result;
}
if (firstVCN <= probeVCN) {
if (zeroVCN <= probeVCN) {
leftChapter = chapter + 1;
if (leftChapter == movedChapter) {
leftChapter++;
}
} else {
rightChapter = chapter;
}
Expand All @@ -1195,7 +1168,6 @@ int findVolumeChapterBoundariesImpl(unsigned int chapterLimit,

result = ASSERT(leftChapter == rightChapter, "leftChapter == rightChapter");
if (result != UDS_SUCCESS) {
FREE(physicalMap);
return result;
}

Expand All @@ -1204,15 +1176,19 @@ int findVolumeChapterBoundariesImpl(unsigned int chapterLimit,
// At this point, leftChapter is the chapter with the lowest virtual chapter
// number.

result = (*probeFunc)(aux, physicalMap[leftChapter], &lowest);
result = (*probeFunc)(aux, leftChapter, &lowest);
if (result != UDS_SUCCESS) {
FREE(physicalMap);
return result;
}

// The moved chapter might be the lowest in the range.
if ((movedChapter != UINT64_MAX)
&& (lowest == geometry->remappedVirtual + 1)) {
lowest = geometry->remappedVirtual;
}

result = ASSERT((lowest != UINT64_MAX), "invalid lowest chapter");
if (result != UDS_SUCCESS) {
FREE(physicalMap);
return result;
}

Expand All @@ -1221,27 +1197,23 @@ int findVolumeChapterBoundariesImpl(unsigned int chapterLimit,
// encounter).

unsigned int badChapters = 0;

for (;;) {
while (highest == UINT64_MAX) {
rightChapter = (rightChapter + chapterLimit - 1) % chapterLimit;
result = (*probeFunc)(aux, physicalMap[rightChapter], &highest);
if (rightChapter == movedChapter) {
continue;
}
result = (*probeFunc)(aux, rightChapter, &highest);
if (result != UDS_SUCCESS) {
FREE(physicalMap);
return result;
}
if (highest != UINT64_MAX) {
break;
}
if (++badChapters >= maxBadChapters) {
if (badChapters++ >= maxBadChapters) {
logError("too many bad chapters in volume: %u", badChapters);
FREE(physicalMap);
return UDS_CORRUPT_COMPONENT;
}
}

*lowestVCN = lowest;
*highestVCN = highest;
FREE(physicalMap);
return UDS_SUCCESS;
}

Expand Down
2 changes: 1 addition & 1 deletion vdo/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VDO_VERSION = 6.2.5.62
VDO_VERSION = 6.2.5.65

VDO_VERSION_MAJOR = $(word 1,$(subst ., ,$(VDO_VERSION)))
VDO_VERSION_MINOR = $(word 2,$(subst ., ,$(VDO_VERSION)))
Expand Down

0 comments on commit d4c7f65

Please sign in to comment.