There could still be some stray index blocks...
maybe fix that later.
Signed-off-by: NeilBrown <neilb@suse.de>
* wait for any pending IO to complete (so page can be freed)
*/
for (i = 0; i < (1<<bits); i++) {
+ if (b_start >= offset &&
+ test_and_clear_bit(B_Async, &b[i].b.flags))
+ putdref(&b[i], MKREF(Async));
+
if (LAFSI(ino)->type >= TypeBase && start >= size)
/* Remove block from mapping and file */
lafs_erase_dblock(&b[i]);
while ((b = lafs_get_flushable(fs, oldphase)) != NULL) {
int unlock = 1;
dprintk("Checkpoint Block %s\n", strblk(b));
- /* FIXME I should check for Async children and
- * de-async them.
- */
+
+ if (test_and_clear_bit(B_Async, &b->flags)) {
+ /* this shouldn't normally happen, but
+ * it is possible, so check anyway
+ */
+ putref(b, MKREF(async));
+ lafs_wake_thread(fs);
+ }
if (!!test_bit(B_Phase1, &b->flags) != oldphase)
/* lafs_pin_dblock flipped phase for us */;
set_bit(I_Destroyed, &LAFSI(inode)->iflags);
putdref(db, MKREF(destroy));
} else {
+ spin_lock(&inode->i_data.private_lock);
+ if (LAFSI(inode)->iblock)
+ LAFS_BUG(atomic_read(&LAFSI(inode)->iblock->b.refcnt),
+ &LAFSI(inode)->iblock->b);
+ /* FIXME could there be Async blocks keeps a refcount?
+ * we should free them
+ */
+ spin_unlock(&inode->i_data.private_lock);
lafs_release_index(&LAFSI(inode)->free_index);
call_rcu(&LAFSI(inode)->md.rcu,
kfree_inode);