@@ -78,6 +78,8 @@ typedef struct SlruFlushData
7878 int segno [MAX_FLUSH_BUFFERS ]; /* their log seg#s */
7979} SlruFlushData ;
8080
81+ typedef struct SlruFlushData * SlruFlush ;
82+
8183/*
8284 * Macro to mark a buffer slot "most recently used". Note multiple evaluation
8385 * of arguments!
@@ -123,6 +125,7 @@ static int slru_errno;
123125
124126static void SimpleLruZeroLSNs (SlruCtl ctl , int slotno );
125127static void SimpleLruWaitIO (SlruCtl ctl , int slotno );
128+ static void SlruInternalWritePage (SlruCtl ctl , int slotno , SlruFlush fdata );
126129static bool SlruPhysicalReadPage (SlruCtl ctl , int pageno , int slotno );
127130static bool SlruPhysicalWritePage (SlruCtl ctl , int pageno , int slotno ,
128131 SlruFlush fdata );
@@ -485,8 +488,8 @@ SimpleLruReadPage_ReadOnly(SlruCtl ctl, int pageno, TransactionId xid)
485488 *
486489 * Control lock must be held at entry, and will be held at exit.
487490 */
488- void
489- SimpleLruWritePage (SlruCtl ctl , int slotno , SlruFlush fdata )
491+ static void
492+ SlruInternalWritePage (SlruCtl ctl , int slotno , SlruFlush fdata )
490493{
491494 SlruShared shared = ctl -> shared ;
492495 int pageno = shared -> page_number [slotno ];
@@ -552,6 +555,17 @@ SimpleLruWritePage(SlruCtl ctl, int slotno, SlruFlush fdata)
552555 SlruReportIOError (ctl , pageno , InvalidTransactionId );
553556}
554557
558+ /*
559+ * Wrapper of SlruInternalWritePage, for external callers.
560+ * fdata is always passed a NULL here.
561+ */
562+ void
563+ SimpleLruWritePage (SlruCtl ctl , int slotno )
564+ {
565+ SlruInternalWritePage (ctl , slotno , NULL );
566+ }
567+
568+
555569/*
556570 * Physical read of a (previously existing) page into a buffer slot
557571 *
@@ -975,7 +989,7 @@ SlruSelectLRUPage(SlruCtl ctl, int pageno)
975989 * we wait for the existing I/O to complete.
976990 */
977991 if (shared -> page_status [bestslot ] == SLRU_PAGE_VALID )
978- SimpleLruWritePage (ctl , bestslot , NULL );
992+ SlruInternalWritePage (ctl , bestslot , NULL );
979993 else
980994 SimpleLruWaitIO (ctl , bestslot );
981995
@@ -1009,7 +1023,7 @@ SimpleLruFlush(SlruCtl ctl, bool checkpoint)
10091023
10101024 for (slotno = 0 ; slotno < shared -> num_slots ; slotno ++ )
10111025 {
1012- SimpleLruWritePage (ctl , slotno , & fdata );
1026+ SlruInternalWritePage (ctl , slotno , & fdata );
10131027
10141028 /*
10151029 * When called during a checkpoint, we cannot assert that the slot is
@@ -1114,7 +1128,7 @@ restart:;
11141128 * keep the logic the same as it was.)
11151129 */
11161130 if (shared -> page_status [slotno ] == SLRU_PAGE_VALID )
1117- SimpleLruWritePage (ctl , slotno , NULL );
1131+ SlruInternalWritePage (ctl , slotno , NULL );
11181132 else
11191133 SimpleLruWaitIO (ctl , slotno );
11201134 goto restart ;
0 commit comments