diff options
Diffstat (limited to 'src/include/storage')
-rw-r--r-- | src/include/storage/freespace.h | 53 | ||||
-rw-r--r-- | src/include/storage/ipc.h | 3 | ||||
-rw-r--r-- | src/include/storage/lock.h | 17 | ||||
-rw-r--r-- | src/include/storage/smgr.h | 15 |
4 files changed, 66 insertions, 22 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 */ diff --git a/src/include/storage/ipc.h b/src/include/storage/ipc.h index aa685fc8ff6..8ce1a845930 100644 --- a/src/include/storage/ipc.h +++ b/src/include/storage/ipc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: ipc.h,v 1.49 2001/03/22 04:01:05 momjian Exp $ + * $Id: ipc.h,v 1.50 2001/06/27 23:31:39 tgl Exp $ * * Some files that would normally need to include only sys/ipc.h must * instead include this file because on Ultrix, sys/ipc.h is not designed @@ -74,6 +74,7 @@ typedef enum _LockId_ LOCKMGRLOCKID, SINVALLOCKID, PROCSTRUCTLOCKID, + FREESPACELOCKID, #ifdef STABLE_MEMORY_STORAGE MMCACHELOCKID, diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h index 2428a782a67..30a13649e43 100644 --- a/src/include/storage/lock.h +++ b/src/include/storage/lock.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: lock.h,v 1.49 2001/06/22 00:04:59 tgl Exp $ + * $Id: lock.h,v 1.50 2001/06/27 23:31:39 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -32,6 +32,8 @@ typedef struct proc PROC; extern SPINLOCK LockMgrLock; +extern int max_locks_per_xact; + #ifdef LOCK_DEBUG extern int Trace_lock_oidmin; extern bool Trace_locks; @@ -41,19 +43,6 @@ extern bool Debug_deadlocks; #endif /* LOCK_DEBUG */ -/* ---------------------- - * The following defines are used to estimate how much shared - * memory the lock manager is going to require. - * See LockShmemSize() in lock.c. - * - * NLOCKS_PER_XACT - The number of unique objects locked in a transaction - * (this should be configurable!) - * NLOCKENTS - The maximum number of lock entries in the lock table. - * ---------------------- - */ -#define NLOCKS_PER_XACT 64 -#define NLOCKENTS(maxBackends) (NLOCKS_PER_XACT*(maxBackends)) - typedef int LOCKMASK; typedef int LOCKMODE; diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h index b6c5af72dec..b4193b5fa82 100644 --- a/src/include/storage/smgr.h +++ b/src/include/storage/smgr.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: smgr.h,v 1.29 2001/05/10 20:38:49 tgl Exp $ + * $Id: smgr.h,v 1.30 2001/06/27 23:31:39 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -43,8 +43,9 @@ extern int smgrblindwrt(int16 which, RelFileNode rnode, extern int smgrblindmarkdirty(int16 which, RelFileNode rnode, BlockNumber blkno); extern int smgrmarkdirty(int16 which, Relation reln, BlockNumber blkno); -extern int smgrnblocks(int16 which, Relation reln); -extern int smgrtruncate(int16 which, Relation reln, int nblocks); +extern BlockNumber smgrnblocks(int16 which, Relation reln); +extern BlockNumber smgrtruncate(int16 which, Relation reln, + BlockNumber nblocks); extern int smgrDoPendingDeletes(bool isCommit); extern int smgrcommit(void); extern int smgrabort(void); @@ -71,8 +72,8 @@ extern int mdmarkdirty(Relation reln, BlockNumber blkno); extern int mdblindwrt(RelFileNode rnode, BlockNumber blkno, char *buffer, bool dofsync); extern int mdblindmarkdirty(RelFileNode rnode, BlockNumber blkno); -extern int mdnblocks(Relation reln); -extern int mdtruncate(Relation reln, int nblocks); +extern BlockNumber mdnblocks(Relation reln); +extern BlockNumber mdtruncate(Relation reln, BlockNumber nblocks); extern int mdcommit(void); extern int mdabort(void); extern int mdsync(void); @@ -95,8 +96,8 @@ extern int mmblindwrt(char *dbname, char *relname, Oid dbid, Oid relid, extern int mmmarkdirty(Relation reln, BlockNumber blkno); extern int mmblindmarkdirty(char *dbname, char *relname, Oid dbid, Oid relid, BlockNumber blkno); -extern int mmnblocks(Relation reln); -extern int mmtruncate(Relation reln, int nblocks); +extern BlockNumber mmnblocks(Relation reln); +extern BlockNumber mmtruncate(Relation reln, BlockNumber nblocks); extern int mmcommit(void); extern int mmabort(void); |