diff options
| author | Heikki Linnakangas | 2016-10-12 09:05:45 +0000 |
|---|---|---|
| committer | Heikki Linnakangas | 2016-10-12 09:05:45 +0000 |
| commit | b75f467b6eec0678452fd8d7f8d306e6df3a1076 (patch) | |
| tree | 43405283bb7a2c03dd850129de8eee4c980422e1 /src/include | |
| parent | 2f1eaf87e868a1c42f2b159958623daa6a666de4 (diff) | |
Simplify the code for logical tape read buffers.
Pass the buffer size as argument to LogicalTapeRewindForRead, rather than
setting it earlier with the separate LogicTapeAssignReadBufferSize call.
This way, the buffer size is set closer to where it's actually used, which
makes the code easier to understand.
This makes the calculation for how much memory to use for the buffers less
precise. We now use the same amount of memory for every tape, rounded down
to the nearest BLCKSZ boundary, instead of using one more block for some
tapes, to get the total up to exact amount of memory available. That should
be OK, merging isn't too sensitive to the exact amount of memory used.
Reviewed by Peter Geoghegan
Discussion: <0f607c4b-df23-353e-bf56-c0389d28495f@iki.fi>
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/utils/logtape.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/include/utils/logtape.h b/src/include/utils/logtape.h index 362a6196dc..d7dccb85be 100644 --- a/src/include/utils/logtape.h +++ b/src/include/utils/logtape.h @@ -31,7 +31,9 @@ extern size_t LogicalTapeRead(LogicalTapeSet *lts, int tapenum, void *ptr, size_t size); extern void LogicalTapeWrite(LogicalTapeSet *lts, int tapenum, void *ptr, size_t size); -extern void LogicalTapeRewind(LogicalTapeSet *lts, int tapenum, bool forWrite); +extern void LogicalTapeRewindForRead(LogicalTapeSet *lts, int tapenum, + size_t buffer_size); +extern void LogicalTapeRewindForWrite(LogicalTapeSet *lts, int tapenum); extern void LogicalTapeFreeze(LogicalTapeSet *lts, int tapenum); extern bool LogicalTapeBackspace(LogicalTapeSet *lts, int tapenum, size_t size); @@ -39,8 +41,6 @@ extern bool LogicalTapeSeek(LogicalTapeSet *lts, int tapenum, long blocknum, int offset); extern void LogicalTapeTell(LogicalTapeSet *lts, int tapenum, long *blocknum, int *offset); -extern void LogicalTapeAssignReadBufferSize(LogicalTapeSet *lts, int tapenum, - size_t bufsize); extern long LogicalTapeSetBlocks(LogicalTapeSet *lts); #endif /* LOGTAPE_H */ |
