strcat(ans, "PhysValid,");
if (test_bit(B_PrimaryRef, &b->flags))
strcat(ans, "PrimaryRef,");
+ if (test_bit(B_EmptyIndex, &b->flags))
+ strcat(ans, "EmptyIndex,");
if (test_bit(B_Uninc, &b->flags))
strcat(ans, "Uninc,");
}
LAFS_BUG(blk->parent != parent, blk);
} else {
+ if (test_bit(B_EmptyIndex, &parent->b.flags)) {
+ LAFS_BUG(!test_bit(B_Index, &parent->b.flags), &parent->b);
+ LAFS_BUG(test_bit(B_InoIdx, &parent->b.flags), &parent->b);
+ LAFS_BUG(parent->b.fileaddr != parent->b.parent->b.fileaddr, &parent->b);
+
+ clear_bit(B_EmptyIndex, &parent->b.flags);
+ }
LAFS_BUG(parent == iblk(blk), blk);
blk->parent = parent;
getiref(parent, MKREF(child));
struct block, siblings);
LAFS_BUG(b->siblings.prev == &b->parent->children, b);
putref(pb, MKREF(primary));
- lafs_hash_iblock(iblk(b));
+ if (!test_bit(B_EmptyIndex, &b->flags))
+ lafs_hash_iblock(iblk(b));
}
putref(b, MKREF(uninc));
return cr;
#define dblk(__bl) container_of(__bl, struct datablock, b)
enum {
+ /* NOTE: 32 flags in used. Need to overlap 'data' with 'index' if
+ * we need more
+ */
/* First flags that are meaningful for both Data and Index blocks
* Currently 23 */
B_Phase1 = 0, /* phase when pinned - must be '1' - used for indexing */
* which is either the primary or another block holding
* a PrimaryRef.
*/
+ B_EmptyIndex, /* Index block is empty, has no (non-EmptyIndex) children,
+ * will be destroyed soon. Indexing must avoid it
+ * unless if the first child of parent.
+ * Gets allocated to '0'.
+ * Flag only set under B_IOLock.
+ */
};
/* indexing info stays in the block, not in the inode */
struct lafs_inode {