* resolve the parent in the same way.
*/
if (test_bit(B_InoIdx, &ib->b.flags)) {
- /* Empty InoIdx blocks aren't a problem, though I should
- * probably reduce depth to 0 or 1.
+ /* Empty InoIdx blocks are allowed. However depth must
+ * be zero. This is where we suddenly collapse a now-empty
+ * indexing tree.
*/
- ib->depth = 0;
- LAFSI(ib->b.inode)->depth = 0;
+ if ((ib->depth == 1 && lafs_leaf_next(ib, 0) == 0xFFFFFFFF) ||
+ (ib->depth > 1 && lafs_index_empty(ib))) {
+ ib->depth = 0;
+ LAFSI(ib->b.inode)->depth = 0;
+ }
/* Don't need to dirty the inode - the fact that we just
* did incorporation should ensure it is already dirty
*/
return;
}
if (!list_empty(&ib->children))
- /* If there are child, we cannot treat this block as empty. */
+ /* If there are children, we cannot treat this block as empty. */
return;
if (ib->depth > 1 && ! lafs_index_empty(ib))
return;