/* need to swap in the last entry */
struct inode *bino;
struct datablock *bbl;
+
+ /* All blocks in the orphan file a referenced either by
+ * an orphan or by a reservation, so this must succeed.
+ */
ob2 = lafs_get_block(fs->orphans, (om->nextfree-1) >> shift,
NULL, GFP_KERNEL, MKREF(orphan_move));
- if (!ob2) {
- /* Oh dear, we cannot effect the swap - sad */
- printk("OUCH 1\n");
- goto out_unlock;
- }
- if (lafs_read_block_async(ob2) != 0) {
- putdref(ob2, MKREF(orphan_move));
- printk("OUCH 2\n");
- goto out_unlock;
- }
- BUG_ON(!test_bit(B_PinPending, &ob2->b.flags));
+ LAFS_BUG(ob2 == NULL, &b->b);
+
+ LAFS_BUG(!test_bit(B_Valid, &ob2->b.flags), &ob2->b);
+ LAFS_BUG(!test_bit(B_PinPending, &ob2->b.flags), &ob2->b);
+
if (lafs_pin_dblock(ob2, ReleaseSpace) < 0) {
putdref(ob2, MKREF(orphan_move));
goto out_unlock;
lastor[lastent].type = 0;
unmap_dblock_2(ob2, lastor);
+ /* The block, being an orphan, must exist */
bino = lafs_iget_fs(fs,
le32_to_cpu(last.filesys),
le32_to_cpu(last.inum), ASYNC);
- if (bino)
- bbl = lafs_get_block(bino,
- le32_to_cpu(last.addr),
- NULL, GFP_KERNEL, MKREF(orphan_blk));
- else
- bbl = NULL;
+ LAFS_BUG(!bino, &b->b);
+ bbl = lafs_get_block(bino,
+ le32_to_cpu(last.addr),
+ NULL, GFP_KERNEL, MKREF(orphan_blk));
+ LAFS_BUG(!bbl, &b->b);
- if (!bbl) {
- putdref(ob2, MKREF(orphan_move));
- iput(bino);
- BUG();
- goto out_unlock;
- }
dprintk("Q %d %d\n", bbl->orphan_slot, om->nextfree);
LAFS_BUG(bbl->orphan_slot != om->nextfree-1, &bbl->b);
if (!IS_ERR(ob)) {
if (!test_and_set_bit(B_Orphan, &ob->b.flags)) {
getdref(ob, MKREF(orphan_flag));
+ getdref(db, MKREF(orphan));
ob->orphan_slot = bslot + slot;
lafs_add_orphan(fs, ob);
}
iput(oino);
}
unmap_dblock(db, or);
+ putdref(db, MKREF(add_orphans));
}
}
-
-
-