Doing so makes the refcount calculations in lafs_refile messy.
We don't drop a block while it is dirty etc anyway so there is no loss
Signed-off-by: NeilBrown <neilb@suse.de>
* leaf list, so we must remove it.
* However it is IOLocked so it might not be on the leaf list.
*/
- int onlru = 0;
LAFS_BUG(test_bit(B_Writeback, &b->b.flags), &b->b);
if (!list_empty(&b->b.lru)) {
- onlru = 1;
list_del_init(&b->b.lru);
}
if (!test_bit(B_Root, &b->b.flags))
spin_unlock(&fs->lock);
if (!test_bit(B_Root, &b->b.flags))
lafs_refile(&b->b.parent->b, 0);
- if (onlru)
- putiref(b, MKREF(leaf));
} else
spin_unlock(&fs->lock);
else
b = NULL;
- if (b)
- /* the list counted a reference. Now we hold it */
+ if (b) {
+ if (test_bit(B_InoIdx, &b->flags))
+ getiref_locked(iblk(b), MKREF(flushable));
+ else
+ getref_locked(b, MKREF(flushable));
list_del_init(&b->lru);
+ }
spin_unlock(&fs->lock);
if (!b)
return b;
if (!lafs_is_leaf(b, phase)) {
lafs_iounlock_block(b);
- putref(b, MKREF(leaf));
+ putref(b, MKREF(flushable));
goto retry;
}
if (unlock)
lafs_iounlock_block(b);
- putref(b, MKREF(leaf));
+ putref(b, MKREF(flushable));
}
if ((test_bit(B_Pinned, &LAFSI(fs->ss[0].root)->iblock->b.flags) &&
!!test_bit(B_Phase1, &LAFSI(fs->ss[0].root)->iblock->b.flags)
}
if (unlock)
lafs_iounlock_block(b);
- putref(b, MKREF(leaf));
+ putref(b, MKREF(flushable));
}
lafs_cluster_flush(fs, 1);
}
if (!list_empty_careful(&b->lru)) {
/* Someone is flushing this block before
* checkpoint got to it - probably writepage.
- * Must remove it from the leaf lru
+ * Must remove it from the leaf lru so it can go
+ * on the cluster list.
*/
- int onlru = 1;
LAFS_BUG(test_bit(B_OnFree, &b->flags), b);
spin_lock(&fs->lock);
- if (list_empty(&b->lru))
- onlru = 0;
- else
+ if (!list_empty(&b->lru))
list_del_init(&b->lru);
spin_unlock(&fs->lock);
- if (onlru)
- putref(b, MKREF(leaf));
}
if (test_and_set_bit(B_Writeback, &b->flags))
ok = 1;
if (spin_is_locked(&lafs_hash_lock))
ok = 1;
+ if (spin_is_locked(&fs_from_inode(ib->b.inode)->lock))
+ ok = 1;
LAFS_BUG(!ok, &ib->b);
if (!test_bit(B_InoIdx, &ib->b.flags)) {
else
list_add(&b->lru, &fs->phase_leafs[ph]);
- getref(b, MKREF(leaf));
}
spin_unlock(&fs->lock);
/* allow lafs_iolock_block-empty to complete */
/* PinPending disappears with the last non-lru reference,
* (or possibly at other times).
*/
- if (atomic_read(&b->refcnt) == dec + onlru)
+ if (atomic_read(&b->refcnt) == dec)
clear_bit(B_PinPending, &b->flags);
ph = !!test_bit(B_Phase1, &b->flags);
(iblk(b)->uninc_table.pending_cnt == 0 &&
iblk(b)->uninc == NULL &&
iblk(b)->uninc_next == NULL &&
- atomic_read(&b->refcnt) == dec+onlru &&
+ atomic_read(&b->refcnt) == dec &&
atomic_read(&iblk(b)->pincnt[0]) == 0 &&
atomic_read(&iblk(b)->pincnt[1]) == 0))
) {
if (test_and_clear_bit(B_Pinned, &b->flags)) {
if (onlru) {
spin_lock(&fs->lock);
- del_ref(b, MKREF(leaf), __FILE__,__LINE__);
list_del_init(&b->lru);
- if (dec)
- atomic_dec(&b->refcnt);
- else
- dec = onlru;
spin_unlock(&fs->lock);
}
if (test_bit(B_InoIdx, &b->flags) &&
if (test_bit(B_Dirty, &b->flags) || test_bit(B_Realloc, &b->flags))
if (spin_is_locked(&fs_from_inode(b->inode)->lock))
ok = 1;
+ if(spin_is_locked(&fs_from_inode(b->inode)->lock))
+ /* Removing from leaf list */
+ ok = 1;
if (!ok)
printk("Not locked: %s\n", strblk(b));
BUG_ON(!ok);