]> git.neil.brown.name Git - LaFS.git/commitdiff
Fix prune_some.
authorNeilBrown <neilb@suse.de>
Tue, 25 Aug 2009 07:09:52 +0000 (17:09 +1000)
committerNeilBrown <neilb@suse.de>
Tue, 25 Aug 2009 07:09:52 +0000 (17:09 +1000)
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

diff --git a/inode.c b/inode.c
index 30cc4c4600275828364872139a82bc2bb06542ce..a544859e8e3c51e2b6ffccc363af5ffcaa053e67 100644 (file)
--- 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);