Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
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
Kirill Smelkov
go-fuse
Commits
1b34b381
Commit
1b34b381
authored
May 22, 2012
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test for read buffers too.
parent
9a0103bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
fuse/mountstate.go
fuse/mountstate.go
+9
-5
fuse/pressure_test.go
fuse/pressure_test.go
+6
-3
No files found.
fuse/mountstate.go
View file @
1b34b381
...
...
@@ -41,6 +41,7 @@ type MountState struct {
reqPool
[]
*
request
readPool
[][]
byte
reqReaders
int
outstandingReadBufs
int
}
func
(
ms
*
MountState
)
KernelSettings
()
raw
.
InitIn
{
...
...
@@ -168,6 +169,7 @@ func (ms *MountState) readRequest() (req *request, code Status) {
}
else
{
dest
=
make
([]
byte
,
ms
.
opts
.
MaxWrite
+
4096
)
}
ms
.
outstandingReadBufs
++
ms
.
reqReaders
++
ms
.
reqMu
.
Unlock
()
...
...
@@ -185,18 +187,19 @@ func (ms *MountState) readRequest() (req *request, code Status) {
ms
.
reqMu
.
Lock
()
if
!
gobbled
{
ms
.
outstandingReadBufs
--
ms
.
readPool
=
append
(
ms
.
readPool
,
dest
)
dest
=
nil
}
ms
.
reqReaders
--
ms
.
reqMu
.
Unlock
()
return
req
,
OK
}
func
(
ms
*
MountState
)
returnRequest
(
req
*
request
)
{
ms
.
recordStats
(
req
)
if
req
.
bufferPoolOutputBuf
!=
nil
{
ms
.
buffers
.
FreeBuffer
(
req
.
bufferPoolOutputBuf
)
req
.
bufferPoolOutputBuf
=
nil
...
...
@@ -206,6 +209,7 @@ func (ms *MountState) returnRequest(req *request) {
ms
.
reqMu
.
Lock
()
if
req
.
bufferPoolOutputBuf
!=
nil
{
ms
.
readPool
=
append
(
ms
.
readPool
,
req
.
bufferPoolInputBuf
)
ms
.
outstandingReadBufs
--
req
.
bufferPoolInputBuf
=
nil
}
ms
.
reqPool
=
append
(
ms
.
reqPool
,
req
)
...
...
@@ -241,12 +245,12 @@ func (ms *MountState) loop() {
req
,
errNo
:=
ms
.
readRequest
()
switch
errNo
{
case
OK
:
case
ENOENT
:
case
ENOENT
:
continue
case
ENODEV
:
// unmount
break
exit
default
:
// some other error?
default
:
// some other error?
log
.
Printf
(
"Failed to read from fuse conn: %v"
,
errNo
)
break
}
...
...
@@ -257,7 +261,7 @@ func (ms *MountState) loop() {
go
ms
.
handleRequest
(
req
)
}
}
func
(
ms
*
MountState
)
handleRequest
(
req
*
request
)
{
defer
ms
.
returnRequest
(
req
)
...
...
fuse/pressure_test.go
View file @
1b34b381
...
...
@@ -44,8 +44,8 @@ func TestMemoryPressure(t *testing.T) {
// Wait for FS to get ready.
os
.
Lstat
(
dir
)
var
wg
sync
.
WaitGroup
var
wg
sync
.
WaitGroup
for
i
:=
0
;
i
<
10
*
_MAX_READERS
;
i
++
{
wg
.
Add
(
1
)
go
func
(
x
int
)
{
...
...
@@ -58,9 +58,12 @@ func TestMemoryPressure(t *testing.T) {
}(
i
)
}
time
.
Sleep
(
100
*
time
.
Millisecond
)
created
:=
state
.
buffers
.
createdBuffers
created
:=
state
.
buffers
.
createdBuffers
+
state
.
outstandingReadBufs
t
.
Logf
(
"Have %d read bufs"
,
state
.
outstandingReadBufs
)
if
created
>
2
*
_MAX_READERS
{
t
.
Errorf
(
"created %d buffers, max reader %d"
,
created
,
_MAX_READERS
)
}
wg
.
Wait
()
}
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