Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
8d4c9f31
Commit
8d4c9f31
authored
Apr 05, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
03cfbf7e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
4 deletions
+38
-4
t/neo/storage/fs1/xbufio.go
t/neo/storage/fs1/xbufio.go
+3
-2
t/neo/storage/fs1/xbufio_test.go
t/neo/storage/fs1/xbufio_test.go
+35
-2
No files found.
t/neo/storage/fs1/xbufio.go
View file @
8d4c9f31
...
@@ -160,8 +160,9 @@ func (sb *SeqBufReader) ReadAt(p []byte, pos int64) (int, error) {
...
@@ -160,8 +160,9 @@ func (sb *SeqBufReader) ReadAt(p []byte, pos int64) (int, error) {
// if backward trend continues and bufferring would overlap with
// if backward trend continues and bufferring would overlap with
// previous backward access - shift reading up right to it.
// previous backward access - shift reading up right to it.
if
xpos
<
posLastBackward
&&
posLastBackward
<
xpos
+
cap64
(
sb
.
buf
)
{
xLast
:=
posLastBackward
-
int64
(
ntail
)
// XXX comment
xpos
=
max64
(
posLastBackward
,
xpos
+
len64
(
p
))
-
cap64
(
sb
.
buf
)
if
xpos
<
xLast
&&
xLast
<
xpos
+
cap64
(
sb
.
buf
)
{
xpos
=
max64
(
xLast
,
xpos
+
len64
(
p
))
-
cap64
(
sb
.
buf
)
// XXX recheck do we really need this ? ( was added for {122, 6, 121, 10} )
// XXX recheck do we really need this ? ( was added for {122, 6, 121, 10} )
// XXX alternatively even if backward trend does not continue anymore
// XXX alternatively even if backward trend does not continue anymore
...
...
t/neo/storage/fs1/xbufio_test.go
View file @
8d4c9f31
...
@@ -73,8 +73,41 @@ var xSeqBufTestv = []struct {pos int64; Len int; bufPos int64; bufLen int} {
...
@@ -73,8 +73,41 @@ var xSeqBufTestv = []struct {pos int64; Len int; bufPos int64; bufLen int} {
{
136
,
20
,
131
,
10
},
// big forward starting from inside filled buf
{
136
,
20
,
131
,
10
},
// big forward starting from inside filled buf
{
128
,
4
,
126
,
10
},
// backward (not trend): buf refilled up to posLastIO
{
128
,
4
,
126
,
10
},
// backward (not trend): buf refilled up to posLastIO
// TODO interleaved forward + back-back-back
// interleaved backward + fwd-fwd-fwd
// TODO interleaved backward + fwd-fwd-fwd
{
200
,
10
,
200
,
10
},
// reset @200
{
194
,
1
,
190
,
10
},
// 1st backward access: buf refilled
{
186
,
1
,
184
,
10
},
// trendy backward access - buf refilled up-to prev back read
{
187
,
1
,
184
,
10
},
// fwd-fwd-fwd (all already buffered)
{
188
,
2
,
184
,
10
},
{
190
,
3
,
184
,
10
},
{
182
,
4
,
174
,
10
},
// trendy backward access - part taken from buffer and buf refilled adjacet to previous backward IO
{
168
,
1
,
168
,
10
},
// trendy backward access farther than cap(buf) - buf refilled right at @pos
{
169
,
7
,
168
,
10
},
// fwd-fwd-fwd (partly buffered / partly loaded)
{
176
,
3
,
178
,
10
},
{
179
,
6
,
178
,
10
},
// interleaved forward + back-back-back
{
200
,
10
,
200
,
10
},
// reset @200
{
206
,
1
,
200
,
10
},
// 1st forward access
{
214
,
1
,
207
,
10
},
// trendy forward access - buf refilled adjacent to previous forward read
{
213
,
1
,
207
,
10
},
// back-back-back (all already buffered)
{
211
,
2
,
207
,
10
},
{
207
,
5
,
207
,
10
},
{
215
,
4
,
217
,
10
},
// trendy forward access - part taken from buffer and buf refilled adjacent to previous forward IO
{
235
,
1
,
235
,
10
},
// trendy forward access farther than cap(buf) - buf refilled right at @pos
{
234
,
1
,
225
,
10
},
// back-back-back (partly loaded / then partly buffered)
{
230
,
3
,
225
,
10
},
{
222
,
8
,
215
,
10
},
{
219
,
3
,
215
,
10
},
{
5
,
4
,
5
,
10
},
// forward near file start
{
5
,
4
,
5
,
10
},
// forward near file start
{
2
,
3
,
0
,
10
},
// backward: buf does not go beyong 0
{
2
,
3
,
0
,
10
},
// backward: buf does not go beyong 0
...
...
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