| # buf = VFS_PAGE_SIZE, asynced0 ↔ asynced5, cache_pcache[datakey(m, m2 / VFS_PAGE_SIZE)] = mkpentry(boolvar, buf), cache_files[m] = mkfile(m1, md2, # links(m, cache_dirs), content1), ((cache_files ⊕ cache_pcache) ⊕ cache_icache)[m] = mkfile(m0, md0, # links(m, cache_dirs), content), afs_files = (cache_files ⊕ cache_pcache) ⊕ cache_icache, buf-opt = some(buf), dirs = cache_dirs, err = ESUCCESS, files = cache_files, inode = mkinode(m, md, false, # links(m, cache_dirs), 0, m2), old_ino = 0, pageno = m2 / VFS_PAGE_SIZE, size = 0, afs-cons(cache_dirs, cache_files), afs-cons(cache_dirs, (cache_files ⊕ cache_pcache) ⊕ cache_icache), dcache-cons(cache_dcache, cache_dirs, cache_files), icache-cons(cache_icache, cache_dirs, cache_files), pcache-cons(cache_pcache, cache_dirs, cache_files), synced(cache_dirs, cache_icache, cache_pcache), m ∈ cache_files, datakey(m, m2 / VFS_PAGE_SIZE) ∈ cache_pcache, cache_sync → synced(cache_files, cache_icache, cache_pcache) ⊦ ⟪ let ino = inode.ino, content = files[inode.ino].content, buf = ? in {old_ino := inode.size % VFS_PAGE_SIZE, size := min(n, inode.size); asynced0 := inode.size ≤ n ∧ old_ino ≠ 0 ∧ (pageno ∈ content ∨ buf-opt.some?); if asynced0 then {if buf-opt.some? then buf := buf-opt.buf else buf := files[ino].content[pageno]; buf := fill(buf, zero, old_ino, VFS_PAGE_SIZE - old_ino); content[pageno] := buf; buf-opt := some(buf)}; files[ino].content := content upto size; let new_inode = inode in {new_inode.size := n; afs_inode_sync#(new_inode; dirs, files)}; inode := getinode(inode.ino, dirs, files); err := ESUCCESS} or fail#(; ; err); asynced := ?; asynced1 := asynced0; if err = ESUCCESS then let asynced0 = false in {icache_set#(inode, asynced0; err, cache_icache); pcache_truncate#(inode.ino, m2, n; err, cache_pcache); if asynced1 then pcache_set#(inode.ino, m2 / VFS_PAGE_SIZE, buf-opt.buf, asynced0; err, cache_pcache)}; if ¬ asynced1 ∨ err ≠ ESUCCESS then buf-opt := none⟫ ⟨buf-opt0 := none; inode0 := mkinode(m, md, false, # links(m, cache_dirs), 0, m2); afs_truncate#(n, m2 / VFS_PAGE_SIZE; buf-opt0, inode0, asynced5, err0, cache_dirs, afs_files, cache_asynced)⟩ ( cache_dirs = dirs ∧ afs_files = (files ⊕ cache_pcache) ⊕ cache_icache ∧ (cache_asynced ↔ asynced) ∧ buf-opt = buf-opt0 ∧ inode = inode0 ∧ (asynced1 ↔ asynced5) ∧ err = err0), VFS_PAGE_SIZE = 0 |
# buf = VFS_PAGE_SIZE, asynced0 ↔ asynced5, ((cache_files ⊕ cache_pcache) ⊕ cache_icache)[m] = mkfile(m0, md0, # links(m, cache_dirs), content), cache_files[m] = mkfile(m1, md2, # links(m, cache_dirs), content1), cache_pcache[datakey(m, m2 / VFS_PAGE_SIZE)] = mkpentry(boolvar, buf), afs_files = (cache_files ⊕ cache_pcache) ⊕ cache_icache, buf-opt = some(buf), dirs = cache_dirs, err = ESUCCESS, files = cache_files, inode = mkinode(m, md, false, # links(m, cache_dirs), 0, m2), old_ino = 0, pageno = m2 / VFS_PAGE_SIZE, size = 0, afs-cons(cache_dirs, (cache_files ⊕ cache_pcache) ⊕ cache_icache), afs-cons(cache_dirs, cache_files), dcache-cons(cache_dcache, cache_dirs, cache_files), icache-cons(cache_icache, cache_dirs, cache_files), pcache-cons(cache_pcache, cache_dirs, cache_files), synced(cache_dirs, cache_icache, cache_pcache), datakey(m, m2 / VFS_PAGE_SIZE) ∈ cache_pcache, m ∈ cache_files, cache_sync → synced(cache_files, cache_icache, cache_pcache) ⊦ ⟪let ino = inode.ino, content = files[inode.ino].content, buf = ? in {old_ino := inode.size % VFS_PAGE_SIZE, size := min(n, inode.size); asynced0 := inode.size ≤ n ∧ old_ino ≠ 0 ∧ (pageno ∈ content ∨ buf-opt.some?); if asynced0 then {if buf-opt.some? then buf := buf-opt.buf else buf := files[ino].content[pageno]; buf := fill(buf, zero, old_ino, VFS_PAGE_SIZE - old_ino); content[pageno] := buf; buf-opt := some(buf)}; files[ino].content := content upto size; let new_inode = inode in {new_inode.size := n; afs_inode_sync#(new_inode; dirs, files)}; inode := getinode(inode.ino, dirs, files); err := ESUCCESS}; asynced := ?; asynced1 := asynced0; if err = ESUCCESS then let asynced0 = false in {icache_set#(inode, asynced0; err, cache_icache); pcache_truncate#(inode.ino, m2, n; err, cache_pcache); if asynced1 then pcache_set#(inode.ino, m2 / VFS_PAGE_SIZE, buf-opt.buf, asynced0; err, cache_pcache)}; if ¬ asynced1 ∨ err ≠ ESUCCESS then buf-opt := none⟫ ⟨buf-opt0 := none; inode0 := mkinode(m, md, false, # links(m, cache_dirs), 0, m2); afs_truncate#(n, m2 / VFS_PAGE_SIZE; buf-opt0, inode0, asynced5, err0, cache_dirs, afs_files, cache_asynced)⟩ ( cache_dirs = dirs ∧ afs_files = (files ⊕ cache_pcache) ⊕ cache_icache ∧ (cache_asynced ↔ asynced) ∧ buf-opt = buf-opt0 ∧ inode = inode0 ∧ (asynced1 ↔ asynced5) ∧ err = err0), VFS_PAGE_SIZE = 0
# buf = VFS_PAGE_SIZE, asynced0 ↔ asynced5, ((cache_files ⊕ cache_pcache) ⊕ cache_icache)[m] = mkfile(m0, md0, # links(m, cache_dirs), content), cache_files[m] = mkfile(m1, md2, # links(m, cache_dirs), content1), cache_pcache[datakey(m, m2 / VFS_PAGE_SIZE)] = mkpentry(boolvar, buf), afs_files = (cache_files ⊕ cache_pcache) ⊕ cache_icache, buf-opt = some(buf), dirs = cache_dirs, err = ESUCCESS, files = cache_files, inode = mkinode(m, md, false, # links(m, cache_dirs), 0, m2), old_ino = 0, pageno = m2 / VFS_PAGE_SIZE, size = 0, afs-cons(cache_dirs, (cache_files ⊕ cache_pcache) ⊕ cache_icache), afs-cons(cache_dirs, cache_files), dcache-cons(cache_dcache, cache_dirs, cache_files), icache-cons(cache_icache, cache_dirs, cache_files), pcache-cons(cache_pcache, cache_dirs, cache_files), synced(cache_dirs, cache_icache, cache_pcache), datakey(m, m2 / VFS_PAGE_SIZE) ∈ cache_pcache, m ∈ cache_files, cache_sync → synced(cache_files, cache_icache, cache_pcache) ⊦ ⟪fail#(; ; err); asynced := ?; asynced1 := asynced0; if err = ESUCCESS then let asynced0 = false in {icache_set#(inode, asynced0; err, cache_icache); pcache_truncate#(inode.ino, m2, n; err, cache_pcache); if asynced1 then pcache_set#(inode.ino, m2 / VFS_PAGE_SIZE, buf-opt.buf, asynced0; err, cache_pcache)}; if ¬ asynced1 ∨ err ≠ ESUCCESS then buf-opt := none⟫ ⟨buf-opt0 := none; inode0 := mkinode(m, md, false, # links(m, cache_dirs), 0, m2); afs_truncate#(n, m2 / VFS_PAGE_SIZE; buf-opt0, inode0, asynced5, err0, cache_dirs, afs_files, cache_asynced)⟩ ( cache_dirs = dirs ∧ afs_files = (files ⊕ cache_pcache) ⊕ cache_icache ∧ (cache_asynced ↔ asynced) ∧ buf-opt = buf-opt0 ∧ inode = inode0 ∧ (asynced1 ↔ asynced5) ∧ err = err0), VFS_PAGE_SIZE = 0