From 787134e8b44cccea10720febb462117f1685b197 Mon Sep 17 00:00:00 2001
From: Melanie Plageman <melanieplageman@gmail.com>
Date: Wed, 17 Jun 2026 15:51:06 -0400
Subject: [PATCH v15 11/19] Inline BufferSync() into CheckPointBuffers()

CheckPointBuffers() contained only the static function call to
BufferSync(). It seemed more confusing than anything else. Inline the
code of BufferSync().
---
 src/backend/storage/buffer/bufmgr.c | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 9bdfc6b7f99..713aba1260d 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -663,7 +663,6 @@ static bool PinBuffer(BufferDesc *buf, BufferUsageCountChange usage_count_change
 static void PinBuffer_Locked(BufferDesc *buf);
 static void UnpinBuffer(BufferDesc *buf);
 static void UnpinBufferNoOwner(BufferDesc *buf);
-static void BufferSync(int flags);
 static int	SyncOneBuffer(int buf_id, bool skip_recently_used,
 						  WritebackContext *wb_context);
 static void WaitIO(BufferDesc *buf);
@@ -3754,7 +3753,7 @@ TrackNewBufferPin(Buffer buf)
 #include "lib/sort_template.h"
 
 /*
- * BufferSync -- Write out all dirty buffers in the pool.
+ * Write out all dirty buffers in the buffer pool.
  *
  * This is called at checkpoint time to write out all dirty shared buffers.
  * The checkpoint request flags should be passed in.  If CHECKPOINT_FAST is
@@ -3762,9 +3761,12 @@ TrackNewBufferPin(Buffer buf)
  * CHECKPOINT_END_OF_RECOVERY or CHECKPOINT_FLUSH_UNLOGGED is set, we write
  * even unlogged buffers, which are otherwise skipped.  The remaining flags
  * currently have no effect here.
+ *
+ * Note: temporary relations do not participate in checkpoints, so they don't
+ * need to be flushed.
  */
-static void
-BufferSync(int flags)
+void
+CheckPointBuffers(int flags)
 {
 	uint64		buf_state;
 	int			buf_id;
@@ -4636,20 +4638,6 @@ DebugPrintBufferRefcount(Buffer buffer)
 	return result;
 }
 
-/*
- * CheckPointBuffers
- *
- * Flush all dirty blocks in buffer pool to disk at checkpoint time.
- *
- * Note: temporary relations do not participate in checkpoints, so they don't
- * need to be flushed.
- */
-void
-CheckPointBuffers(int flags)
-{
-	BufferSync(flags);
-}
-
 /*
  * BufferGetBlockNumber
  *		Returns the block number associated with a buffer.
-- 
2.43.0

