Previously, scanblock called checknocurrentwbuf() after
drainworkbuf(). Move this call into drainworkbuf so that every return
path from drainworkbuf calls checknocurrentwbuf(). This is equivalent
to the previous code because scanblock was the only caller of
drainworkbuf.
Change-Id: I96ef2168c8aa169bfc4d368f296342fa0fbeafb4
Reviewed-on: https://go-review.googlesource.com/4780
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
drainallwbufs := b == 0
drainworkbuf(wbuf, drainallwbufs)
- checknocurrentwbuf()
return nil
}
if wbuf.nobj == 0 {
putempty(wbuf, 496)
if !drainallwbufs {
- checknocurrentwbuf()
- return
+ break
}
// Refill workbuf from global queue.
wbuf = getfull(504)
if wbuf == nil { // nil means out of work barrier reached
- return
+ break
}
wbuf.checknonempty()
}
// a performance hit as we keep fetching fresh wbufs.
wbuf = scanobject(b, 0, nil, wbuf)
}
+ checknocurrentwbuf()
}
// Scan count objects starting with those in wbuf.