if (b->parent) {
struct lafs_iblk *p = b->parent;
- trace(2,"ds %d/%lld %d\n", p->b.ino->inum, (long long)p->b.fileaddr,
+ trace(2,"desched %d/%lld %d/%lld %d\n", b->ino->inum, (long long)b->fileaddr, p->b.ino->inum, (long long)p->b.fileaddr,
p->sched_cnt);
p->sched_cnt--;
if (p->sched_cnt == 0)
b = list_first_entry(&fs->leafs,
struct lafs_blk,
leafs);
- trace(1, "checkpoint %p %d/%lld %s %p\n", b, b->ino->inum,
+ trace(1, "checkpoint %p %d/%lld %s-%d %p\n", b, b->ino->inum,
(long long)b->fileaddr,
- (b->flags & B_Index) ? "index":"data", b->parent);
+ (b->flags & B_Index) ? "index":"data",
+ (b->flags & B_Index) ? iblk(b)->sched_cnt:0,
+ b->parent);
list_del_init(&b->leafs);
if (!(b->flags & B_Index)) {
struct lafs_dblk *db = dblk(b);
if (b->ino->type == TypeSegmentMap) {
- /* Allow parents to be processed, but freeze this */
+ /* Allow parents to be processed,
+ * but freeze this */
de_sched(b); b->flags |= B_Sched;
list_add(&b->leafs, &fs->account_leafs);
continue;
if (b->ino->type == TypeInodeFile &&
db->my_inode &&
db->my_inode->iblock &&
- db->my_inode->iblock->sched_cnt) {
- de_sched(b);
+ db->my_inode->iblock->sched_cnt)
+ /* Wait for InoIdx block to be ready */
continue;
- }
}
if (b->flags & B_Index) {
struct lafs_iblk *ib = iblk(b);
- if (ib->sched_cnt) {
- de_sched(b);
+ if (ib->sched_cnt)
+ /* Not ready yet, leave it off the list */
continue;
- }
+
if (ib->uninc) {
- de_sched(b);
lafs_incorporate(ib);
- if (!(ib->b.flags & B_Sched))
+ if (list_empty(&ib->b.leafs))
abort();
/* We'll pick it up next time 'round */
continue;
}
+ if (b->flags & B_InoIdx) {
+ /* InoIdx block is ready, so process
+ * the data block.
+ */
+ de_sched(b);
+ b->flags &= ~B_Dirty;
+ b = &b->ino->dblock->b;
+ b->flags |= B_Dirty;
+ }
}
if (b->flags & B_Dirty) {
trace(2, "...alloc\n");
struct lafs *fs = blk->ino->fs;
blk->flags |= B_Dirty;
- if (blk->flags & B_Sched)
+ if (blk->flags & B_Sched) {
+ if (list_empty(&blk->leafs))
+ list_add_tail(&blk->leafs, &fs->leafs);
return 0;
+ }
if (!(blk->flags & B_Index)) {
struct lafs_dblk *dblk = container_of(blk, struct lafs_dblk, b);
return -1;
}
blk->flags |= B_Sched;
- if (blk->parent)
+ if (blk->parent) {
blk->parent->sched_cnt++;
- trace(1, "schedule %p\n", blk);
+ trace(1, "schedule %d/%d %d/%d %d\n", blk->ino->inum, (int)blk->fileaddr,
+ blk->parent->b.ino->inum, (int)blk->parent->b.fileaddr,
+ blk->parent->sched_cnt);
+ } else
+ trace(1, "schedule %d/%d\n", blk->ino->inum, (int)blk->fileaddr);
list_move_tail(&blk->leafs, &fs->leafs);
return 0;
}