summaryrefslogtreecommitdiff
path: root/src/include/storage/freespace.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-06-27 23:31:40 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-06-27 23:31:40 +0000
commite0c9301c87634f21c0a7c6305bdc6da15d6ba375 (patch)
treeaad976ca0197137c3461ff19a3d0e155487f7b44 /src/include/storage/freespace.h
parentb559382134a52bbe1d79d465afd89c8385f88581 (diff)
Install infrastructure for shared-memory free space map. Doesn't actually
do anything yet, but it has the necessary connections to initialization and so forth. Make some gestures towards allowing number of blocks in a relation to be BlockNumber, ie, unsigned int, rather than signed int. (I doubt I got all the places that are sloppy about it, yet.) On the way, replace the hardwired NLOCKS_PER_XACT fudge factor with a GUC variable.
Diffstat (limited to 'src/include/storage/freespace.h')
-rw-r--r--src/include/storage/freespace.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/include/storage/freespace.h b/src/include/storage/freespace.h
new file mode 100644
index 00000000000..083accccab8
--- /dev/null
+++ b/src/include/storage/freespace.h
@@ -0,0 +1,53 @@
+/*-------------------------------------------------------------------------
+ *
+ * freespace.h
+ * POSTGRES free space map for quickly finding free space in relations
+ *
+ *
+ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * $Id: freespace.h,v 1.1 2001/06/27 23:31:39 tgl Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef FREESPACE_H_
+#define FREESPACE_H_
+
+#include "storage/block.h"
+#include "storage/relfilenode.h"
+#include "storage/spin.h"
+
+
+extern SPINLOCK FreeSpaceLock;
+
+extern int MaxFSMRelations;
+extern int MaxFSMPages;
+
+
+/*
+ * function prototypes
+ */
+extern void InitFreeSpaceMap(void);
+extern int FreeSpaceShmemSize(void);
+
+extern BlockNumber GetPageWithFreeSpace(RelFileNode *rel, Size spaceNeeded);
+extern void RecordFreeSpace(RelFileNode *rel, BlockNumber page,
+ Size spaceAvail);
+extern BlockNumber RecordAndGetPageWithFreeSpace(RelFileNode *rel,
+ BlockNumber oldPage,
+ Size oldSpaceAvail,
+ Size spaceNeeded);
+extern void MultiRecordFreeSpace(RelFileNode *rel,
+ BlockNumber minPage,
+ BlockNumber maxPage,
+ int nPages,
+ BlockNumber *pages,
+ Size *spaceAvail);
+extern void FreeSpaceMapForgetRel(RelFileNode *rel);
+
+#ifdef FREESPACE_DEBUG
+extern void DumpFreeSpace(void);
+#endif
+
+#endif /* FREESPACE_H */