Commit 3879f0ab authored by Russ Cox's avatar Russ Cox

os: cut limited read to 1 GB

If systems actually read that much, using 2GB-1 will
result in misaligned subsequent reads. Use 1GB instead,
which will certainly keep reads aligned and which is
plenty large enough.

Update #7812.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/94070044
parent 3b3e1a09
......@@ -174,9 +174,11 @@ func (f *File) readdir(n int) (fi []FileInfo, err error) {
// Darwin and FreeBSD can't read or write 2GB+ at a time,
// even on 64-bit systems. See golang.org/issue/7812.
// Use 1GB instead of, say, 2GB-1, to keep subsequent
// reads aligned.
const (
needsMaxRW = runtime.GOOS == "darwin" || runtime.GOOS == "freebsd"
maxRW = 2<<30 - 1
maxRW = 1 << 30
)
// read reads up to len(b) bytes from the File.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment