| # apebs = # wlar, buf0 = buf, ebae = vols[v][vtblpnum2], vtblpnum = vtblpnum4, vtblpnum0 = EB_PAGE_SIZE, vtblpnum1 = vtblpnum5, vtblpnum2 = vtblpnum3, vtblpnum3 < # avols[v], vtblpnum2 < # vols[v], abs(avols, apebs, vols, q), bflipset-cons(bflipset, wlar), ebm-cons(avols), is-aligned(vtblpnum5, EB_PAGE_SIZE), is-aligned(n, EB_PAGE_SIZE), is-aligned(vtblpnum1, EB_PAGE_SIZE), ubi-io-inv(apebs), unique-sqns(apebs), valid-ebatbl(apebs, wlar, vols, vtblpnum4), valid-eraseq(q), valid-eraseq(wlar, q), valid-eraseq(apebs, q), valid-global-sqn(apebs, sqnum), valid-vtbl(apebs, vols, wlar, vtblpnum4), valid-wl(apebs, wlar), v ∈ avols, v ∈ vols, vtblpnum5 + n ≤ LEB_SIZE, n + n0 ≤ # buf, n0 + n ≤ # buf0, vtblpnum1 + n ≤ LEB_SIZE, avols[v][vtblpnum3].mapped? → avols[v][vtblpnum3].fill ≤ vtblpnum5, v ∈ vols → v ∈ vols ∧ ( vtblpnum2 < # vols[v] → vtblpnum1 + n ≤ LEB_SIZE → n0 + n ≤ # buf0 → is-aligned(n, EB_PAGE_SIZE) → is-aligned(vtblpnum1, EB_PAGE_SIZE) → (vtblpnum2 < # vols[v] ∧ v ∈ vols) ∧ ( vols[v][vtblpnum2] ≠ unmapped → vols[v][vtblpnum2].pnum < # apebs ∧ vols[v][vtblpnum2] ≠ unmapped ∧ vtblpnum2 < # vols[v] ∧ v ∈ vols)), vols[v][vtblpnum2] ≠ unmapped → apebs[vols[v][vtblpnum2].pnum].fill ≤ vtblpnum1 ⊦ ⟪aubi_io_write_data#(ebae.pnum, vtblpnum1, n0, n, buf0; apebs; err); if err ≠ ESUCCESS then {debug#("ubi: failed to write to PEB " + ebae.pnum.toString); let buf = mkbuf(vtblpnum1 + n), bitflips = ? in {aubi_io_read_data#(ebae.pnum, 0, 0, vtblpnum1, apebs; buf; bitflips, err); if err = ESUCCESS then {buf := copy(buf0, n0, buf, vtblpnum1, n); debug#("ubi: moving data from PEB " + ebae.pnum.toString); ubi_change#(v, vtblpnum2, vtblpnum1 + n, buf, vtblpnum0; vols, wlar, q, bflipset, vtblpnum, sqnum, apebs; err)} else debug#("ubi: failed to read data from PEB " + ebae.pnum.toString)}}⟫ ⟨ebm_write#(v, vtblpnum3, vtblpnum5, n0, n, buf; avols; err0)⟩ (abs(avols, apebs, vols, q) ∧ err = err0), ebae = unmapped, n = 0, VTBL_VOLID ∈ vols |
# apebs = # wlar, vols[v][vtblpnum3] = ⌜n1⌝ , n ≠ 0, avols[v][vtblpnum3].mapped?, vtblpnum3 < # vols[v], vtblpnum3 < # avols[v], n1 < # wlar, abs(avols, apebs, vols, q), bflipset-cons(bflipset, wlar), ebm-cons(avols), is-aligned(n, EB_PAGE_SIZE), is-aligned(vtblpnum5, EB_PAGE_SIZE), ubi-io-inv(apebs), unique-sqns(apebs), valid-ebatbl(apebs, wlar, vols, vtblpnum4), valid-eraseq(apebs, q), valid-eraseq(wlar, q), valid-eraseq(q), valid-global-sqn(apebs, sqnum), valid-vtbl(apebs, vols, wlar, vtblpnum4), valid-wl(apebs, wlar), v ∈ vols, v ∈ avols, avols[v][vtblpnum3].fill ≤ vtblpnum5, n0 + n ≤ # buf, n + n0 ≤ # buf, vtblpnum5 + n ≤ LEB_SIZE, apebs[n1].fill ≤ vtblpnum5, ¬ VTBL_VOLID ∈ vols ⊦ ⟪aubi_io_write_data#(vols[v][vtblpnum3].pnum, vtblpnum5, n0, n, buf; apebs; err); if err ≠ ESUCCESS then {debug#("ubi: failed to write to PEB " + vols[v][vtblpnum3].pnum.toString); let buf1 = mkbuf(vtblpnum5 + n), bitflips = ? in {aubi_io_read_data#(vols[v][vtblpnum3].pnum, 0, 0, vtblpnum5, apebs; buf1; bitflips, err); if err = ESUCCESS then {buf1 := copy(buf, n0, buf1, vtblpnum5, n); debug#("ubi: moving data from PEB " + vols[v][vtblpnum3].pnum.toString); ubi_change#(v, vtblpnum3, vtblpnum5 + n, buf1, EB_PAGE_SIZE; vols, wlar, q, bflipset, vtblpnum4, sqnum, apebs; err)} else debug#("ubi: failed to read data from PEB " + vols[v][vtblpnum3].pnum.toString)}}⟫ ⟨ebm_write#(v, vtblpnum3, vtblpnum5, n0, n, buf; avols; err0)⟩ (abs(avols, apebs, vols, q) ∧ err = err0)
Used simplifier rules: lf-elim-unmapped: ⊦ vols[v][m] ≠ unmapped → (∃ n. vols[v][m] = ⌜n⌝ );%lf-mapped-in-apebs: ⊦ v ∈ vols ∧ m < # vols[v] ∧ vols[v][m] = ⌜n⌝ ∧ valid-ebatbl(apebs, wlar, vols, n0) → n < # apebs;% ⊦ ⌜m⌝ .pnum = m; (s)% ⊦ unmapped ≠ ⌜m⌝ ; (s)%abs-vols-mapped: ⊦ v ∈ vols ∧ m < # vols[v] ∧ vols[v][m] = ⌜n⌝ ∧ abs(avols, apebs, vols, q) → avols[v][m].mapped?; (forward) from specification ubi-abs% ⊦ m < n → n ≠ 0; (s)%lf-01: ⊦ m < n ∧ n = n0 → m < n0; (forward) from specification nat-basic%f: ⊦ m < n → n ≠ 0; (forward) from specification nat-basic%c: ⊦ m + n = n + m; from specification nat-basic%⊦ v ∈ avols ∧ m < # avols[v] ∧ abs(avols, apebs, vols, q) → m < # vols[v]; (ss)% ⊦ v ∈ avols ∧ abs(avols, apebs, vols, q) → v ∈ vols; (ss)