mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-03 15:00:26 +08:00
bfs commit
This commit is contained in:
@@ -316,7 +316,8 @@ func (this *BlocksFile) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
_ = this.sync(true)
|
||||
// TODO 决定是否同步
|
||||
//_ = this.sync(true)
|
||||
|
||||
this.isClosed = true
|
||||
|
||||
|
||||
@@ -256,6 +256,11 @@ func (this *FS) openBFileForHashWriting(hash string) (*BlocksFile, error) {
|
||||
if ok {
|
||||
// 调整当前BFile所在位置
|
||||
this.mu.Lock()
|
||||
|
||||
if bFile.IsClosing() {
|
||||
// TODO 需要重新等待打开
|
||||
}
|
||||
|
||||
item, itemOk := this.bItemMap[bName]
|
||||
if itemOk {
|
||||
this.bList.Remove(item)
|
||||
|
||||
@@ -18,9 +18,9 @@ type FSOptions struct {
|
||||
func (this *FSOptions) EnsureDefaults() {
|
||||
if this.MaxOpenFiles <= 0 {
|
||||
// 根据内存计算最大打开文件数
|
||||
var maxOpenFiles = memutils.SystemMemoryGB() * 64
|
||||
if maxOpenFiles > (4 << 10) {
|
||||
maxOpenFiles = 4 << 10
|
||||
var maxOpenFiles = memutils.SystemMemoryGB() * 128
|
||||
if maxOpenFiles > (8 << 10) {
|
||||
maxOpenFiles = 8 << 10
|
||||
}
|
||||
this.MaxOpenFiles = maxOpenFiles
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ package bfs
|
||||
|
||||
import "github.com/TeaOSLab/EdgeNode/internal/zero"
|
||||
|
||||
// TODO 使用atomic代替channel?需要使用基准测试对比性能
|
||||
// TODO 线程数可以根据硬盘数量动态调整?
|
||||
var readThreadsLimiter = make(chan zero.Zero, 8)
|
||||
var writeThreadsLimiter = make(chan zero.Zero, 8)
|
||||
|
||||
Reference in New Issue
Block a user