Skip to content

Commit

Permalink
Merge pull request #8139 from filecoin-project/asr/backport
Browse files Browse the repository at this point in the history
Backport #8130
  • Loading branch information
arajasek authored Feb 17, 2022
2 parents bf36363 + a48f542 commit 4cd0f7a
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/lotus-miner/info_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ var infoAllCmd = &cli.Command{
fmt.Println("ERROR: ", err)
}

fmt.Println("\n#: Storage Locks")
if err := storageLocks.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}

fmt.Println("\n#: Sched Diag")
if err := sealingSchedDiagCmd.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
Expand Down Expand Up @@ -192,6 +197,11 @@ var infoAllCmd = &cli.Command{
fmt.Println("ERROR: ", err)
}

fmt.Println("\n#: Storage Sector List")
if err := storageListSectorsCmd.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}

fmt.Println("\n#: Expired Sectors")
if err := sectorsExpiredCmd.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
Expand Down
39 changes: 39 additions & 0 deletions cmd/lotus-miner/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ type storedSector struct {
store stores.SectorStorageInfo

unsealed, sealed, cache bool
update, updatecache bool
}

var storageFindCmd = &cli.Command{
Expand Down Expand Up @@ -421,6 +422,16 @@ var storageFindCmd = &cli.Command{
return xerrors.Errorf("finding cache: %w", err)
}

us, err := nodeApi.StorageFindSector(ctx, sid, storiface.FTUpdate, 0, false)
if err != nil {
return xerrors.Errorf("finding sealed: %w", err)
}

uc, err := nodeApi.StorageFindSector(ctx, sid, storiface.FTUpdateCache, 0, false)
if err != nil {
return xerrors.Errorf("finding cache: %w", err)
}

byId := map[stores.ID]*storedSector{}
for _, info := range u {
sts, ok := byId[info.ID]
Expand Down Expand Up @@ -455,6 +466,28 @@ var storageFindCmd = &cli.Command{
}
sts.cache = true
}
for _, info := range us {
sts, ok := byId[info.ID]
if !ok {
sts = &storedSector{
id: info.ID,
store: info,
}
byId[info.ID] = sts
}
sts.update = true
}
for _, info := range uc {
sts, ok := byId[info.ID]
if !ok {
sts = &storedSector{
id: info.ID,
store: info,
}
byId[info.ID] = sts
}
sts.updatecache = true
}

local, err := nodeApi.StorageLocal(ctx)
if err != nil {
Expand All @@ -480,6 +513,12 @@ var storageFindCmd = &cli.Command{
if info.cache {
types += "Cache, "
}
if info.update {
types += "Update, "
}
if info.updatecache {
types += "UpdateCache, "
}

fmt.Printf("In %s (%s)\n", info.id, types[:len(types)-2])
fmt.Printf("\tSealing: %t; Storage: %t\n", info.store.CanSeal, info.store.CanStore)
Expand Down

0 comments on commit 4cd0f7a

Please sign in to comment.