diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/access/slru.h | 62 | ||||
| -rw-r--r-- | src/include/storage/lwlock.h | 3 |
2 files changed, 63 insertions, 2 deletions
diff --git a/src/include/access/slru.h b/src/include/access/slru.h new file mode 100644 index 00000000000..1386d7e2013 --- /dev/null +++ b/src/include/access/slru.h @@ -0,0 +1,62 @@ +/* + * slru.h + * + * Simple LRU + * + * Portions Copyright (c) 2003, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * $Id: slru.h,v 1.1 2003/06/11 22:37:46 momjian Exp $ + */ +#ifndef SLRU_H +#define SLRU_H + +#include "access/xlog.h" + +/* exported because lwlock.c needs it */ +#define NUM_CLOG_BUFFERS 8 + +typedef struct SlruLockData +{ + LWLockId ControlLock; +/* + * BufferLocks is set during CLOGShmemInit and does not change thereafter. + * The value is automatically inherited by backends via fork, and + * doesn't need to be in shared memory. + */ + LWLockId BufferLocks[NUM_CLOG_BUFFERS]; /* Per-buffer I/O locks */ +} SlruLockData; +typedef SlruLockData *SlruLock; + +typedef struct SlruCtlData +{ + void *shared; /* pointer to SlruSharedData */ + SlruLock locks; + +/* + * Dir is set during SimpleLruShmemInit and does not change thereafter. + * The value is automatically inherited by backends via fork, and + * doesn't need to be in shared memory. + */ + char Dir[MAXPGPATH]; + +/* + * Decide which of two page numbers is "older" for truncation purposes. + * We need to use comparison of TransactionIds here in order to do the right + * thing with wraparound XID arithmetic. + */ + bool (*PagePrecedes)(int, int); + +} SlruCtlData; +typedef SlruCtlData *SlruCtl; + +extern int SimpleLruShmemSize(void); +extern void SimpleLruInit(SlruCtl ctl, const char *name, const char *subdir); +extern int SimpleLruZeroPage(SlruCtl ctl, int pageno); +extern char *SimpleLruReadPage(SlruCtl ctl, int pageno, TransactionId xid, bool forwrite); +extern void SimpleLruWritePage(SlruCtl ctl, int slotno); +extern void SimpleLruSetLatestPage(SlruCtl ctl, int pageno); +extern void SimpleLruFlush(SlruCtl ctl, bool checkpoint); +extern void SimpleLruTruncate(SlruCtl ctl, int cutoffPage); + +#endif /* SLRU_H */ diff --git a/src/include/storage/lwlock.h b/src/include/storage/lwlock.h index e061cd82b7e..6a2d8c5a1c8 100644 --- a/src/include/storage/lwlock.h +++ b/src/include/storage/lwlock.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: lwlock.h,v 1.6 2002/06/20 20:29:52 momjian Exp $ + * $Id: lwlock.h,v 1.7 2003/06/11 22:37:46 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -37,7 +37,6 @@ typedef enum LWLockId WALWriteLock, ControlFileLock, CheckpointLock, - CLogControlLock, RelCacheInitLock, NumFixedLWLocks, /* must be last except for |
