fix reservations
This commit is contained in:
parent
f4a2c8fa49
commit
3895b2ccca
6
extern/sector-storage/stores/local.go
vendored
6
extern/sector-storage/stores/local.go
vendored
@ -392,8 +392,10 @@ func (st *Local) Reserve(ctx context.Context, sid storage.SectorRef, ft storifac
|
|||||||
}
|
}
|
||||||
|
|
||||||
p.reserved += overhead
|
p.reserved += overhead
|
||||||
|
p.reservations[sid.ID] |= fileType
|
||||||
|
|
||||||
prevDone := done
|
prevDone := done
|
||||||
|
saveFileType := fileType
|
||||||
done = func() {
|
done = func() {
|
||||||
prevDone()
|
prevDone()
|
||||||
|
|
||||||
@ -401,6 +403,10 @@ func (st *Local) Reserve(ctx context.Context, sid storage.SectorRef, ft storifac
|
|||||||
defer st.localLk.Unlock()
|
defer st.localLk.Unlock()
|
||||||
|
|
||||||
p.reserved -= overhead
|
p.reserved -= overhead
|
||||||
|
p.reservations[sid.ID] ^= saveFileType
|
||||||
|
if p.reservations[sid.ID] == storiface.FTNone {
|
||||||
|
delete(p.reservations, sid.ID)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user