*/
int err;
struct fs *fs = fs_from_inode(b->b.inode);
- struct block *blk;
- struct inode *ino = NULL;
-
- /* We don't pin a datablock of an inode if there is an
- * InoIdx block. We pin the InoIdx block instead.
- * They might both be pinned at the same time, but
- * only when the index block has swapped phase and the
- * data block is waiting to be written.
- */
- if ((ino = rcu_my_inode(b)) != NULL &&
- LAFSI(ino)->iblock) {
- struct indexblock *ib = lafs_make_iblock(ino, ADOPT, SYNC,
- MKREF(pindb));
- if (IS_ERR(ib))
- blk = getref(&b->b, MKREF(pindb));
- else
- blk = &ib->b;
- } else
- blk = getref(&b->b, MKREF(pindb));
- rcu_iput(ino);
LAFS_BUG(!test_bit(B_PinPending, &b->b.flags), &b->b);
if (LAFSI(b->b.inode)->type != TypeSegmentMap) {
* been written and we want to flip it before it
* can be dirtied.
*/
- if (blk == &b->b &&
- test_bit(B_Pinned, &b->b.flags) &&
+ if (test_bit(B_Pinned, &b->b.flags) &&
!!test_bit(B_Phase1, &b->b.flags) != fs->phase) {
clear_bit(B_PinPending, &b->b.flags);
lafs_refile(&b->b, 0);
lafs_iounlock_block(&b->b);
}
- err = lafs_reserve_block(blk, alloc_type);
+ err = lafs_reserve_block(&b->b, alloc_type);
- if (err) {
- putref(blk, MKREF(pindb));
+ if (err)
return err;
- }
- lafs_pin_block(blk);
- putref(blk, MKREF(pindb));
+ lafs_pin_block(&b->b);
return 0;
}