Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
67b28c2a
Commit
67b28c2a
authored
Jul 15, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
207c7a2b
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
15 deletions
+46
-15
bigfile/_bigfile.c
bigfile/_bigfile.c
+1
-1
bigfile/file_zodb.py
bigfile/file_zodb.py
+2
-1
bigfile/tests/bench_virtmem.c
bigfile/tests/bench_virtmem.c
+1
-1
bigfile/tests/test_virtmem.c
bigfile/tests/test_virtmem.c
+4
-4
bigfile/virtmem.c
bigfile/virtmem.c
+18
-3
include/wendelin/bigfile/virtmem.h
include/wendelin/bigfile/virtmem.h
+20
-5
No files found.
bigfile/_bigfile.c
View file @
67b28c2a
...
...
@@ -1031,7 +1031,7 @@ static PyMemberDef pyfile_members[] = {
static
/*const*/
PyMethodDef
pyfile_methods
[]
=
{
// XXX should be separate BigFileH ctor or fileh_open function?
{
"fileh_open"
,
pyfileh_open
,
METH_VARARGS
,
"fileh_open(ram=None) -> new file handle"
},
{
"fileh_open"
,
pyfileh_open
,
METH_VARARGS
,
"fileh_open(ram=None
, mmap_overlay=None
) -> new file handle"
},
{
NULL
}
};
...
...
bigfile/file_zodb.py
View file @
67b28c2a
...
...
@@ -665,7 +665,8 @@ class _ZBigFileH(object):
if
wcfileh
is
not
None
:
self
.
zfileh
=
wcfileh
else
:
self
.
zfileh
=
zfile
.
_v_file
.
fileh_open
()
# XXX
self
.
zfileh
=
zfile
.
_v_file
.
fileh_open
(
mmap_overlay
=
_use_wcfs
)
# FIXME zfile._p_jar could be None (ex. ZBigFile is newly created
# before first commit)
...
...
bigfile/tests/bench_virtmem.c
View file @
67b28c2a
...
...
@@ -80,7 +80,7 @@ void bench_pagefault() {
};
/* setup f mapping */
err
=
fileh_open
(
fh
,
&
f
,
ram
);
err
=
fileh_open
(
fh
,
&
f
,
ram
,
DONT_MMAP_OVERLAY
);
ok1
(
!
err
);
err
=
fileh_mmap
(
vma
,
fh
,
0
,
npage
);
...
...
bigfile/tests/test_virtmem.c
View file @
67b28c2a
...
...
@@ -393,7 +393,7 @@ void test_file_access_synthetic(void)
.
file_ops
=
&
x_ops
,
};
err
=
fileh_open
(
fh
,
&
fileid
,
ram
);
err
=
fileh_open
(
fh
,
&
fileid
,
ram
,
DONT_MMAP_OVERLAY
);
ok1
(
!
err
);
ok1
(
list_empty
(
&
fh
->
mmaps
));
...
...
@@ -956,7 +956,7 @@ void test_file_access_pagefault()
.
file_ops
=
&
fileid_ops
,
};
err
=
fileh_open
(
fh
,
&
fileid
,
ram
);
err
=
fileh_open
(
fh
,
&
fileid
,
ram
,
DONT_MMAP_OVERLAY
);
ok1
(
!
err
);
/* implicitly use fileh=fh */
...
...
@@ -1084,7 +1084,7 @@ void test_pagefault_savestate()
.
file_ops
=
&
badfile_ops
,
};
err
=
fileh_open
(
fh
,
&
f
,
ram
);
err
=
fileh_open
(
fh
,
&
f
,
ram
,
DONT_MMAP_OVERLAY
);
ok1
(
!
err
);
err
=
fileh_mmap
(
vma
,
fh
,
0
,
1
);
...
...
@@ -1266,7 +1266,7 @@ void test_file_access_mmapbase(void)
fstore
(
103
,
103
);
err
=
fileh_open
(
fh
,
&
file
,
ram
);
err
=
fileh_open
(
fh
,
&
file
,
ram
,
MMAP_OVERLAY
);
ok1
(
!
err
);
/* implicitly use fileh=fh */
...
...
bigfile/virtmem.c
View file @
67b28c2a
...
...
@@ -146,10 +146,26 @@ static void sigsegv_restore(const sigset_t *save_sigset)
* OPEN / CLOSE *
****************/
int
fileh_open
(
BigFileH
*
fileh
,
BigFile
*
file
,
RAM
*
ram
)
int
fileh_open
(
BigFileH
*
fileh
,
BigFile
*
file
,
RAM
*
ram
,
FileHOpenFlags
flags
)
{
int
err
=
0
;
sigset_t
save_sigset
;
const
bigfile_ops
*
fops
=
file
->
file_ops
;
if
(
!
(
flags
==
0
||
flags
==
MMAP_OVERLAY
||
flags
==
DONT_MMAP_OVERLAY
))
return
-
EINVAL
;
if
(
flags
==
0
)
{
flags
=
fops
->
mmap_setup_read
?
MMAP_OVERLAY
:
DONT_MMAP_OVERLAY
;
}
if
(
flags
&
MMAP_OVERLAY
&&
flags
&
DONT_MMAP_OVERLAY
)
return
-
EINVAL
;
if
(
flags
==
MMAP_OVERLAY
)
{
ASSERT
(
fops
->
mmap_setup_read
);
ASSERT
(
fops
->
remmap_blk_read
);
}
if
(
flags
==
DONT_MMAP_OVERLAY
)
{
ASSERT
(
fops
->
loadblk
);
}
sigsegv_block
(
&
save_sigset
);
virt_lock
();
...
...
@@ -167,8 +183,7 @@ int fileh_open(BigFileH *fileh, BigFile *file, RAM *ram)
fileh
->
writeout_inprogress
=
0
;
pagemap_init
(
&
fileh
->
pagemap
,
ilog2_exact
(
ram
->
pagesize
));
// XXX hardcoded - allow user choice?
fileh
->
mmap_overlay
=
(
file
->
file_ops
->
mmap_setup_read
!=
NULL
);
fileh
->
mmap_overlay
=
(
flags
==
MMAP_OVERLAY
);
out:
virt_unlock
();
...
...
include/wendelin/bigfile/virtmem.h
View file @
67b28c2a
...
...
@@ -156,19 +156,34 @@ struct VMA {
* API for clients *
*****************************/
/* flags for fileh_open */
enum
FileHOpenFlags
{
/* use "mmap overlay" mode for base file data of all mappings created
* for this fileh.
*
* The file must have .mmap_setup_read & friends != NULL in file_ops.
*/
MMAP_OVERLAY
=
1
<<
0
,
/* don't use "mmap overlay" mode */
DONT_MMAP_OVERLAY
=
1
<<
1
,
/* NOTE: if both MMAP_OVERLAY and DONT_MMAP_OVERLAY are not given,
* the behaviour is to use mmap overlay if .mmap_* fops != NULL and
* regular loads otherwise. */
};
typedef
enum
FileHOpenFlags
FileHOpenFlags
;
/* open handle for a BigFile
*
* @fileh[out] BigFileH handle to initialize for this open
* @file
* @ram RAM that will back created fileh mappings
* @flags flags for this open - see FileHOpenFlags
*
* @return 0 - ok, !0 - fail
*/
int
fileh_open
(
BigFileH
*
fileh
,
BigFile
*
file
,
RAM
*
ram
);
// XXX + fileh_open_overlay(fileh, file, base, ram) ?
// here base is glued data from head/bigfile/file + revX/bigfile/file overwrites.
// file will be used only to storeblk (loadblk=BUG).
int
fileh_open
(
BigFileH
*
fileh
,
BigFile
*
file
,
RAM
*
ram
,
FileHOpenFlags
flags
);
/* close fileh
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment