@@ -985,7 +985,7 @@ LruDelete(File file)
985
985
{
986
986
if (cfs_munmap (vfdP -> map ))
987
987
elog (ERROR , "could not unmap file \"%s.cfm\": %m" , vfdP -> fileName );
988
-
988
+
989
989
if (close (vfdP -> md ))
990
990
elog (ERROR , "could not close map file \"%s.cfm\": %m" , vfdP -> fileName );
991
991
@@ -1068,10 +1068,10 @@ LruInsert(File file)
1068
1068
* overall system file table being full. So, be prepared to release
1069
1069
* another FD if necessary...
1070
1070
*/
1071
- if (vfdP -> fileFlags & PG_COMPRESSION )
1071
+ if (vfdP -> fileFlags & PG_COMPRESSION )
1072
1072
{
1073
1073
char * mapFileName = psprintf ("%s.cfm" , vfdP -> fileName );
1074
- vfdP -> md = open (mapFileName , vfdP -> fileFlags & ~PG_COMPRESSION , vfdP -> fileMode );
1074
+ vfdP -> md = BasicOpenFile (mapFileName , vfdP -> fileFlags & ~PG_COMPRESSION , vfdP -> fileMode );
1075
1075
pfree (mapFileName );
1076
1076
if (vfdP -> md < 0 )
1077
1077
{
@@ -1598,7 +1598,7 @@ FileClose(File file)
1598
1598
if (unlink (vfdP -> fileName ))
1599
1599
elog (LOG , "could not unlink file \"%s\": %m" , vfdP -> fileName );
1600
1600
1601
- if (vfdP -> fileFlags & PG_COMPRESSION ) {
1601
+ if (vfdP -> fileFlags & PG_COMPRESSION ) {
1602
1602
char * mapFileName = psprintf ("%s.cfm" , vfdP -> fileName );
1603
1603
if (unlink (mapFileName ))
1604
1604
elog (LOG , "could not unlink file \"%s\": %m" , mapFileName );
@@ -1716,7 +1716,7 @@ FileLock(File file)
1716
1716
1717
1717
map_generation = vfdP -> map -> generation ;
1718
1718
pg_read_barrier ();
1719
-
1719
+
1720
1720
/* Reopen file, because it was rewritten by gc */
1721
1721
if (vfdP -> generation != map_generation )
1722
1722
{
@@ -1759,7 +1759,7 @@ FileRead(File file, char *buffer, int amount)
1759
1759
if (VfdCache [file ].seekPos / BLCKSZ >= RELSEG_SIZE )
1760
1760
return 0 ;
1761
1761
1762
- if (!FileLock (file ))
1762
+ if (!FileLock (file ))
1763
1763
return -1 ;
1764
1764
1765
1765
inode = map -> inodes [VfdCache [file ].seekPos / BLCKSZ ];
@@ -1777,7 +1777,7 @@ FileRead(File file, char *buffer, int amount)
1777
1777
return amount ;
1778
1778
}
1779
1779
1780
- seekPos = lseek (VfdCache [file ].fd , CFS_INODE_OFFS (inode ), SEEK_SET );
1780
+ seekPos = lseek (VfdCache [file ].fd , CFS_INODE_OFFS (inode ), SEEK_SET );
1781
1781
Assert (seekPos == (off_t )CFS_INODE_OFFS (inode ));
1782
1782
1783
1783
if (amount < BLCKSZ )
@@ -1798,10 +1798,10 @@ FileRead(File file, char *buffer, int amount)
1798
1798
if (errno != EINTR )
1799
1799
{
1800
1800
if (returnCode == 0 )
1801
- elog (LOG , "Block %u position %u size %u is beyond end of compressed file %s" ,
1801
+ elog (LOG , "Block %u position %u size %u is beyond end of compressed file %s" ,
1802
1802
(uint32 )(VfdCache [file ].seekPos / BLCKSZ ), (uint32 )seekPos , size , VfdCache [file ].fileName );
1803
1803
else
1804
- elog (LOG , "Failed to read block %u position %u size %u from compressed file %s: %m" ,
1804
+ elog (LOG , "Failed to read block %u position %u size %u from compressed file %s: %m" ,
1805
1805
(uint32 )(VfdCache [file ].seekPos / BLCKSZ ), (uint32 )seekPos , size , VfdCache [file ].fileName );
1806
1806
cfs_unlock_file (map );
1807
1807
return returnCode ;
@@ -1818,7 +1818,7 @@ FileRead(File file, char *buffer, int amount)
1818
1818
INIT_TRADITIONAL_CRC32 (crc );
1819
1819
COMP_TRADITIONAL_CRC32 (crc , compressedBuffer , amount );
1820
1820
FIN_TRADITIONAL_CRC32 (crc );
1821
- elog (LOG , "CFS: decompress error: %d for file %s block %u position %u compressed size %u crc %x" ,
1821
+ elog (LOG , "CFS: decompress error: %d for file %s block %u position %u compressed size %u crc %x" ,
1822
1822
returnCode , VfdCache [file ].fileName , (uint32 )(VfdCache [file ].seekPos / BLCKSZ ), (uint32 )seekPos , amount , crc );
1823
1823
VfdCache [file ].seekPos = FileUnknownPos ;
1824
1824
returnCode = -1 ;
@@ -1835,7 +1835,7 @@ FileRead(File file, char *buffer, int amount)
1835
1835
returnCode = read (VfdCache [file ].fd , buffer , amount );
1836
1836
if (returnCode >= 0 )
1837
1837
{
1838
- if (VfdCache [file ].fileFlags & PG_COMPRESSION )
1838
+ if (VfdCache [file ].fileFlags & PG_COMPRESSION )
1839
1839
{
1840
1840
cfs_decrypt (VfdCache [file ].fileName , buffer , VfdCache [file ].seekPos , amount );
1841
1841
}
@@ -1874,7 +1874,7 @@ FileRead(File file, char *buffer, int amount)
1874
1874
VfdCache [file ].seekPos = FileUnknownPos ;
1875
1875
}
1876
1876
1877
- if (VfdCache [file ].fileFlags & PG_COMPRESSION )
1877
+ if (VfdCache [file ].fileFlags & PG_COMPRESSION )
1878
1878
{
1879
1879
cfs_unlock_file (VfdCache [file ].map );
1880
1880
}
@@ -1884,7 +1884,7 @@ FileRead(File file, char *buffer, int amount)
1884
1884
int
1885
1885
FileWrite (File file , char * buffer , int amount )
1886
1886
{
1887
- int returnCode ;
1887
+ int returnCode ;
1888
1888
char compressedBuffer [CFS_MAX_COMPRESSED_SIZE (BLCKSZ )];
1889
1889
inode_t inode = 0 ;
1890
1890
/*inode_t prev_inode;*/
@@ -1943,7 +1943,7 @@ FileWrite(File file, char *buffer, int amount)
1943
1943
}
1944
1944
}
1945
1945
1946
- if (VfdCache [file ].fileFlags & PG_COMPRESSION )
1946
+ if (VfdCache [file ].fileFlags & PG_COMPRESSION )
1947
1947
{
1948
1948
FileMap * map = VfdCache [file ].map ;
1949
1949
uint32 compressedSize ;
@@ -2019,7 +2019,7 @@ FileWrite(File file, char *buffer, int amount)
2019
2019
if (VfdCache [file ].fileFlags & PG_COMPRESSION )
2020
2020
{
2021
2021
if (returnCode == amount )
2022
- {
2022
+ {
2023
2023
VfdCache [file ].map -> inodes [VfdCache [file ].seekPos / BLCKSZ ] = inode ;
2024
2024
VfdCache [file ].seekPos += BLCKSZ ;
2025
2025
cfs_extend (VfdCache [file ].map , VfdCache [file ].seekPos );
@@ -2083,17 +2083,17 @@ FileWrite(File file, char *buffer, int amount)
2083
2083
vfdP -> seekPos = FileUnknownPos ;
2084
2084
}
2085
2085
2086
- if (VfdCache [file ].fileFlags & PG_COMPRESSION )
2086
+ if (VfdCache [file ].fileFlags & PG_COMPRESSION )
2087
2087
{
2088
2088
cfs_unlock_file (VfdCache [file ].map );
2089
- /*
2090
- * If GC is disabled for a long time, then faile can unlimited grow.
2089
+ /*
2090
+ * If GC is disabled for a long time, then file can unlimited grow.
2091
2091
* To avoid wrap aound of 32-bit offsets we force GC on this file when destination position
2092
- * cross 2Gb boundary.
2092
+ * cross 2Gb boundary.
2093
2093
*/
2094
- if ((int32 )pos >= 0 && (int32 )(pos + amount ) < 0 )
2095
- {
2096
- elog (LOG , "CFS: backend %d forced to performe GC on file %s block %u because it's size exceed %u bytes" ,
2094
+ if ((int32 )pos >= 0 && (int32 )(pos + amount ) < 0 )
2095
+ {
2096
+ elog (LOG , "CFS: backend %d forced to perform GC on file %s block %u because it's size exceed %u bytes" ,
2097
2097
MyProcPid , VfdCache [file ].fileName , (uint32 )(VfdCache [file ].seekPos / BLCKSZ ), pos );
2098
2098
cfs_gc_segment (VfdCache [file ].fileName );
2099
2099
}
@@ -2261,8 +2261,8 @@ FileTruncate(File file, off_t offset)
2261
2261
2262
2262
pg_atomic_write_u32 (& map -> virtSize , offset );
2263
2263
pg_atomic_fetch_sub_u32 (& map -> usedSize , released );
2264
-
2265
- if (offset == 0 )
2264
+
2265
+ if (offset == 0 )
2266
2266
{
2267
2267
/* We can truncate compressed file only with zero offset */
2268
2268
pg_atomic_write_u32 (& map -> physSize , 0 );
0 commit comments