mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Lazily allocate inotify map on inode
PiperOrigin-RevId: 235735865 Change-Id: I84223eb18eb51da1fa9768feaae80387ff6bfed0
This commit is contained in:
committed by
Shentubot
parent
33d0e824c7
commit
23fe059761
@@ -39,9 +39,7 @@ type Watches struct {
|
||||
}
|
||||
|
||||
func newWatches() *Watches {
|
||||
return &Watches{
|
||||
ws: make(map[uint64]*Watch),
|
||||
}
|
||||
return &Watches{}
|
||||
}
|
||||
|
||||
// MarkUnlinked indicates the target for this set of watches to be unlinked.
|
||||
@@ -78,6 +76,9 @@ func (w *Watches) Add(watch *Watch) {
|
||||
if _, exists := w.ws[watch.ID()]; exists {
|
||||
panic(fmt.Sprintf("Watch collision with ID %+v", watch.ID()))
|
||||
}
|
||||
if w.ws == nil {
|
||||
w.ws = make(map[uint64]*Watch)
|
||||
}
|
||||
w.ws[watch.ID()] = watch
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user