if (nothing_to_commit(c)) {
up_write(&c->commit_sem);
err = 0; goto out_cancel;
}
/* Sync all write buffers (necessary for recovery) */ for (i = 0; i < c->jhead_cnt; i++) {
err = ubifs_wbuf_sync(&c->jheads[i].wbuf); if (err) goto out_up;
}
c->cmt_no += 1;
err = ubifs_gc_start_commit(c); if (err) goto out_up;
err = dbg_check_lprops(c); if (err) goto out_up;
err = ubifs_log_start_commit(c, &new_ltail_lnum); if (err) goto out_up;
err = ubifs_tnc_start_commit(c, &zroot); if (err) goto out_up;
err = ubifs_lpt_start_commit(c); if (err) goto out_up;
err = ubifs_orphan_start_commit(c); if (err) goto out_up;
ubifs_get_lp_stats(c, &lst);
up_write(&c->commit_sem);
err = ubifs_tnc_end_commit(c); if (err) goto out;
err = ubifs_lpt_end_commit(c); if (err) goto out;
err = ubifs_orphan_end_commit(c); if (err) goto out;
err = dbg_check_old_index(c, &zroot); if (err) goto out;
set_current_state(TASK_INTERRUPTIBLE); /* Check if there is something to do */ if (!c->need_bgt) { /* *Nothingpreventsusfromgoingsleepnowand *beneverwokenupandblockthetaskwhich *couldwaitin'kthread_stop()'forever.
*/ if (kthread_should_stop()) break;
schedule(); continue;
} else
__set_current_state(TASK_RUNNING);
c->need_bgt = 0;
err = ubifs_bg_wbufs_sync(c); if (err)
ubifs_ro_mode(c, err);
/* Start at the old zroot */
lnum = d->old_zroot.lnum;
offs = d->old_zroot.offs;
len = d->old_zroot.len;
iip = 0;
/* *Traversetheindextreepreorderdepth-firsti.e.doanodeandthen *itssubtreesfromlefttoright.
*/ while (1) { struct ubifs_branch *br;
/* Get the next index node */
i = kmalloc(sz, GFP_NOFS); if (!i) {
err = -ENOMEM; goto out_free;
}
i->iip = iip; /* Keep the index nodes on our path in a linked list */
list_add_tail(&i->list, &list); /* Read the index node */
idx = &i->idx;
err = ubifs_read_node(c, idx, UBIFS_IDX_NODE, len, lnum, offs); if (err) goto out_free; /* Validate index node */
child_cnt = le16_to_cpu(idx->child_cnt); if (child_cnt < 1 || child_cnt > c->fanout) {
err = 1; goto out_dump;
} if (first) {
first = 0; /* Check root level and sqnum */ if (le16_to_cpu(idx->level) != d->old_zroot_level) {
err = 2; goto out_dump;
} if (le64_to_cpu(idx->ch.sqnum) != d->old_zroot_sqnum) {
err = 3; goto out_dump;
} /* Set last values as though root had a parent */
last_level = le16_to_cpu(idx->level) + 1;
last_sqnum = le64_to_cpu(idx->ch.sqnum) + 1;
key_read(c, ubifs_idx_key(c, idx), &lower_key);
highest_ino_key(c, &upper_key, INUM_WATERMARK);
}
key_copy(c, &upper_key, &i->upper_key); if (le16_to_cpu(idx->level) != last_level - 1) {
err = 3; goto out_dump;
} /* *Theindexisalwayswrittenbottomuphenceachild'ssqnum *isalwayslessthantheparents.
*/ if (le64_to_cpu(idx->ch.sqnum) >= last_sqnum) {
err = 4; goto out_dump;
} /* Check key range */
key_read(c, ubifs_idx_key(c, idx), &l_key);
br = ubifs_idx_branch(c, idx, child_cnt - 1);
key_read(c, &br->key, &u_key); if (keys_cmp(c, &lower_key, &l_key) > 0) {
err = 5; goto out_dump;
} if (keys_cmp(c, &upper_key, &u_key) < 0) {
err = 6; goto out_dump;
} if (keys_cmp(c, &upper_key, &u_key) == 0) if (!is_hash_key(c, &u_key)) {
err = 7; goto out_dump;
} /* Go to next index node */ if (le16_to_cpu(idx->level) == 0) { /* At the bottom, so go up until can go right */ while (1) { /* Drop the bottom of the list */
list_del(&i->list);
kfree(i); /* No more list means we are done */ if (list_empty(&list)) goto out; /* Look at the new bottom */
i = list_entry(list.prev, struct idx_node,
list);
idx = &i->idx; /* Can we go right */ if (iip + 1 < le16_to_cpu(idx->child_cnt)) {
iip = iip + 1; break;
} else /* Nope, so go up again */
iip = i->iip;
}
} else /* Go down left */
iip = 0; /* *Wehavetheparentin'idx'andnowwesetupforreadingthe *childpointedtobyslot'iip'.
*/
last_level = le16_to_cpu(idx->level);
last_sqnum = le64_to_cpu(idx->ch.sqnum);
br = ubifs_idx_branch(c, idx, iip);
lnum = le32_to_cpu(br->lnum);
offs = le32_to_cpu(br->offs);
len = le32_to_cpu(br->len);
key_read(c, &br->key, &lower_key); if (iip + 1 < le16_to_cpu(idx->child_cnt)) {
br = ubifs_idx_branch(c, idx, iip + 1);
key_read(c, &br->key, &upper_key);
} else
key_copy(c, &i->upper_key, &upper_key);
}
out:
err = dbg_old_index_check_init(c, zroot); if (err) goto out_free;
return0;
out_dump:
ubifs_err(c, "dumping index node (iip=%d)", i->iip);
ubifs_dump_node(c, idx, ubifs_idx_node_sz(c, c->fanout));
list_del(&i->list);
kfree(i); if (!list_empty(&list)) {
i = list_entry(list.prev, struct idx_node, list);
ubifs_err(c, "dumping parent index node");
ubifs_dump_node(c, &i->idx, ubifs_idx_node_sz(c, c->fanout));
}
out_free: while (!list_empty(&list)) {
i = list_entry(list.next, struct idx_node, list);
list_del(&i->list);
kfree(i);
}
ubifs_err(c, "failed, error %d", err); if (err > 0)
err = -EINVAL; return err;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.24 Sekunden
(vorverarbeitet am 2026-09-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.