* buf_ensure_head_space() -- If there is no space in the header words, * move words in the given buffer to disk and free the existing space, * and then allocate new space for future new words. * * The number of bytes freed are returned. */
| 1959 | * The number of bytes freed are returned. |
| 1960 | */ |
| 1961 | static uint16 |
| 1962 | buf_ensure_head_space(Relation rel, BMTIDBuffer *buf, |
| 1963 | Buffer lovBuffer, OffsetNumber off, bool use_wal) |
| 1964 | { |
| 1965 | uint16 bytes_freed = 0; |
| 1966 | |
| 1967 | if (buf->curword >= (BM_NUM_OF_HEADER_WORDS * BM_HRL_WORD_SIZE)) |
| 1968 | { |
| 1969 | bytes_freed = buf_free_mem_block(rel, buf, lovBuffer, off, use_wal); |
| 1970 | bytes_freed -= buf_extend(buf); |
| 1971 | } |
| 1972 | |
| 1973 | return bytes_freed; |
| 1974 | } |
| 1975 | |
| 1976 | /* |
| 1977 | * buf_extend() -- Enlarge the memory allocated to a buffer. |
no test coverage detected