Commit b0b8350f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6c998ca4
...@@ -414,6 +414,20 @@ PyFunc(pyfileh_invalidate_page, "invalidate_page(pgoffset) - invalidate fileh pa ...@@ -414,6 +414,20 @@ PyFunc(pyfileh_invalidate_page, "invalidate_page(pgoffset) - invalidate fileh pa
} }
PyFunc(pyfileh_uses_mmap_overlay, "uses_mmap_overlay() - whether base data for all VMAs"
" of this fileh are taken as base-layer mmap")
(PyObject *pyfileh0, PyObject *args)
{
PyBigFileH *pyfileh = container_of(pyfileh0, PyBigFileH, pyobj);
BigFileH *fileh = &pyfileh->fileh;
if (!PyArg_ParseTuple(args, ""))
return NULL;
return PyBool_FromLong(fileh->mmap_overlay);
}
static void static void
pyfileh_dealloc(PyObject *pyfileh0) pyfileh_dealloc(PyObject *pyfileh0)
{ {
...@@ -454,11 +468,12 @@ pyfileh_new(PyTypeObject *type, PyObject *args, PyObject *kw) ...@@ -454,11 +468,12 @@ pyfileh_new(PyTypeObject *type, PyObject *args, PyObject *kw)
static /*const*/ PyMethodDef pyfileh_methods[] = { static /*const*/ PyMethodDef pyfileh_methods[] = {
{"mmap", pyfileh_mmap, METH_VARARGS, pyfileh_mmap_doc}, {"mmap", pyfileh_mmap, METH_VARARGS, pyfileh_mmap_doc},
{"dirty_writeout", pyfileh_dirty_writeout, METH_VARARGS, pyfileh_dirty_writeout_doc}, {"dirty_writeout", pyfileh_dirty_writeout, METH_VARARGS, pyfileh_dirty_writeout_doc},
{"dirty_discard", pyfileh_dirty_discard, METH_VARARGS, pyfileh_dirty_discard_doc}, {"dirty_discard", pyfileh_dirty_discard, METH_VARARGS, pyfileh_dirty_discard_doc},
{"isdirty", pyfileh_isdirty, METH_VARARGS, pyfileh_isdirty_doc}, {"isdirty", pyfileh_isdirty, METH_VARARGS, pyfileh_isdirty_doc},
{"invalidate_page", pyfileh_invalidate_page,METH_VARARGS, pyfileh_invalidate_page_doc}, {"invalidate_page", pyfileh_invalidate_page, METH_VARARGS, pyfileh_invalidate_page_doc},
{"uses_mmap_overlay", pyfileh_uses_mmap_overlay, METH_VARARGS, pyfileh_uses_mmap_overlay_doc},
{NULL} {NULL}
}; };
......
...@@ -781,6 +781,10 @@ class _ZBigFileH(object): ...@@ -781,6 +781,10 @@ class _ZBigFileH(object):
def invalidate_page(self, pgoffset): def invalidate_page(self, pgoffset):
return self.zfileh.invalidate_page(pgoffset) return self.zfileh.invalidate_page(pgoffset)
@property
def uses_mmap_overlay(self):
return self.zfileh.uses_mmap_overlay
# ~~~~ ISynchronizer ~~~~ # ~~~~ ISynchronizer ~~~~
def beforeCompletion(self, txn): def beforeCompletion(self, txn):
......
...@@ -137,7 +137,10 @@ def test_bigfile_filezodb(): ...@@ -137,7 +137,10 @@ def test_bigfile_filezodb():
# evict all loaded pages and test loading them again # evict all loaded pages and test loading them again
# (verifies ZBlk.loadblkdata() & loadblk logic when loading data the second time) # (verifies ZBlk.loadblkdata() & loadblk logic when loading data the second time)
reclaimed = ram_reclaim_all() reclaimed = ram_reclaim_all()
assert reclaimed >= blen # XXX assumes pagesize=blksize if fh.uses_mmap_overlay:
assert reclaimed == 0
else:
assert reclaimed >= blen # XXX assumes pagesize=blksize
for i in xrange(blen): for i in xrange(blen):
assert array_equal(Blk(vma, i), dataX(i)) assert array_equal(Blk(vma, i), dataX(i))
......
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