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
e7eb277f
Commit
e7eb277f
authored
Dec 04, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
9f32a779
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
13 deletions
+11
-13
wcfs/internal/wcfs.h
wcfs/internal/wcfs.h
+1
-1
wcfs/internal/wcfs_virtmem.cpp
wcfs/internal/wcfs_virtmem.cpp
+10
-12
No files found.
wcfs/internal/wcfs.h
View file @
e7eb277f
...
...
@@ -92,7 +92,7 @@ public:
public:
error
close
();
_Mapping
*
mmap
(
zodb
::
Oid
foid
,
int64_t
blk_start
,
int64_t
blk_len
);
pair
<
_Mapping
*
,
error
>
mmap
(
zodb
::
Oid
foid
,
int64_t
blk_start
,
int64_t
blk_len
);
error
resync
(
zodb
::
Tid
at
);
private:
...
...
wcfs/internal/wcfs_virtmem.cpp
View file @
e7eb277f
...
...
@@ -254,7 +254,7 @@ void _Conn::_pin1(PinReq *req) {
}
// mmap creates file mapping representing file[blk_start +blk_len) data as of wconn.at database state.
_Mapping
*
_Conn
::
mmap
(
zodb
::
Oid
foid
,
int64_t
blk_start
,
int64_t
blk_len
)
{
pair
<
_Mapping
*
,
error
>
_Conn
::
mmap
(
zodb
::
Oid
foid
,
int64_t
blk_start
,
int64_t
blk_len
)
{
_Conn
&
wconn
=
*
this
;
// XXX err ctx
// XXX (blk_start + blk_len) * blk_size overflow
...
...
@@ -275,25 +275,24 @@ _Mapping* _Conn::mmap(zodb::Oid foid, int64_t blk_start, int64_t blk_len) {
_File
*
f
;
bool
ok
;
tie
(
f
,
ok
)
=
wconn
.
_filetab
.
get
(
foid
);
if
(
f
==
nil
)
{
f
=
new
_File
();
f
=
new
_File
();
// XXX free f on error return (will be automatic if f = refptr)
f
->
wconn
=
newref
(
&
wconn
);
// XXX newref -> simpler?
f
->
foid
=
foid
;
tie
(
f
->
headf
,
err
)
=
wconn
.
_wc
->
_open
(
fmt
::
sprintf
(
"head/bigfile/%s"
,
h_
(
foid
)));
if
(
err
!=
nil
)
panic
(
"TODO"
);
// XXX err
return
make_pair
(
nil
,
err
);
//f.pinned = {}
//f.mmaps = []
struct
stat
st
;
err
=
f
->
headf
->
stat
(
&
st
);
if
(
err
!=
nil
)
panic
(
"TODO"
);
// XXX
return
make_pair
(
nil
,
err
);
f
->
blksize
=
st
.
st_blksize
;
f
->
headfsize
=
st
.
st_size
;
if
(
!
(
f
->
headfsize
%
f
->
blksize
==
0
))
//return fmt::errorf("wcfs bug: head/file size %% blksize != 0");
panic
(
"wcfs bug: head/file size %% blksize != 0"
);
// XXX -> err
return
make_pair
(
nil
,
fmt
::
errorf
(
"wcfs bug: head/file size %% blksize != 0"
));
wconn
.
_filetab
[
foid
]
=
f
;
...
...
@@ -301,12 +300,11 @@ _Mapping* _Conn::mmap(zodb::Oid foid, int64_t blk_start, int64_t blk_len) {
string
ack
;
tie
(
ack
,
err
)
=
wconn
.
_wlink
->
sendReq
(
context
::
background
(),
fmt
::
sprintf
(
"watch %s @%s"
,
h_
(
foid
),
h_
(
wconn
.
at
)));
if
(
err
!=
nil
)
panic
(
"TODO"
);
// XXX
return
make_pair
(
nil
,
err
);
if
(
ack
!=
"ok"
)
{
// XXX unregister f from _filetab
// XXX vvv -> errctx?
/*return XXX*/
fmt
::
errorf
(
"@%s: mmap f<%s>[%zd +%zd): %s"
,
h_
(
wconn
.
at
),
h_
(
foid
),
blk_start
,
blk_len
,
ack
.
c_str
());
panic
(
"TODO ack != ok"
);
// XXX ^^^
return
make_pair
(
nil
,
fmt
::
errorf
(
"@%s: mmap f<%s>[%zd +%zd): %s"
,
h_
(
wconn
.
at
),
h_
(
foid
),
blk_start
,
blk_len
,
ack
.
c_str
()));
}
}
...
...
@@ -318,7 +316,7 @@ _Mapping* _Conn::mmap(zodb::Oid foid, int64_t blk_start, int64_t blk_len) {
uint8_t
*
mem_start
,
*
mem_stop
;
tie
(
mem_start
,
err
)
=
mmap_ro
(
f
->
headf
,
start
,
blk_len
*
f
->
blksize
);
if
(
err
!=
nil
)
panic
(
"TODO"
);
// XXX
return
make_pair
(
nil
,
err
);
mem_stop
=
mem_start
+
blk_len
*
f
->
blksize
;
int64_t
stop
=
blk_stop
*
f
->
blksize
;
...
...
@@ -326,7 +324,7 @@ _Mapping* _Conn::mmap(zodb::Oid foid, int64_t blk_start, int64_t blk_len) {
uint8_t
*
zmem_start
=
mem_start
+
(
max
(
f
->
headfsize
/*XXX -1 ?*/
,
start
)
-
start
);
err
=
mmap_zero_into_ro
(
zmem_start
,
mem_stop
-
zmem_start
);
if
(
err
!=
nil
)
panic
(
"TODO"
);
// XXX
return
make_pair
(
nil
,
err
);
}
_Mapping
*
mmap
=
new
_Mapping
();
...
...
@@ -345,7 +343,7 @@ _Mapping* _Conn::mmap(zodb::Oid foid, int64_t blk_start, int64_t blk_len) {
f
->
mmaps
.
push_back
(
mmap
);
// XXX keep f.mmaps ↑blk_start
return
m
map
;
return
m
ake_pair
(
mmap
,
nil
)
;
}
// resync resyncs connection and its mappings onto different database view.
...
...
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