add_extent tries to detect consecutive extents being added
and merges them. But it got it wrong.
So change last* to actually refer to the "next" and get it right.
Signed-off-by: NeilBrown <neilb@suse.de>
return 0;
}
- if (li->esize && li->lastaddr + 1 == addr &&
- li->lastphys + 1 == phys) {
+ if (li->esize && li->lastaddr == addr &&
+ li->lastphys == phys) {
/* just extend the extent */
li->esize += len;
- li->lastaddr = addr;
- li->lastphys = phys;
+ li->lastaddr += len;
+ li->lastphys += len;
return len;
}
if (li->esize) {
li->esize = len;
li->data = p;
li->size -= 12;
- li->lastaddr = addr;
- li->lastphys = phys;
+ li->lastaddr = addr + len;
+ li->lastphys = phys + len;
return len;
}