@@ -669,7 +669,7 @@ SlruPhysicalReadPage(SlruCtl ctl, int pageno, int slotno)
669
669
SlruShared shared = ctl -> shared ;
670
670
int segno = pageno / SLRU_PAGES_PER_SEGMENT ;
671
671
int rpageno = pageno % SLRU_PAGES_PER_SEGMENT ;
672
- int offset = rpageno * BLCKSZ ;
672
+ off_t offset = rpageno * BLCKSZ ;
673
673
char path [MAXPGPATH ];
674
674
int fd ;
675
675
@@ -699,17 +699,9 @@ SlruPhysicalReadPage(SlruCtl ctl, int pageno, int slotno)
699
699
return true;
700
700
}
701
701
702
- if (lseek (fd , (off_t ) offset , SEEK_SET ) < 0 )
703
- {
704
- slru_errcause = SLRU_SEEK_FAILED ;
705
- slru_errno = errno ;
706
- CloseTransientFile (fd );
707
- return false;
708
- }
709
-
710
702
errno = 0 ;
711
703
pgstat_report_wait_start (WAIT_EVENT_SLRU_READ );
712
- if (read (fd , shared -> page_buffer [slotno ], BLCKSZ ) != BLCKSZ )
704
+ if (pg_pread (fd , shared -> page_buffer [slotno ], BLCKSZ , offset ) != BLCKSZ )
713
705
{
714
706
pgstat_report_wait_end ();
715
707
slru_errcause = SLRU_READ_FAILED ;
@@ -749,7 +741,7 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
749
741
SlruShared shared = ctl -> shared ;
750
742
int segno = pageno / SLRU_PAGES_PER_SEGMENT ;
751
743
int rpageno = pageno % SLRU_PAGES_PER_SEGMENT ;
752
- int offset = rpageno * BLCKSZ ;
744
+ off_t offset = rpageno * BLCKSZ ;
753
745
char path [MAXPGPATH ];
754
746
int fd = -1 ;
755
747
@@ -862,18 +854,9 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
862
854
}
863
855
}
864
856
865
- if (lseek (fd , (off_t ) offset , SEEK_SET ) < 0 )
866
- {
867
- slru_errcause = SLRU_SEEK_FAILED ;
868
- slru_errno = errno ;
869
- if (!fdata )
870
- CloseTransientFile (fd );
871
- return false;
872
- }
873
-
874
857
errno = 0 ;
875
858
pgstat_report_wait_start (WAIT_EVENT_SLRU_WRITE );
876
- if (write (fd , shared -> page_buffer [slotno ], BLCKSZ ) != BLCKSZ )
859
+ if (pg_pwrite (fd , shared -> page_buffer [slotno ], BLCKSZ , offset ) != BLCKSZ )
877
860
{
878
861
pgstat_report_wait_end ();
879
862
/* if write didn't set errno, assume problem is no disk space */
0 commit comments