| # links(m, cache_dirs) = m4, # buf-opt0.buf = VFS_PAGE_SIZE, asynced1 ↔ asynced5, asynced0 ↔ inode.size ≤ n ∧ old_ino ≠ 0 ∧ (pageno ∈ content ∨ buf-opt.some?), 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), content0), afs_dirs = cache_dirs, afs_files = (cache_files ⊕ cache_pcache) ⊕ cache_icache, ¬ asynced0, buf-opt = buf-opt0, content = files[inode.ino].content, dirs = cache_dirs, err = ESUCCESS, files = cache_files, ino = inode.ino, inode = mkinode(m, md, false, # links(m, cache_dirs), 0, m2), new_inode = inode, old_ino = inode.size % VFS_PAGE_SIZE, old_ino0 = 0, pageno = m2 / VFS_PAGE_SIZE, size = min(n, inode.size), size0 = 0, buf-opt0.some?, 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), m ∈ cache_files, cache_sync → synced(cache_files, cache_icache, cache_pcache) ⊦ ⟪new_inode.size := n; files[ino].content := content upto size; afs_inode_sync#(new_inode; dirs, files); inode := getinode(inode.ino, dirs, files); err := ESUCCESS; asynced := ?; asynced4 := asynced0; if err = ESUCCESS then let asynced = false in {icache_set#(inode, asynced; err, cache_icache); pcache_truncate#(inode.ino, m2, n; err, cache_pcache); if asynced4 then pcache_set#(inode.ino, m2 / VFS_PAGE_SIZE, buf-opt.buf, asynced; err, cache_pcache)}; if (¬ asynced4 ∨ err ≠ ESUCCESS) ∧ ¬ buf-opt0.some? then buf-opt := none⟫ ⟨inode0 := mkinode(m, md, false, m4, 0, m2); afs_truncate#(n, m2 / VFS_PAGE_SIZE; buf-opt0, inode0, asynced5, err0, afs_dirs, afs_files, cache_asynced)⟩ ( afs_dirs = dirs ∧ afs_files = (files ⊕ cache_pcache) ⊕ cache_icache ∧ (cache_asynced ↔ asynced) ∧ buf-opt = buf-opt0 ∧ inode = inode0 ∧ (asynced4 ↔ asynced5) ∧ err = err0), VFS_PAGE_SIZE = 0 |
# buf-opt0.buf = VFS_PAGE_SIZE, # links(m, cache_dirs) = m4, asynced0 ↔ inode.size ≤ n ∧ old_ino ≠ 0 ∧ (pageno ∈ content ∨ buf-opt.some?), asynced1 ↔ asynced5, ((cache_files ⊕ cache_pcache) ⊕ cache_icache)[m] = mkfile(m0, md0, # links(m, cache_dirs), content0), cache_files[m] = mkfile(m1, md2, # links(m, cache_dirs), content1), afs_dirs = cache_dirs, afs_files = (cache_files ⊕ cache_pcache) ⊕ cache_icache, ¬ asynced0, buf-opt = buf-opt0, content = files[inode.ino].content, dirs = cache_dirs, err = ESUCCESS, files = cache_files, ino = inode.ino, inode = mkinode(m, md, false, # links(m, cache_dirs), 0, m2), new_inode = inode, old_ino = inode.size % VFS_PAGE_SIZE, old_ino0 = 0, pageno = m2 / VFS_PAGE_SIZE, size = min(n, inode.size), size0 = 0, buf-opt0.some?, 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, cache_sync → synced(cache_files, cache_icache, cache_pcache) ⊦ ⟪files[ino].content := content upto size; afs_inode_sync#(new_inode.size:= n; dirs, files); inode := getinode(inode.ino, dirs, files); err := ESUCCESS; asynced := ?; asynced4 := asynced0; if err = ESUCCESS then let asynced = false in {icache_set#(inode, asynced; err, cache_icache); pcache_truncate#(inode.ino, m2, n; err, cache_pcache); if asynced4 then pcache_set#(inode.ino, m2 / VFS_PAGE_SIZE, buf-opt.buf, asynced; err, cache_pcache)}; if (¬ asynced4 ∨ err ≠ ESUCCESS) ∧ ¬ buf-opt0.some? then buf-opt := none⟫ ⟨inode0 := mkinode(m, md, false, m4, 0, m2); afs_truncate#(n, m2 / VFS_PAGE_SIZE; buf-opt0, inode0, asynced5, err0, afs_dirs, afs_files, cache_asynced)⟩ ( afs_dirs = dirs ∧ afs_files = (files ⊕ cache_pcache) ⊕ cache_icache ∧ (cache_asynced ↔ asynced) ∧ buf-opt = buf-opt0 ∧ inode = inode0 ∧ (asynced4 ↔ asynced5) ∧ err = err0), VFS_PAGE_SIZE = 0