if (LAFSI(b->b.inode)->type != TypeSegmentMap) {
LAFS_BUG(!test_phase_locked(fs), &b->b);
lafs_iolock_written(&b->b);
+ /* If this block is already pinned in the previous
+ * phase, now it a good time to flip it - we know it has
+ * been written and we want to flip it before it
+ * can be dirtied.
+ */
+ if (blk == &b->b &&
+ 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);
+ set_bit(B_PinPending, &b->b.flags);
+ }
lafs_iounlock_block(&b->b);
}
* de-async them.
*/
- LAFS_BUG(!!test_bit(B_Phase1, &b->flags) != oldphase, b);
-
- if (test_bit(B_PinPending, &b->flags) &&
+ if (!!test_bit(B_Phase1, &b->flags) != oldphase)
+ /* lafs_pin_dblock flipped phase for us */;
+ else if (test_bit(B_PinPending, &b->flags) &&
!test_bit(B_Index, &b->flags) &&
(LAFSI(b->inode)->type == TypeSegmentMap ||
LAFSI(b->inode)->type == TypeQuota)) {