Skip to content

Commit

Permalink
correct overheads in batch reservation
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Nov 15, 2024
1 parent 640c682 commit bf0de8e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions lib/ffi/task_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ type TaskStorage struct {

// Minimum free storage percentage cutoff for reservation rejection
MinFreeStoragePercentage float64

Overheads map[storiface.SectorFileType]int
}

type ReleaseStorageFunc func() // free storage reservation
Expand All @@ -67,10 +69,10 @@ func (sb *SealCalls) Storage(taskToSectorRef func(taskID harmonytask.TaskID) (Se
}

return []SectorRef{sr}, nil
}, alloc, existing, ssize, pathType, MinFreeStoragePercentage)
}, alloc, existing, ssize, pathType, MinFreeStoragePercentage, storiface.FSOverheadSeal)
}

func (sb *SealCalls) StorageMulti(taskToSectorRef func(taskID harmonytask.TaskID) ([]SectorRef, error), alloc, existing storiface.SectorFileType, ssize abi.SectorSize, pathType storiface.PathType, MinFreeStoragePercentage float64) *TaskStorage {
func (sb *SealCalls) StorageMulti(taskToSectorRef func(taskID harmonytask.TaskID) ([]SectorRef, error), alloc, existing storiface.SectorFileType, ssize abi.SectorSize, pathType storiface.PathType, MinFreeStoragePercentage float64, ohs map[storiface.SectorFileType]int) *TaskStorage {
return &TaskStorage{
sc: sb,
alloc: alloc,
Expand All @@ -79,6 +81,7 @@ func (sb *SealCalls) StorageMulti(taskToSectorRef func(taskID harmonytask.TaskID
pathType: pathType,
taskToSectorRef: taskToSectorRef,
MinFreeStoragePercentage: MinFreeStoragePercentage,
Overheads: ohs,
}
}

Expand Down Expand Up @@ -192,7 +195,7 @@ func (t *TaskStorage) Claim(taskID int) (func() error, error) {
}

// reserve the space
release, err := t.sc.Sectors.localStore.Reserve(ctx, sectorRef.Ref(), requestedTypes, pathIDs, storiface.FSOverheadSeal, t.MinFreeStoragePercentage)
release, err := t.sc.Sectors.localStore.Reserve(ctx, sectorRef.Ref(), requestedTypes, pathIDs, t.Overheads, t.MinFreeStoragePercentage)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion tasks/sealsupra/task_supraseal.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ func (s *SupraSeal) TypeDetails() harmonytask.TaskTypeDetails {
Cpu: 1,
Gpu: 0,
Ram: 16 << 30,
Storage: s.sc.StorageMulti(s.taskToSectors, storiface.FTCache|storiface.FTSealed, storiface.FTNone, ssize, storiface.PathSealing, paths.MinFreeStoragePercentage),
Storage: s.sc.StorageMulti(s.taskToSectors, storiface.FTCache|storiface.FTSealed, storiface.FTNone, ssize, storiface.PathSealing, paths.MinFreeStoragePercentage, FSOverheadSupra),
},
MaxFailures: 4,
IAmBored: passcall.Every(30*time.Second, s.schedule),
Expand Down

0 comments on commit bf0de8e

Please sign in to comment.