if (!b)
return;
+ fs = fs_from_inode(b->inode);
check_consistency(b);
/* To (mostly) avoid recursion, we have a loop which may
set_lru(b);
+ if (test_bit(B_Pinned, &b->flags) &&
+ !test_bit(B_Index, &b->flags) &&
+ !test_bit(B_PinPending, &b->flags) &&
+ !test_bit(B_Dirty, &b->flags) &&
+ !test_bit(B_Realloc, &b->flags)
+ ) {
+ /* Don't need to be Pinned any more */
+ /* FIXME do I need to lock access to ->parent */
+ lafs_checkpoint_lock(fs);
+ ph = !!test_bit(B_Phase1, &b->flags);
+ if (test_and_clear_bit(B_Pinned, &b->flags)) {
+ if (test_bit(B_Dirty, &b->flags) ||
+ test_bit(B_Realloc, &b->flags) ||
+ test_bit(B_PinPending, &b->flags))
+ /* lost a race */
+ set_phase(b, ph);
+ else if (!test_bit(B_Root, &b->flags)) {
+ struct block *nb;
+ atomic_dec(&b->parent->pincnt[ph]);
+ nb = &b->parent->b;
+ if (next_parent != nb) {
+ LAFS_BUG(next_parent, b);
+ next_parent = nb;
+ atomic_inc(&nb->refcnt);
+ }
+ }
+ }
+ lafs_checkpoint_unlock(fs);
+ }
+
spin_lock(&lafs_hash_lock);
/* PinPending disappears with the last non-lru reference,
clear_bit(B_PinPending, &b->flags);
ph = !!test_bit(B_Phase1, &b->flags);
- fs = fs_from_inode(b->inode);
/* See if we still need to be pinned */
/* FIXME need some locking here ... */
if (test_bit(B_Pinned, &b->flags) &&
!test_bit(B_PinPending, &b->flags) &&
!test_bit(B_Dirty, &b->flags) &&
!test_bit(B_Realloc, &b->flags) &&
+ atomic_read(&b->refcnt) == dec &&
(!test_bit(B_Index, &b->flags) ||
(iblk(b)->uninc_table.pending_cnt == 0 &&
iblk(b)->uninc == NULL &&
iblk(b)->uninc_next == NULL &&
- atomic_read(&b->refcnt) == dec &&
atomic_read(&iblk(b)->pincnt[0]) == 0 &&
atomic_read(&iblk(b)->pincnt[1]) == 0))
) {