| # lpt0 = # lpt, # buf3 = lptsize(# lpt, LEB_SIZE), (5 + 2 * lptlebs(# lpt, LEB_SIZE)) + # lpt = # avol0, avol0[2] = mapped(buf1), avol0[4] = mapped(buf0), avol0[0] = mapped(buf2), avol1 = avol0[1, mapped(mkbuf(0))][3, mapped(buf)], 3 < # avol0, ebm-vol-inv(avol0[1, mapped(mkbuf(0))][3, mapped(buf)]), ebm-vol-inv(avol0), ebm-vol-inv(avol0[1, mapped(mkbuf(0))]), is-encoded(mksb(adr0, m2, 2, 4, m6, 5 + lptlebs(# lpt, LEB_SIZE), 5 + 2 * lptlebs(# lpt, LEB_SIZE)), buf2), is-encoded(lpt0, lebs(avol0, 5 + lptlebs(# lpt, LEB_SIZE), lptlebs(# lpt, LEB_SIZE))), is-encoded(log, buf1), is-encoded(lpt, buf3), is-encoded-pad(orphans, # orphans, buf), is-encoded-pad(orphans0, m6, buf0), mapped-full?(avol0, 5 + lptlebs(# lpt, LEB_SIZE), lptlebs(# lpt, LEB_SIZE)), 5 + 2 * lptlebs(# lpt, LEB_SIZE) ≤ # avol0, logoff ≠ LEB_SIZE → # buf1 = logoff ⊦ ⟪persistence_io_write_lebs#(5, lptlebs(# lpt, LEB_SIZE), buf3, LEB_SIZE; avol1; err); if err = ESUCCESS then ebm_avol_sync_device#(avol1; ; err); sb1 := mksb(adr, m3, 1, 3, # orphans, 5, 5 + 2 * lptlebs(# lpt, LEB_SIZE)); if err = ESUCCESS then persistence_io_write_superblock#(sb1, EB_PAGE_SIZE, LEB_SIZE; avol1; err); sb0 := mksb(adr0, m2, 2, 4, m6, 5 + lptlebs(# lpt, LEB_SIZE), 5 + 2 * lptlebs(# lpt, LEB_SIZE)); if err = ESUCCESS then {sb0 := sb1; logoff := 0}⟫ ( (∃ lpt1, log, orphans. disk-layout(sb0, # lpt1) ∧ sb0.main + # lpt1 = # avol1 ∧ avol1[0].mapped? ∧ is-encoded(sb0, avol1[0].data) ∧ avol1[sb0.orph].mapped? ∧ is-encoded-pad(orphans, sb0.orphsize, avol1[sb0.orph].data) ∧ avol1[sb0.log].mapped? ∧ (logoff ≠ LEB_SIZE → # avol1[sb0.log].data = logoff) ∧ is-encoded(log, avol1[sb0.log].data) ∧ mapped-full?(avol1, sb0.lpt, lptlebs(# lpt1, LEB_SIZE)) ∧ is-encoded(lpt1, lebs(avol1, sb0.lpt, lptlebs(# lpt1, LEB_SIZE)))) ∧ ebm-vol-inv(avol1) ∧ (err = ESUCCESS ∨ ⌊err⌋ ) ∧ ( err = ESUCCESS → sb0.indexaddr = adr ∧ sb0.maxino = m3 ∧ avol1[sb0.log].data = mkbuf(0) ∧ is-encoded(lpt, lebs(avol1, sb0.lpt, lptlebs(# avol1 - sb0.main, LEB_SIZE))) ∧ is-encoded-pad(orphans, sb0.orphsize, avol1[sb0.orph].data)) ∧ ( err ≠ ESUCCESS → sb0 = mksb(adr0, m2, 2, 4, m6, 5 + lptlebs(# lpt, LEB_SIZE), sb0.main) ∧ avol1[2] = avol0[2] ∧ avol1[4] = avol0[4] ∧ lebs(avol1, 5 + lptlebs(# lpt, LEB_SIZE), lptlebs(# avol1 - sb0.main, LEB_SIZE)) = lebs(avol0, 5 + lptlebs(# lpt, LEB_SIZE), lptlebs(# avol1 - sb0.main, LEB_SIZE))) ∧ sb0.main = 5 + 2 * lptlebs(# lpt, LEB_SIZE) ∧ # avol1 = # avol0 ∧ subarray(avol1, sb0.main, # avol1 - sb0.main) = subarray(avol0, sb0.main, # avol1 - sb0.main)) |
ebm-vol-inv(avol), n + m ≤ # avol, # buf = m * LEB_SIZE, avol0 = avol ⊦ ⟪persistence_io_write_lebs#(n, m, buf, LEB_SIZE; avol; err)⟫ ( (err = ESUCCESS ∨ ⌊err⌋ ) ∧ # avol = # avol0 ∧ ebm-vol-inv(avol) ∧ range=(avol, 0, avol0, 0, n) ∧ range=(avol, n + m, avol0, n + m, # avol - n + m) ∧ (err = ESUCCESS → lebs(avol, n, m) = buf ∧ mapped-full?(avol, n, m)))
# buf3 = lptsize(# lpt, LEB_SIZE), # lpt0 = # lpt, (5 + 2 * lptlebs(# lpt, LEB_SIZE)) + # lpt = # avol0, avol0[0] = mapped(buf2), avol0[4] = mapped(buf0), avol0[2] = mapped(buf1), avol1 = avol0[1, mapped(mkbuf(0))][3, mapped(buf)], 3 < # avol0, ebm-vol-inv(avol0[1, mapped(mkbuf(0))]), ebm-vol-inv(avol0), ebm-vol-inv(avol0[1, mapped(mkbuf(0))][3, mapped(buf)]), is-encoded(lpt, buf3), is-encoded(log, buf1), is-encoded(lpt0, lebs(avol0, 5 + lptlebs(# lpt, LEB_SIZE), lptlebs(# lpt, LEB_SIZE))), is-encoded(mksb(adr0, m2, 2, 4, m6, 5 + lptlebs(# lpt, LEB_SIZE), 5 + 2 * lptlebs(# lpt, LEB_SIZE)), buf2), is-encoded-pad(orphans0, m6, buf0), is-encoded-pad(orphans, # orphans, buf), mapped-full?(avol0, 5 + lptlebs(# lpt, LEB_SIZE), lptlebs(# lpt, LEB_SIZE)), 5 + 2 * lptlebs(# lpt, LEB_SIZE) ≤ # avol0, logoff ≠ LEB_SIZE → # buf1 = logoff ⊦ ebm-vol-inv(avol1) ∧ 5 + lptlebs(# lpt, LEB_SIZE) ≤ # avol1 ∧ # buf3 = lptlebs(# lpt, LEB_SIZE) * LEB_SIZE ∧ avol1 = avol1
# buf3 = lptsize(# lpt, LEB_SIZE), # lpt0 = # lpt, # buf3 = lptlebs(# lpt, LEB_SIZE) * LEB_SIZE, (5 + 2 * lptlebs(# lpt, LEB_SIZE)) + # lpt = # avol0, avol0[0] = mapped(buf2), avol0[4] = mapped(buf0), avol0[2] = mapped(buf1), avol1 = avol0[1, mapped(mkbuf(0))][3, mapped(buf)], avol1 = avol1, avol2 = avol1, buf4 = buf3, m0 = lptlebs(# lpt, LEB_SIZE), n0 = 5, 3 < # avol0, ebm-vol-inv(avol0[1, mapped(mkbuf(0))]), ebm-vol-inv(avol0), ebm-vol-inv(avol0[1, mapped(mkbuf(0))][3, mapped(buf)]), ebm-vol-inv(avol1), is-encoded(lpt, buf3), is-encoded(log, buf1), is-encoded(lpt0, lebs(avol0, 5 + lptlebs(# lpt, LEB_SIZE), lptlebs(# lpt, LEB_SIZE))), is-encoded(mksb(adr0, m2, 2, 4, m6, 5 + lptlebs(# lpt, LEB_SIZE), 5 + 2 * lptlebs(# lpt, LEB_SIZE)), buf2), is-encoded-pad(orphans0, m6, buf0), is-encoded-pad(orphans, # orphans, buf), mapped-full?(avol0, 5 + lptlebs(# lpt, LEB_SIZE), lptlebs(# lpt, LEB_SIZE)), 5 + 2 * lptlebs(# lpt, LEB_SIZE) ≤ # avol0, 5 + lptlebs(# lpt, LEB_SIZE) ≤ # avol1, logoff ≠ LEB_SIZE → # buf1 = logoff ⊦ [persistence_io_write_lebs#(5, lptlebs(# lpt, LEB_SIZE), buf3, LEB_SIZE; avol1; err)] ( (err = ESUCCESS ∨ ⌊err⌋ ) ∧ # avol1 = # avol2 ∧ ebm-vol-inv(avol1) ∧ range=(avol1, 0, avol2, 0, n0) ∧ range=(avol1, n0 + m0, avol2, n0 + m0, # avol1 - n0 + m0) ∧ (err = ESUCCESS → lebs(avol1, n0, m0) = buf4 ∧ mapped-full?(avol1, n0, m0)) → ⟪if err = ESUCCESS then ebm_avol_sync_device#(avol1; ; err); sb1 := mksb(adr, m3, 1, 3, # orphans, 5, 5 + 2 * lptlebs(# lpt, LEB_SIZE)); if err = ESUCCESS then persistence_io_write_superblock#(sb1, EB_PAGE_SIZE, LEB_SIZE; avol1; err); sb0 := mksb(adr0, m2, 2, 4, m6, 5 + lptlebs(# lpt, LEB_SIZE), 5 + 2 * lptlebs(# lpt, LEB_SIZE)); if err = ESUCCESS then {sb0 := sb1; logoff := 0}⟫ ( (∃ lpt1, log, orphans. disk-layout(sb0, # lpt1) ∧ sb0.main + # lpt1 = # avol1 ∧ avol1[0].mapped? ∧ is-encoded(sb0, avol1[0].data) ∧ avol1[sb0.orph].mapped? ∧ is-encoded-pad(orphans, sb0.orphsize, avol1[sb0.orph].data) ∧ avol1[sb0.log].mapped? ∧ (logoff ≠ LEB_SIZE → # avol1[sb0.log].data = logoff) ∧ is-encoded(log, avol1[sb0.log].data) ∧ mapped-full?(avol1, sb0.lpt, lptlebs(# lpt1, LEB_SIZE)) ∧ is-encoded(lpt1, lebs(avol1, sb0.lpt, lptlebs(# lpt1, LEB_SIZE)))) ∧ ebm-vol-inv(avol1) ∧ (err = ESUCCESS ∨ ⌊err⌋ ) ∧ ( err = ESUCCESS → sb0.indexaddr = adr ∧ sb0.maxino = m3 ∧ avol1[sb0.log].data = mkbuf(0) ∧ is-encoded(lpt, lebs(avol1, sb0.lpt, lptlebs(# avol1 - sb0.main, LEB_SIZE))) ∧ is-encoded-pad(orphans, sb0.orphsize, avol1[sb0.orph].data)) ∧ ( err ≠ ESUCCESS → sb0 = mksb(adr0, m2, 2, 4, m6, 5 + lptlebs(# lpt, LEB_SIZE), sb0.main) ∧ avol1[2] = avol0[2] ∧ avol1[4] = avol0[4] ∧ lebs(avol1, 5 + lptlebs(# lpt, LEB_SIZE), lptlebs(# avol1 - sb0.main, LEB_SIZE)) = lebs(avol0, 5 + lptlebs(# lpt, LEB_SIZE), lptlebs(# avol1 - sb0.main, LEB_SIZE))) ∧ sb0.main = 5 + 2 * lptlebs(# lpt, LEB_SIZE) ∧ # avol1 = # avol0 ∧ subarray(avol1, sb0.main, # avol1 - sb0.main) = subarray(avol0, sb0.main, # avol1 - sb0.main)))