This overloading just caused problem. Invent a new flag instead.
LAFS_BUG(!test_bit(B_IOLock, &b->flags), b);
lai = LAFSI(b->inode);
- if (!test_bit(B_Valid, &b->flags)) {
- if (test_bit(B_PhysValid, &b->flags) &&
- !test_bit(B_InoIdx, &b->flags) &&
- b->physaddr != 0)
- lafs_allocated_block(fs, b, 0);
- if (test_and_clear_bit(B_Dirty, &b->flags))
- lafs_space_return(fs, 1);
- if (test_and_clear_bit(B_Realloc, &b->flags))
- lafs_space_return(fs, 1);
- lafs_iounlock_block(b);
- return wc->cluster_seq;
- }
+ LAFS_BUG(!test_bit(B_Valid, &b->flags), b);
LAFS_BUG(!fs->rolled, b);
LAFS_BUG(lai->flags & File_nonlogged &&
!test_bit(B_Index, &b->flags), b);
printk("Not valid in lafs_allocated_block: %s\n",
strblk(&p->b));
printk("blk is %s\n", strblk(blk));
- lafs_clear_index(p);
- set_bit(B_Valid, &p->b.flags);
+ BUG();
}
LAFS_BUG(!test_bit(B_Valid, &p->b.flags), &p->b);
if (!test_bit(B_Realloc, &p->b.flags)) {
putiref(ib2, MKREF(inode_handle_orphan2));
goto out2;
}
+ if (test_bit(B_Valid, &ib2->b.flags))
do
lafs_incorporate(fs, ib2);
while (ib2->uninc_table.pending_cnt || ib2->uninc);
while (ib->uninc_table.pending_cnt || ib->uninc)
lafs_incorporate(fs, ib);
- if (test_bit(B_Valid, &ib->b.flags)) {
+ if (!test_bit(B_PhysValid, &ib->b.flags) ||
+ ib->b.physaddr != 0) {
lafs_dirty_iblock(ib);
lafs_walk_leaf_index(ib, prune, ib);
- } else {
- /* This had better be already clear. */
- LAFS_BUG(!test_bit(B_PhysValid, &ib->b.flags), &ib->b);
- LAFS_BUG(ib->b.physaddr != 0, &ib->b);
}
- clear_bit(B_Valid, &ib->b.flags);
+ lafs_incorporate(fs, ib);
LAFS_BUG(!list_empty(&ib->children), &ib->b);
out:
LAFS_BUG(test_bit(B_InoIdx, &b->flags), b);
if (test_bit(B_Index, &b->flags)) {
struct indexblock *ib = iblk(b);
- if (b->physaddr == 0) {
- lafs_clear_index(ib);
- set_bit(B_Valid, &ib->b.flags);
- lafs_iounlock_block(b);
- return 0;
- }
+ LAFS_BUG(b->physaddr == 0, b);
+
page = virt_to_page(ib->data);
offset = offset_in_page(ib->data);
} else {
int lafs_reserve_block(struct block *b, int alloc_type);
void lafs_dirty_dblock(struct datablock *b);
void lafs_erase_dblock(struct datablock *b);
-void lafs_erase_iblock(struct indexblock *b);
void lafs_dirty_iblock(struct indexblock *b);
void block_drop_addr(struct fs *fs, struct inode *ino, u32 addr);
void lafs_flush(struct datablock *b);
LAFS_BUG(!test_bit(B_IOLock, &ib->b.flags), &ib->b);
- if (!test_bit(B_Valid, &ib->b.flags)) {
- lafs_clear_index(ib);
- set_bit(B_Valid, &ib->b.flags);
- }
+ LAFS_BUG(!test_bit(B_Valid, &ib->b.flags) && ib->depth > 0, &ib->b);
if (ib->depth <= 1) {
/* take a copy of the uninc_table so we can work while
LAFSI(ib->b.inode)->depth = 1;
((struct la_inode*)(buf-offset))->depth = 1;
ib->depth = 1;
+ set_bit(B_Valid, &ib->b.flags);
}
} else
offset = 0;