Skip to content

Commit

Permalink
Works?
Browse files Browse the repository at this point in the history
  • Loading branch information
tristan957 committed Feb 14, 2023
1 parent 20010dc commit 4367c87
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/cn/kvset_split.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ struct vgroup_split_metadata {
*
* Return values:
* v >= start and overlap = false: left: [start, v - 1], right [v, end]
* v >= start and overlap = true : left: [start, punched(v)], right [clone(v), end]
* v >= start and overlap = true : left: [start, punch(v)], right [clone(v), end]
*
* NOTES:
* v = start and overlap = false: All vblocks go to the right
Expand Down Expand Up @@ -653,7 +653,9 @@ vblocks_split(

if (!move_left) {
/* Add the vblocks in [boundary, end] to the right kvset */
boundary = (overlapping_access || move_right) ? split : split + 1;
boundary = (overlapping_access || move_right || (split == start && !metadata->overlaps))
? split
: split + 1;
for (uint16_t j = boundary; j <= end; j++) {
uint32_t alen;
uint64_t mbid;
Expand Down Expand Up @@ -722,10 +724,13 @@ vblocks_split(
}

if (!move_right) {
/* Add vblocks in [start, boundary] to the left kvset */
/* Add vblocks in [start, boundary) to the left kvset */
vbcnt = 0; /* reset vbcnt for the left kvset */
boundary = min(split, end);
for (uint16_t j = start; j <= boundary; j++) {
boundary =
(overlapping_access || move_left || (metadata->overlaps && metadata->offset == -1))
? split + 1
: split;
for (uint16_t j = start; j < boundary; j++) {
uint32_t alen;
uint64_t mbid;

Expand Down Expand Up @@ -774,7 +779,8 @@ vblocks_split(
if (vbcnt > 0) {
vbidx_left += vbcnt;

err = vgmap_vbidx_set(vgmap_src, boundary, vgmap_left, vbidx_left - 1, vgidx_left);
err = vgmap_vbidx_set(
vgmap_src, boundary - 1, vgmap_left, vbidx_left - 1, vgidx_left);
if (err)
goto out;

Expand Down

0 comments on commit 4367c87

Please sign in to comment.