mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Relax the requirement that all lwlocks be stored in a single array.
This makes it possible to store lwlocks as part of some other data structure in the main shared memory segment, or in a dynamic shared memory segment. There is still a main LWLock array and this patch does not move anything out of it, but it provides necessary infrastructure for doing that in the future. This change is likely to increase the size of LWLockPadded on some platforms, especially 32-bit platforms where it was previously only 16 bytes. Patch by me. Review by Andres Freund and KaiGai Kohei.
This commit is contained in:
@@ -55,7 +55,7 @@ typedef enum
|
||||
*/
|
||||
typedef struct SlruSharedData
|
||||
{
|
||||
LWLockId ControlLock;
|
||||
LWLock *ControlLock;
|
||||
|
||||
/* Number of buffers managed by this SLRU structure */
|
||||
int num_slots;
|
||||
@@ -69,7 +69,7 @@ typedef struct SlruSharedData
|
||||
bool *page_dirty;
|
||||
int *page_number;
|
||||
int *page_lru_count;
|
||||
LWLockId *buffer_locks;
|
||||
LWLock **buffer_locks;
|
||||
|
||||
/*
|
||||
* Optional array of WAL flush LSNs associated with entries in the SLRU
|
||||
@@ -136,7 +136,7 @@ typedef SlruCtlData *SlruCtl;
|
||||
|
||||
extern Size SimpleLruShmemSize(int nslots, int nlsns);
|
||||
extern void SimpleLruInit(SlruCtl ctl, const char *name, int nslots, int nlsns,
|
||||
LWLockId ctllock, const char *subdir);
|
||||
LWLock *ctllock, const char *subdir);
|
||||
extern int SimpleLruZeroPage(SlruCtl ctl, int pageno);
|
||||
extern int SimpleLruReadPage(SlruCtl ctl, int pageno, bool write_ok,
|
||||
TransactionId xid);
|
||||
|
||||
Reference in New Issue
Block a user