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
66ff48dd
Commit
66ff48dd
authored
Nov 26, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make max write tunable.
parent
be2df608
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
8 deletions
+20
-8
fuse/api.go
fuse/api.go
+4
-0
fuse/mountstate.go
fuse/mountstate.go
+15
-7
fuse/opcode.go
fuse/opcode.go
+1
-1
No files found.
fuse/api.go
View file @
66ff48dd
...
...
@@ -213,6 +213,10 @@ type MountOptions struct {
// controls the allowed number of requests that relate to
// async I/O. Concurrency for synchronous I/O is not limited.
MaxBackground
int
// Write size to use. If 0, use default. This number is
// capped at the kernel maximum.
MaxWrite
int
}
// DefaultFileSystem implements a FileSystem that returns ENOSYS for every operation.
...
...
fuse/mountstate.go
View file @
66ff48dd
...
...
@@ -9,11 +9,8 @@ import (
)
const
(
// bufSize should be a power of two to minimize lossage in
// BufferPool. The minimum is 8k, but it doesn't cost anything to
// use a much larger buffer.
bufSize
=
(
1
<<
16
)
maxRead
=
bufSize
-
PAGESIZE
// The kernel caps writes at 128k.
MAX_KERNEL_WRITE
=
128
*
1024
)
// MountState contains the logic for reading from the FUSE device and
...
...
@@ -53,7 +50,18 @@ func (me *MountState) Mount(mountPoint string, opts *MountOptions) error {
MaxBackground
:
_DEFAULT_BACKGROUND_TASKS
,
}
}
me
.
opts
=
opts
o
:=
*
opts
if
o
.
MaxWrite
<
0
{
o
.
MaxWrite
=
0
}
if
o
.
MaxWrite
==
0
{
o
.
MaxWrite
=
1
<<
16
}
if
o
.
MaxWrite
>
MAX_KERNEL_WRITE
{
o
.
MaxWrite
=
MAX_KERNEL_WRITE
}
opts
=
&
o
me
.
opts
=
&
o
optStrs
:=
opts
.
Options
if
opts
.
AllowOther
{
...
...
@@ -120,7 +128,7 @@ func (me *MountState) BufferPoolStats() string {
func
(
me
*
MountState
)
newRequest
()
*
request
{
return
&
request
{
status
:
OK
,
inputBuf
:
me
.
buffers
.
AllocBuffer
(
bufSize
),
inputBuf
:
me
.
buffers
.
AllocBuffer
(
uint32
(
me
.
opts
.
MaxWrite
+
4096
)
),
}
}
...
...
fuse/opcode.go
View file @
66ff48dd
...
...
@@ -86,7 +86,7 @@ func doInit(state *MountState, req *request) {
Minor
:
FUSE_KERNEL_MINOR_VERSION
,
MaxReadAhead
:
input
.
MaxReadAhead
,
Flags
:
state
.
kernelSettings
.
Flags
,
MaxWrite
:
maxRead
,
MaxWrite
:
uint32
(
state
.
opts
.
MaxWrite
)
,
CongestionThreshold
:
uint16
(
state
.
opts
.
MaxBackground
*
3
/
4
),
MaxBackground
:
uint16
(
state
.
opts
.
MaxBackground
),
}
...
...
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