}
}
+static void filter_empties(struct block **uninc)
+{
+ /* If any block has phys==0 and there is another block
+ * with same address, incorp_index the phys==0 block
+ */
+ struct block *b = *uninc;
+ while (b && b->chain) {
+ if (b->fileaddr == b->chain->fileaddr) {
+ struct block *t;
+ if (b->physaddr == 0) {
+ t = b;
+ *uninc = b->chain;
+ } else if (b->chain->physaddr == 0) {
+ t = b->chain;
+ b->chain = t->chain;
+ } else
+ LAFS_BUG(1, b);
+ t->chain = NULL;
+ incorp_index(t);
+ } else {
+ uninc = &b->chain;
+ b = *uninc;
+ }
+ }
+}
+
/* Incorporate all the addresses in uninc_table into this
* indexblock. Each address carried a credit to allow for
* indexblock splitting etc.
goto out;
sort_blocks(&uninc);
+ filter_empties(&uninc);
LAFS_BUG(!test_bit(B_Dirty, &ib->b.flags) &&
!test_bit(B_Realloc, &ib->b.flags), &ib->b);