if (b->orphan_slot != om->nextfree-1) {
/* need to swap in the last entry */
- struct datablock *bfs, *bi, *bbl;
+ struct inode *bino;
+ struct datablock *bbl;
ob2 = lafs_get_block(fs->orphans, (om->nextfree-1) >> shift,
NULL, GFP_KERNEL, MKREF(orphan_move));
if (!ob2) {
lastor[lastent].type = 0;
unmap_dblock_2(ob2, lastor);
- /* FIXME these should not create the block if it
- * doesn't exist */
- bfs = lafs_get_block(fs->ss[0].root, le32_to_cpu(last.filesys),
- NULL, GFP_KERNEL, MKREF(orphan_fs));
- if (bfs && bfs->my_inode)
- bi = lafs_get_block(bfs->my_inode,
- le32_to_cpu(last.inum),
- NULL, GFP_KERNEL, MKREF(orphan_ino));
- else
- bi = NULL;
- putdref(bfs, MKREF(orphan_fs));
- if (bi && bi->my_inode)
- bbl = lafs_get_block(bi->my_inode,
+ bino = lafs_iget_fs(fs,
+ le32_to_cpu(last.filesys),
+ le32_to_cpu(last.inum));
+ if (bino)
+ bbl = lafs_get_block(bino,
le32_to_cpu(last.addr),
NULL, GFP_KERNEL, MKREF(orphan_blk));
else
bbl = NULL;
- putdref(bi, MKREF(orphan_ino));
- dprintk("O bfs=%p(%p) bi=%p bbl=%p lastent=%d "
- "fs=%d in=%d a=%d\n",
- bfs, bfs->my_inode, bi, bbl, lastent,
- le32_to_cpu(last.filesys),
- le32_to_cpu(last.inum),
- le32_to_cpu(last.addr)
- );
+
if (!bbl) {
putdref(ob2, MKREF(orphan_move));
- printk("OUCH 3\n");
+ iput(bino);
BUG();
goto out_unlock;
}
unmap_dblock(ob1, or);
bbl->orphan_slot = b->orphan_slot;
putdref(bbl, MKREF(orphan_blk));
+ iput(bino);
+
lafs_dirty_dblock(ob1);
lafs_dirty_dblock(ob2);