aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2013-02-18 14:22:58 +0100
committerLukas Larsson <[email protected]>2013-02-18 14:22:58 +0100
commit710cd8efa09ecb62af06f61402683bf2a13481fc (patch)
treeb1a519cfeb0a49035952b0f4ac270cb8d9c2da58 /erts
parent7ae0bc7ee6be2f4b712f4147e100b2a9cca1358f (diff)
parent447bb87e842b235705e8b92db2918df8eb50ac09 (diff)
downloadotp-710cd8efa09ecb62af06f61402683bf2a13481fc.tar.gz
otp-710cd8efa09ecb62af06f61402683bf2a13481fc.tar.bz2
otp-710cd8efa09ecb62af06f61402683bf2a13481fc.zip
Merge branch 'lukas/erts/file_read_line_opt/OTP-10859'
* lukas/erts/file_read_line_opt/OTP-10859: invoke_read_line now remembers read_ahead settings
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/drivers/common/efile_drv.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/erts/emulator/drivers/common/efile_drv.c b/erts/emulator/drivers/common/efile_drv.c
index 2279fec72a..22328fcd11 100644
--- a/erts/emulator/drivers/common/efile_drv.c
+++ b/erts/emulator/drivers/common/efile_drv.c
@@ -1160,7 +1160,14 @@ static void invoke_read_line(void *data)
/* Need more place */
ErlDrvSizeT need = (d->c.read_line.read_size >= DEFAULT_LINEBUF_SIZE) ?
d->c.read_line.read_size + DEFAULT_LINEBUF_SIZE : DEFAULT_LINEBUF_SIZE;
- ErlDrvBinary *newbin = driver_alloc_binary(need);
+ ErlDrvBinary *newbin;
+#if !ALWAYS_READ_LINE_AHEAD
+ /* Use read_ahead size if need does not exceed it */
+ if (need < (d->c.read_line.binp)->orig_size &&
+ d->c.read_line.read_ahead)
+ need = (d->c.read_line.binp)->orig_size;
+#endif
+ newbin = driver_alloc_binary(need);
if (newbin == NULL) {
d->result_ok = 0;
d->errInfo.posix_errno = ENOMEM;