| VFS_PAGE_SIZE = n7 + (n0 + n6) % VFS_PAGE_SIZE, files[m] = mkfile(m1, md0, # links(m, dirs), content), buf = mkbuf(VFS_PAGE_SIZE), err = ESUCCESS, inode = mkinode(m, md, false, # links(m, dirs), 0, m2), pageno = (n0 + n6) / VFS_PAGE_SIZE, afs-cons(dirs, files), m ∈ files, n5 + n6 ≤ # buf1, n6 ≤ # buf1, ∀ n2, n3, n4, files, m, m1, md0, dirs, content, inode, md, m2, isdir, buf, err, asynced. n2 - n3 + n4 < n5 → files[m] = mkfile(m1, md0, # links(m, dirs), content) ∧ inode = mkinode(m, md, false, # links(m, dirs), 0, m2) ∧ ¬ isdir ∧ afs-cons(dirs, files) ∧ m ∈ files ∧ n4 ≤ # buf ∧ n3 + n4 ≤ n2 ∧ n2 ≤ # buf + n3 → ⟪while err = ESUCCESS ∧ ¬ isdir do vfs_write_block#(n3, inode, buf, n2, dirs; n4, isdir, err, files, asynced)⟫ (m ∈ files ∧ # links(m, dirs) = files[m].nlink) ⊦ ⟪if pre-readpage(inode, pageno, buf, dirs, files) then { {if pageno ∈ files[inode.ino].content then buf := files[inode.ino].content[pageno] else buf := zeropage; err := ESUCCESS} or fail#(; ; err)} else abort; if err = ESUCCESS then afs_check_commit#(dirs, files; err; asynced); if err = ESUCCESS then {buf := copy(buf1, n6, buf, (n0 + n6) % VFS_PAGE_SIZE, min(n5 + n0 + n6 - n0 + n6, n7)); afs_writepage#(mkinode(m, md, false, # links(m, dirs), 0, m2), (n0 + n6) / VFS_PAGE_SIZE, buf, dirs; err, files; asynced)}; n := min(n5 + n0 + n6 - n0 + n6, n7); ino0 := n6; if err = ESUCCESS then ino0 := ino0 + n; inode := mkinode(m, md, false, # links(m, dirs), 0, m2); n := ino0; n1 := n5 + n0 + n6; isdir := false; while err = ESUCCESS ∧ ¬ isdir do vfs_write_block#(n0, inode, buf1, n1, dirs; n, isdir, err, files, asynced)⟫ (m ∈ files ∧ # links(m, dirs) = files[m].nlink), VFS_PAGE_SIZE = 0, min(n5, n7) = 0 |
VFS_PAGE_SIZE = n7 + (n0 + n6) % VFS_PAGE_SIZE, files[m] = mkfile(m1, md0, # links(m, dirs), content), buf = mkbuf(VFS_PAGE_SIZE), err = ESUCCESS, inode = mkinode(m, md, false, # links(m, dirs), 0, m2), pageno = (n0 + n6) / VFS_PAGE_SIZE, afs-cons(dirs, files), m ∈ files, n6 ≤ # buf1, n5 + n6 ≤ # buf1, ∀ n2, n3, n4, files, m, m1, md0, dirs, content, inode, md, m2, isdir, buf, err, asynced. n2 - n3 + n4 < n5 → files[m] = mkfile(m1, md0, # links(m, dirs), content) ∧ inode = mkinode(m, md, false, # links(m, dirs), 0, m2) ∧ ¬ isdir ∧ afs-cons(dirs, files) ∧ m ∈ files ∧ n4 ≤ # buf ∧ n3 + n4 ≤ n2 ∧ n2 ≤ # buf + n3 → ⟪while err = ESUCCESS ∧ ¬ isdir do vfs_write_block#(n3, inode, buf, n2, dirs; n4, isdir, err, files, asynced)⟫ (m ∈ files ∧ # links(m, dirs) = files[m].nlink) ⊦ ⟪{if pageno ∈ files[inode.ino].content then buf := files[inode.ino].content[pageno] else buf := zeropage; err := ESUCCESS} or fail#(; ; err); if err = ESUCCESS then afs_check_commit#(dirs, files; err; asynced); if err = ESUCCESS then {buf := copy(buf1, n6, buf, (n0 + n6) % VFS_PAGE_SIZE, min(n5 + n0 + n6 - n0 + n6, n7)); afs_writepage#(mkinode(m, md, false, # links(m, dirs), 0, m2), (n0 + n6) / VFS_PAGE_SIZE, buf, dirs; err, files; asynced)}; n := min(n5 + n0 + n6 - n0 + n6, n7); ino0 := n6; if err = ESUCCESS then ino0 := ino0 + n; inode := mkinode(m, md, false, # links(m, dirs), 0, m2); n := ino0; n1 := n5 + n0 + n6; isdir := false; while err = ESUCCESS ∧ ¬ isdir do vfs_write_block#(n0, inode, buf1, n1, dirs; n, isdir, err, files, asynced)⟫ (m ∈ files ∧ # links(m, dirs) = files[m].nlink), VFS_PAGE_SIZE = 0, min(n5, n7) = 0
Used simplifier rules: ⊦ pre-readpage(inode, n, buf, dirs, files) ↔ valid-file-ino(inode.ino, dirs, files) ∧ # buf = VFS_PAGE_SIZE; (s)% ⊦ mkinode(m, md, boolvar, m0, m1, m2).ino = m; (s)% ⊦ valid-file-ino(ino, dirs, files) ↔ ino ∈ files; (s)% ⊦ # mkbuf(n) = n; (s)