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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
6cd01d61
Commit
6cd01d61
authored
Oct 21, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8b5e9340
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
7 deletions
+25
-7
setup.py
setup.py
+6
-1
wcfs/internal/wcfs_virtmem.cpp
wcfs/internal/wcfs_virtmem.cpp
+19
-6
No files found.
setup.py
View file @
6cd01d61
...
...
@@ -233,7 +233,12 @@ setup(
_bigfile
,
PyGoExt
(
'wcfs.internal._wcfs'
,
[
'wcfs/internal/_wcfs.pyx'
,
'wcfs/internal/wcfs_virtmem.cpp'
]),
[
'wcfs/internal/_wcfs.pyx'
,
'wcfs/internal/wcfs_virtmem.cpp'
],
include_dirs
=
[
# XXX -> common place
'./include'
,
'./3rdparty/ccan'
,
'./3rdparty/include'
]),
PyGoExt
(
'wcfs.internal.wcfs_test'
,
[
'wcfs/internal/wcfs_test.pyx'
]),
...
...
wcfs/internal/wcfs_virtmem.cpp
View file @
6cd01d61
...
...
@@ -24,15 +24,17 @@
#include <golang/libgolang.h>
using
namespace
golang
;
#include <wendelin/bug.h>
#include <unordered_map>
#include <vector>
#include <stdint.h>
template
<
typename
Key
,
typename
Value
>
using
dict
=
std
::
unordered_map
<
Key
,
Value
>
;
#include <vector>
using
std
::
vector
;
#include <stdint.h>
typedef
uint64_t
Tid
;
// XXX ok?
typedef
uint64_t
Oid
;
// XXX ok?
...
...
@@ -78,7 +80,7 @@ private:
struct
_File
{
Conn
*
wconn
;
Oid
foid
;
// hex of ZBigFile root object ID
// .blksize
block size of this file
int64_t
blksize
;
//
block size of this file
// .headf file object of head/file
// .headfsize head/file size is known to be at least headfsize (size ↑=)
dict
<
int64_t
,
Tid
>
pinned
;
// {} blk -> rev that wcfs already sent us for this file
...
...
@@ -89,7 +91,13 @@ struct _File {
struct
_Mapping
{
_File
*
file
;
int
blk_start
;
// offset of this mapping in file
// .mem mmaped memory
uint8_t
*
mem_start
;
// mmapped memory [mem_start, mem_stop)
uint8_t
*
mem_stop
;
int64_t
blk_stop
()
const
{
ASSERT
((
mem_stop
-
mem_start
)
%
file
->
blksize
==
0
);
return
blk_start
+
(
mem_stop
-
mem_start
)
/
file
->
blksize
;
}
};
...
...
@@ -167,5 +175,10 @@ void Conn::_pin1(SrvReq *req) {
// XXX relock wconn -> f ?
for
(
auto
mmap
:
f
->
mmaps
)
{
// XXX use ↑blk_start for binary search
if
(
!
(
mmap
->
blk_start
<=
req
->
blk
&&
req
->
blk
<
mmap
->
blk_stop
()))
continue
;
// blk ∉ mmap
}
wconn
->
_filemu
.
unlock
();
}
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