MCPcopy Create free account
hub / github.com/apache/cloudberry / ScheduleBufferTagForWriteback

Function ScheduleBufferTagForWriteback

src/backend/storage/buffer/bufmgr.c:5031–5056  ·  view source on GitHub ↗

* Add buffer to list of pending writeback requests. */

Source from the content-addressed store, hash-verified

5029 * Add buffer to list of pending writeback requests.
5030 */
5031void
5032ScheduleBufferTagForWriteback(WritebackContext *context, BufferTag *tag)
5033{
5034 PendingWriteback *pending;
5035
5036 /*
5037 * Add buffer to the pending writeback array, unless writeback control is
5038 * disabled.
5039 */
5040 if (*context->max_pending > 0)
5041 {
5042 Assert(*context->max_pending <= WRITEBACK_MAX_PENDING_FLUSHES);
5043
5044 pending = &context->pending_writebacks[context->nr_pending++];
5045
5046 pending->tag = *tag;
5047 }
5048
5049 /*
5050 * Perform pending flushes if the writeback limit is exceeded. This
5051 * includes the case where previously an item has been added, but control
5052 * is now disabled.
5053 */
5054 if (context->nr_pending >= *context->max_pending)
5055 IssuePendingWritebacks(context);
5056}
5057
5058#define ST_SORT sort_pending_writebacks
5059#define ST_ELEMENT_TYPE PendingWriteback

Callers 2

BufferAllocFunction · 0.85
SyncOneBufferFunction · 0.85

Calls 1

IssuePendingWritebacksFunction · 0.85

Tested by

no test coverage detected