4242#include "utils/memutils.h"
4343
4444/*
45- * The magnetic disk storage manager keeps track of open file
46- * descriptors in its own descriptor pool. This is done to make it
47- * easier to support relations that are larger than the operating
48- * system's file size limit (often 2GBytes). In order to do that,
49- * we break relations up into "segment" files that are each shorter than
50- * the OS file size limit. The segment size is set by the RELSEG_SIZE
51- * configuration constant in pg_config.h.
45+ * The magnetic disk storage manager keeps track of open file
46+ * descriptors in its own descriptor pool. This is done to make it
47+ * easier to support relations that are larger than the operating
48+ * system's file size limit (often 2GBytes). In order to do that,
49+ * we break relations up into "segment" files that are each shorter than
50+ * the OS file size limit. The segment size is set by the RELSEG_SIZE
51+ * configuration constant in pg_config.h.
5252 *
53- * On disk, a relation must consist of consecutively numbered segment
54- * files in the pattern
55- * -- Zero or more full segments of exactly RELSEG_SIZE blocks each
56- * -- Exactly one partial segment of size 0 <= size < RELSEG_SIZE blocks
57- * -- Optionally, any number of inactive segments of size 0 blocks.
58- * The full and partial segments are collectively the "active" segments.
59- * Inactive segments are those that once contained data but are currently
60- * not needed because of an mdtruncate() operation. The reason for leaving
61- * them present at size zero, rather than unlinking them, is that other
62- * backends and/or the checkpointer might be holding open file references to
63- * such segments. If the relation expands again after mdtruncate(), such
64- * that a deactivated segment becomes active again, it is important that
65- * such file references still be valid --- else data might get written
66- * out to an unlinked old copy of a segment file that will eventually
67- * disappear.
53+ * On disk, a relation must consist of consecutively numbered segment
54+ * files in the pattern
55+ * -- Zero or more full segments of exactly RELSEG_SIZE blocks each
56+ * -- Exactly one partial segment of size 0 <= size < RELSEG_SIZE blocks
57+ * -- Optionally, any number of inactive segments of size 0 blocks.
58+ * The full and partial segments are collectively the "active" segments.
59+ * Inactive segments are those that once contained data but are currently
60+ * not needed because of an mdtruncate() operation. The reason for leaving
61+ * them present at size zero, rather than unlinking them, is that other
62+ * backends and/or the checkpointer might be holding open file references to
63+ * such segments. If the relation expands again after mdtruncate(), such
64+ * that a deactivated segment becomes active again, it is important that
65+ * such file references still be valid --- else data might get written
66+ * out to an unlinked old copy of a segment file that will eventually
67+ * disappear.
6868 *
69- * File descriptors are stored in the per-fork md_seg_fds arrays inside
70- * SMgrRelation. The length of these arrays is stored in md_num_open_segs.
71- * Note that a fork's md_num_open_segs having a specific value does not
72- * necessarily mean the relation doesn't have additional segments; we may
73- * just not have opened the next segment yet. (We could not have "all
74- * segments are in the array" as an invariant anyway, since another backend
75- * could extend the relation while we aren't looking.) We do not have
76- * entries for inactive segments, however; as soon as we find a partial
77- * segment, we assume that any subsequent segments are inactive.
69+ * File descriptors are stored in the per-fork md_seg_fds arrays inside
70+ * SMgrRelation. The length of these arrays is stored in md_num_open_segs.
71+ * Note that a fork's md_num_open_segs having a specific value does not
72+ * necessarily mean the relation doesn't have additional segments; we may
73+ * just not have opened the next segment yet. (We could not have "all
74+ * segments are in the array" as an invariant anyway, since another backend
75+ * could extend the relation while we aren't looking.) We do not have
76+ * entries for inactive segments, however; as soon as we find a partial
77+ * segment, we assume that any subsequent segments are inactive.
7878 *
79- * The entire MdfdVec array is palloc'd in the MdCxt memory context.
79+ * The entire MdfdVec array is palloc'd in the MdCxt memory context.
8080 */
8181
8282typedef struct _MdfdVec
@@ -154,7 +154,7 @@ _mdfd_open_flags(void)
154154}
155155
156156/*
157- * mdinit() -- Initialize private state for magnetic disk storage manager.
157+ * mdinit() -- Initialize private state for magnetic disk storage manager.
158158 */
159159void
160160mdinit (void )
@@ -165,7 +165,7 @@ mdinit(void)
165165}
166166
167167/*
168- * mdexists() -- Does the physical file exist?
168+ * mdexists() -- Does the physical file exist?
169169 *
170170 * Note: this will return true for lingering files, with pending deletions
171171 */
@@ -184,7 +184,7 @@ mdexists(SMgrRelation reln, ForkNumber forknum)
184184}
185185
186186/*
187- * mdcreate() -- Create a new relation on magnetic disk.
187+ * mdcreate() -- Create a new relation on magnetic disk.
188188 *
189189 * If isRedo is true, it's okay for the relation to exist already.
190190 */
@@ -242,7 +242,7 @@ mdcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo)
242242}
243243
244244/*
245- * mdunlink() -- Unlink a relation.
245+ * mdunlink() -- Unlink a relation.
246246 *
247247 * Note that we're passed a RelFileLocatorBackend --- by the time this is called,
248248 * there won't be an SMgrRelation hashtable entry anymore.
@@ -447,13 +447,13 @@ mdunlinkfork(RelFileLocatorBackend rlocator, ForkNumber forknum, bool isRedo)
447447}
448448
449449/*
450- * mdextend() -- Add a block to the specified relation.
450+ * mdextend() -- Add a block to the specified relation.
451451 *
452- * The semantics are nearly the same as mdwrite(): write at the
453- * specified position. However, this is to be used for the case of
454- * extending a relation (i.e., blocknum is at or beyond the current
455- * EOF). Note that we assume writing a block beyond current EOF
456- * causes intervening file space to become filled with zeroes.
452+ * The semantics are nearly the same as mdwrite(): write at the
453+ * specified position. However, this is to be used for the case of
454+ * extending a relation (i.e., blocknum is at or beyond the current
455+ * EOF). Note that we assume writing a block beyond current EOF
456+ * causes intervening file space to become filled with zeroes.
457457 */
458458void
459459mdextend (SMgrRelation reln , ForkNumber forknum , BlockNumber blocknum ,
@@ -515,10 +515,10 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
515515}
516516
517517/*
518- * mdzeroextend() -- Add new zeroed out blocks to the specified relation.
518+ * mdzeroextend() -- Add new zeroed out blocks to the specified relation.
519519 *
520- * Similar to mdextend(), except the relation can be extended by multiple
521- * blocks at once and the added blocks will be filled with zeroes.
520+ * Similar to mdextend(), except the relation can be extended by multiple
521+ * blocks at once and the added blocks will be filled with zeroes.
522522 */
523523void
524524mdzeroextend (SMgrRelation reln , ForkNumber forknum ,
@@ -623,7 +623,7 @@ mdzeroextend(SMgrRelation reln, ForkNumber forknum,
623623}
624624
625625/*
626- * mdopenfork() -- Open one fork of the specified relation.
626+ * mdopenfork() -- Open one fork of the specified relation.
627627 *
628628 * Note we only open the first segment, when there are multiple segments.
629629 *
@@ -673,7 +673,7 @@ mdopenfork(SMgrRelation reln, ForkNumber forknum, int behavior)
673673}
674674
675675/*
676- * mdopen() -- Initialize newly-opened relation.
676+ * mdopen() -- Initialize newly-opened relation.
677677 */
678678void
679679mdopen (SMgrRelation reln )
@@ -684,7 +684,7 @@ mdopen(SMgrRelation reln)
684684}
685685
686686/*
687- * mdclose() -- Close the specified relation, if it isn't closed already.
687+ * mdclose() -- Close the specified relation, if it isn't closed already.
688688 */
689689void
690690mdclose (SMgrRelation reln , ForkNumber forknum )
@@ -707,7 +707,7 @@ mdclose(SMgrRelation reln, ForkNumber forknum)
707707}
708708
709709/*
710- * mdprefetch() -- Initiate asynchronous read of the specified block of a relation
710+ * mdprefetch() -- Initiate asynchronous read of the specified block of a relation
711711 */
712712bool
713713mdprefetch (SMgrRelation reln , ForkNumber forknum , BlockNumber blocknum )
@@ -791,7 +791,7 @@ mdwriteback(SMgrRelation reln, ForkNumber forknum,
791791}
792792
793793/*
794- * mdread() -- Read the specified block from a relation.
794+ * mdread() -- Read the specified block from a relation.
795795 */
796796void
797797mdread (SMgrRelation reln , ForkNumber forknum , BlockNumber blocknum ,
@@ -856,11 +856,11 @@ mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
856856}
857857
858858/*
859- * mdwrite() -- Write the supplied block at the appropriate location.
859+ * mdwrite() -- Write the supplied block at the appropriate location.
860860 *
861- * This is to be used only for updating already-existing blocks of a
862- * relation (ie, those before the current EOF). To extend a relation,
863- * use mdextend().
861+ * This is to be used only for updating already-existing blocks of a
862+ * relation (ie, those before the current EOF). To extend a relation,
863+ * use mdextend().
864864 */
865865void
866866mdwrite (SMgrRelation reln , ForkNumber forknum , BlockNumber blocknum ,
@@ -924,12 +924,12 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
924924}
925925
926926/*
927- * mdnblocks() -- Get the number of blocks stored in a relation.
927+ * mdnblocks() -- Get the number of blocks stored in a relation.
928928 *
929- * Important side effect: all active segments of the relation are opened
930- * and added to the md_seg_fds array. If this routine has not been
931- * called, then only segments up to the last one actually touched
932- * are present in the array.
929+ * Important side effect: all active segments of the relation are opened
930+ * and added to the md_seg_fds array. If this routine has not been
931+ * called, then only segments up to the last one actually touched
932+ * are present in the array.
933933 */
934934BlockNumber
935935mdnblocks (SMgrRelation reln , ForkNumber forknum )
@@ -986,7 +986,7 @@ mdnblocks(SMgrRelation reln, ForkNumber forknum)
986986}
987987
988988/*
989- * mdtruncate() -- Truncate relation to specified number of blocks.
989+ * mdtruncate() -- Truncate relation to specified number of blocks.
990990 */
991991void
992992mdtruncate (SMgrRelation reln , ForkNumber forknum , BlockNumber nblocks )
@@ -1080,7 +1080,7 @@ mdtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks)
10801080}
10811081
10821082/*
1083- * mdimmedsync() -- Immediately sync a relation to stable storage.
1083+ * mdimmedsync() -- Immediately sync a relation to stable storage.
10841084 *
10851085 * Note that only writes already issued are synced; this routine knows
10861086 * nothing of dirty buffers that may exist inside the buffer manager. We
@@ -1275,7 +1275,7 @@ DropRelationFiles(RelFileLocator *delrels, int ndelrels, bool isRedo)
12751275
12761276
12771277/*
1278- * _fdvec_resize() -- Resize the fork's open segments array
1278+ * _fdvec_resize() -- Resize the fork's open segments array
12791279 */
12801280static void
12811281_fdvec_resize (SMgrRelation reln ,
@@ -1376,8 +1376,8 @@ _mdfd_openseg(SMgrRelation reln, ForkNumber forknum, BlockNumber segno,
13761376}
13771377
13781378/*
1379- * _mdfd_getseg() -- Find the segment of the relation holding the
1380- * specified block.
1379+ * _mdfd_getseg() -- Find the segment of the relation holding the
1380+ * specified block.
13811381 *
13821382 * If the segment doesn't exist, we ereport, return NULL, or create the
13831383 * segment, according to "behavior". Note: skipFsync is only used in the
0 commit comments