From: NeilBrown Date: Tue, 8 Jun 2010 08:13:13 +0000 (+1000) Subject: add_extent fixes. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=7b899bec944c84e43f7d3cccf5861062a269e3d1;p=LaFS.git add_extent fixes. 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 --- diff --git a/modify.c b/modify.c index 505a0c8..2d88024 100644 --- a/modify.c +++ b/modify.c @@ -646,12 +646,12 @@ static int add_extent(void *data, u32 addr, u64 phys, int len) 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) { @@ -672,8 +672,8 @@ static int add_extent(void *data, u32 addr, u64 phys, int len) 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; }