Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Juicedata
JuiceFS
提交
a04b66af
JuiceFS
项目概览
Juicedata
/
JuiceFS
通知
10
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
JuiceFS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
a04b66af
编写于
3月 16, 2021
作者:
D
Davies Liu
提交者:
GitHub
3月 16, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Sync stagging block in writeback mode (#255)
上级
75227abc
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
28 addition
and
19 deletion
+28
-19
cmd/gateway.go
cmd/gateway.go
+6
-6
cmd/mount.go
cmd/mount.go
+6
-6
pkg/chunk/cached_store.go
pkg/chunk/cached_store.go
+2
-2
pkg/chunk/disk_cache.go
pkg/chunk/disk_cache.go
+12
-3
pkg/chunk/store_test.go
pkg/chunk/store_test.go
+1
-1
sdk/java/libjfs/main.go
sdk/java/libjfs/main.go
+1
-1
未找到文件。
cmd/gateway.go
浏览文件 @
a04b66af
...
...
@@ -163,12 +163,12 @@ func (g *GateWay) NewGatewayLayer(creds auth.Credentials) (minio.ObjectLayer, er
BlockSize
:
format
.
BlockSize
*
1024
,
Compress
:
format
.
Compression
,
GetTimeout
:
time
.
Second
*
time
.
Duration
(
c
.
Int
(
"get-timeout"
)),
PutTimeout
:
time
.
Second
*
time
.
Duration
(
c
.
Int
(
"put-timeout"
)),
MaxUpload
:
c
.
Int
(
"max-uploads"
),
AsyncUpload
:
c
.
Bool
(
"writeback"
),
Prefetch
:
c
.
Int
(
"prefetch"
),
BufferSize
:
c
.
Int
(
"buffer-size"
)
<<
20
,
GetTimeout
:
time
.
Second
*
time
.
Duration
(
c
.
Int
(
"get-timeout"
)),
PutTimeout
:
time
.
Second
*
time
.
Duration
(
c
.
Int
(
"put-timeout"
)),
MaxUpload
:
c
.
Int
(
"max-uploads"
),
Writeback
:
c
.
Bool
(
"writeback"
),
Prefetch
:
c
.
Int
(
"prefetch"
),
BufferSize
:
c
.
Int
(
"buffer-size"
)
<<
20
,
CacheDir
:
c
.
String
(
"cache-dir"
),
CacheSize
:
int64
(
c
.
Int
(
"cache-size"
)),
...
...
cmd/mount.go
浏览文件 @
a04b66af
...
...
@@ -159,12 +159,12 @@ func mount(c *cli.Context) error {
BlockSize
:
format
.
BlockSize
*
1024
,
Compress
:
format
.
Compression
,
GetTimeout
:
time
.
Second
*
time
.
Duration
(
c
.
Int
(
"get-timeout"
)),
PutTimeout
:
time
.
Second
*
time
.
Duration
(
c
.
Int
(
"put-timeout"
)),
MaxUpload
:
c
.
Int
(
"max-uploads"
),
AsyncUpload
:
c
.
Bool
(
"writeback"
),
Prefetch
:
c
.
Int
(
"prefetch"
),
BufferSize
:
c
.
Int
(
"buffer-size"
)
<<
20
,
GetTimeout
:
time
.
Second
*
time
.
Duration
(
c
.
Int
(
"get-timeout"
)),
PutTimeout
:
time
.
Second
*
time
.
Duration
(
c
.
Int
(
"put-timeout"
)),
MaxUpload
:
c
.
Int
(
"max-uploads"
),
Writeback
:
c
.
Bool
(
"writeback"
),
Prefetch
:
c
.
Int
(
"prefetch"
),
BufferSize
:
c
.
Int
(
"buffer-size"
)
<<
20
,
CacheDir
:
c
.
String
(
"cache-dir"
),
CacheSize
:
int64
(
c
.
Int
(
"cache-size"
)),
...
...
pkg/chunk/cached_store.go
浏览文件 @
a04b66af
...
...
@@ -464,7 +464,7 @@ func (c *wChunk) upload(indx int) {
logger
.
Fatalf
(
"block length does not match: %v != %v"
,
off
,
blen
)
}
}
if
c
.
store
.
conf
.
AsyncUpload
{
if
c
.
store
.
conf
.
Writeback
{
stagingPath
,
err
:=
c
.
store
.
bcache
.
stage
(
key
,
block
.
Data
,
c
.
store
.
shouldCache
(
blen
))
if
err
!=
nil
{
logger
.
Warnf
(
"write %s to disk: %s, upload it directly"
,
stagingPath
,
err
)
...
...
@@ -541,7 +541,7 @@ type Config struct {
AutoCreate
bool
Compress
string
MaxUpload
int
AsyncUpload
bool
Writeback
bool
Partitions
int
BlockSize
int
UploadLimit
int
...
...
pkg/chunk/disk_cache.go
浏览文件 @
a04b66af
...
...
@@ -143,7 +143,7 @@ func (cache *cacheStore) curFreeRatio() (float32, float32) {
return
float32
(
free
)
/
float32
(
total
),
float32
(
ffree
)
/
float32
(
files
)
}
func
(
cache
*
cacheStore
)
flushPage
(
path
string
,
data
[]
byte
)
error
{
func
(
cache
*
cacheStore
)
flushPage
(
path
string
,
data
[]
byte
,
sync
bool
)
error
{
cache
.
createDir
(
filepath
.
Dir
(
path
))
tmp
:=
path
+
".tmp"
f
,
err
:=
os
.
OpenFile
(
tmp
,
os
.
O_WRONLY
|
os
.
O_CREATE
,
cache
.
mode
)
...
...
@@ -158,6 +158,15 @@ func (cache *cacheStore) flushPage(path string, data []byte) error {
_
=
os
.
Remove
(
tmp
)
return
err
}
if
sync
{
err
=
f
.
Sync
()
if
err
!=
nil
{
logger
.
Warnf
(
"sync stagging file %s: %s"
,
tmp
,
err
)
_
=
f
.
Close
()
_
=
os
.
Remove
(
tmp
)
return
err
}
}
err
=
f
.
Close
()
if
err
!=
nil
{
logger
.
Infof
(
"Close cache file %s: %s"
,
tmp
,
err
)
...
...
@@ -238,7 +247,7 @@ func (cache *cacheStore) flush() {
for
{
w
:=
<-
cache
.
pending
path
:=
cache
.
cachePath
(
w
.
key
)
if
cache
.
capacity
>
0
&&
cache
.
flushPage
(
path
,
w
.
page
.
Data
)
==
nil
{
if
cache
.
capacity
>
0
&&
cache
.
flushPage
(
path
,
w
.
page
.
Data
,
false
)
==
nil
{
cache
.
add
(
w
.
key
,
int32
(
len
(
w
.
page
.
Data
)),
uint32
(
time
.
Now
()
.
Unix
()))
}
cache
.
Lock
()
...
...
@@ -270,7 +279,7 @@ func (cache *cacheStore) add(key string, size int32, atime uint32) {
func
(
cache
*
cacheStore
)
stage
(
key
string
,
data
[]
byte
,
keepCache
bool
)
(
string
,
error
)
{
stagingPath
:=
cache
.
stagePath
(
key
)
err
:=
cache
.
flushPage
(
stagingPath
,
data
)
err
:=
cache
.
flushPage
(
stagingPath
,
data
,
true
)
if
err
==
nil
&&
cache
.
capacity
>
0
&&
keepCache
{
path
:=
cache
.
cachePath
(
key
)
cache
.
createDir
(
filepath
.
Dir
(
path
))
...
...
pkg/chunk/store_test.go
浏览文件 @
a04b66af
...
...
@@ -102,7 +102,7 @@ func TestAsyncStore(t *testing.T) {
f
,
_
:=
os
.
Create
(
p
)
f
.
WriteString
(
"good"
)
f
.
Close
()
conf
.
AsyncUpload
=
true
conf
.
Writeback
=
true
conf
.
UploadLimit
=
0
_
=
NewCachedStore
(
mem
,
conf
)
time
.
Sleep
(
time
.
Millisecond
*
10
)
// wait for scan to finish
...
...
sdk/java/libjfs/main.go
浏览文件 @
a04b66af
...
...
@@ -281,7 +281,7 @@ func jfs_init(cname, jsonConf, user, group, superuser, supergroup *C.char) uintp
CacheFullBlock
:
jConf
.
CacheFullBlock
,
MaxUpload
:
jConf
.
MaxUploads
,
Prefetch
:
3
,
AsyncUpload
:
jConf
.
Writeback
,
Writeback
:
jConf
.
Writeback
,
Partitions
:
format
.
Partitions
,
UploadLimit
:
jConf
.
UploadLimit
,
GetTimeout
:
time
.
Second
*
time
.
Duration
(
jConf
.
GetTimeout
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录