Upgrade BufFile to use int64 for byte positions
Michael Paquier <michael@paquier.xyz>
Upgrade BufFile to use int64 for byte positions This change has the advantage of removing some weird type casts, caused by offset calculations based on pgoff_t but saved as int (on older branches we use off_t, which could be 4 or 8 bytes depending on the environment). These are safe currently because capped by MAX_PHYSICAL_FILESIZE, but we would run into problems when to make MAX_PHYSICAL_FILESIZE larger or allow callers of these routines to use a larger physical max size on demand. While on it, this improves BufFileDumpBuffer() so as we do not use an offset for "availbytes". It is not a file offset per-set, but a number of available bytes. This change should lead to no functional changes. Author: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/aUStrqoOCDRFAq1M@paquier.xyz
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/storage/file/buffile.c | modified | +10 −10 |
Discussion
- Switch buffile.c/h to use pgoff_t 13 messages · 2025-12-19 → 2025-12-26