Commit 3470a1d5 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e6ce8953
......@@ -102,13 +102,13 @@ class Conn(object):
# _File represent isolated file view under Conn.
class _File(object):
# .wconn Conn
# .foid hex of ZBigFile root object ID
# .size size of this file
# .blksize block size of this file
# .headf file object of head/file
# .pinned {} blk -> rev that wcfs already sent us for this file
# .mmaps []_Mapping ↑blk_start mappings of this file
# .wconn Conn
# .foid hex of ZBigFile root object ID
# .blksize block size of this file
# .headf file object of head/file
# .headfsize head/file size is known to be at least headfsize (size ↑=)
# .pinned {} blk -> rev that wcfs already sent us for this file
# .mmaps []_Mapping ↑blk_start mappings of this file
pass
......@@ -250,7 +250,7 @@ def resync(wconn, at):
# XXX locking
for foid in wconn._filetab:
# XXX if file was has no mappings and was not used during whole prev
# XXX if file has no mappings and was not used during whole prev
# cycle - forget and stop watching it
_ = wconn._wlink.sendReq(context.background(), b"watch %s @%s" % (h(foid), h(at)))
if _ != "ok":
......@@ -258,6 +258,9 @@ def resync(wconn, at):
# XXX vvv -> errctx?
raise RuntimeError("resync @%s -> @%s: f<%s>: %s" % (h(wconn.at), h(at), h(foid), _))
# XXX update f.headfsize
# XXX remmap appended data after old f.headfsize
wconn.at = at
......@@ -277,8 +280,8 @@ def mmap(wconn, foid, blk_start, blk_len): # -> Mapping
f.mmaps = []
_ = os.fstat(f.headf.fileno())
f.size = _.st_size
f.blksize = _.st_blksize
f.headfsize = _.st_size
wconn._filetab[foid] = f
......@@ -295,7 +298,7 @@ def mmap(wconn, foid, blk_start, blk_len): # -> Mapping
# mmap-in zeros after f.size (else access to memory after file.size will raise SIGBUS)
start = blk_start*f.blksize
mem = mm.map_ro(f.headf.fileno(), start, blk_len*f.blksize)
zmemtail = mem[max(f.size, start) - start:]
zmemtail = mem[max(f.headfsize, start) - start:]
if len(zmemtail) != 0:
mm.map_zero_into_ro(zmemtail)
mmap = _Mapping()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment