From de6b2944b42b02f3ee2089ebd9b910ad77ca3f11 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 25 Aug 2009 17:09:52 +1000 Subject: [PATCH] Fix prune_some. We need to put phys==0 into the uninc_table, not the current phys. This might end up not being very efficient... might need to rethink it. --- inode.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/inode.c b/inode.c index 30cc4c4..a544859 100644 --- a/inode.c +++ b/inode.c @@ -542,10 +542,7 @@ static int prune_some(void *data, u32 addr, u64 paddr, int len) struct fs *fs = fs_from_inode(ino); int ph = !!test_bit(B_Phase1, &ib->b.flags); int i; - BUG(); - /* This looks wrong. We should be setting physaddr to ZERO - * to prune blocks, shouldn't we ?? - */ + if (paddr == 0 || len == 0) return 0; dprintk("PRUNE2 %d for %d at %lld\n", addr, len, (long long)paddr); @@ -555,15 +552,11 @@ static int prune_some(void *data, u32 addr, u64 paddr, int len) spin_lock(&fs->lock); a = &ib->uninc_table.pending_addr [ib->uninc_table.pending_cnt - 1]; - if (ib->uninc_table.pending_cnt >= 1 && - a->fileaddr + a->cnt == addr+i && - a->physaddr + a->cnt == paddr+i) - a->cnt++; - else if (ib->uninc_table.pending_cnt < + if (ib->uninc_table.pending_cnt < ARRAY_SIZE(ib->uninc_table.pending_addr)) { a++; a->fileaddr = addr + i; - a->physaddr = paddr + i; + a->physaddr = 0; a->cnt = 1; LAFS_BUG(!test_bit(B_Dirty, &ib->b.flags) && !test_bit(B_Realloc, &ib->b.flags), &ib->b); -- 2.39.5