summaryrefslogtreecommitdiff
path: root/src/backend/storage/buffer
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/storage/buffer')
-rw-r--r--src/backend/storage/buffer/buf_init.c6
-rw-r--r--src/backend/storage/buffer/bufmgr.c40
-rw-r--r--src/backend/storage/buffer/freelist.c4
-rw-r--r--src/backend/storage/buffer/s_lock.c38
4 files changed, 45 insertions, 43 deletions
diff --git a/src/backend/storage/buffer/buf_init.c b/src/backend/storage/buffer/buf_init.c
index 64eb13688f..975e999ec2 100644
--- a/src/backend/storage/buffer/buf_init.c
+++ b/src/backend/storage/buffer/buf_init.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.18 1998/06/27 15:47:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.19 1998/09/01 04:31:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -48,7 +48,7 @@ bmtrace *TraceBuf;
long *CurTraceBuf;
#define BMT_LIMIT 200
-#endif /* BMTRACE */
+#endif /* BMTRACE */
int ShowPinTrace = 0;
int NBuffers = NDBUFS; /* NDBUFS defined in miscadmin.h */
@@ -278,7 +278,7 @@ BufferShmemSize()
nsegs = 1 << (int) my_log2((nbuckets - 1) / DEF_SEGSIZE + 1);
/* size of shmem index table */
- size += MAXALIGN(my_log2(SHMEM_INDEX_SIZE) * sizeof(void *)); /* HTAB->dir */
+ size += MAXALIGN(my_log2(SHMEM_INDEX_SIZE) * sizeof(void *)); /* HTAB->dir */
size += MAXALIGN(sizeof(HHDR)); /* HTAB->hctl */
size += MAXALIGN(DEF_SEGSIZE * sizeof(SEGMENT));
size += BUCKET_ALLOC_INCR *
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 837b02dbf1..f283887eb0 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.42 1998/09/01 03:25:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.43 1998/09/01 04:31:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -87,13 +87,11 @@ static void WaitIO(BufferDesc *buf, SPINLOCK spinlock);
static void SignalIO(BufferDesc *buf);
extern long *NWaitIOBackendP; /* defined in buf_init.c */
-#endif /* HAS_TEST_AND_SET */
+#endif /* HAS_TEST_AND_SET */
-static Buffer
-ReadBufferWithBufferLock(Relation relation, BlockNumber blockNum,
+static Buffer ReadBufferWithBufferLock(Relation relation, BlockNumber blockNum,
bool bufferLockHeld);
-static BufferDesc *
-BufferAlloc(Relation reln, BlockNumber blockNum,
+static BufferDesc *BufferAlloc(Relation reln, BlockNumber blockNum,
bool *foundPtr, bool bufferLockHeld);
static int FlushBuffer(Buffer buffer, bool release);
static void BufferSync(void);
@@ -119,8 +117,8 @@ RelationGetBufferWithBuffer(Relation relation,
{
if (!BufferIsLocal(buffer))
{
- LockRelId *lrelId = &(((LockInfo)(relation->lockInfo))->lockRelId);
-
+ LockRelId *lrelId = &(((LockInfo) (relation->lockInfo))->lockRelId);
+
bufHdr = &BufferDescriptors[buffer - 1];
SpinAcquire(BufMgrLock);
if (bufHdr->tag.blockNum == blockNumber &&
@@ -417,7 +415,7 @@ BufferAlloc(Relation reln,
}
#ifdef BMTRACE
_bm_trace((reln->rd_rel->relisshared ? 0 : MyDatabaseId), RelationGetRelid(reln), blockNum, BufferDescriptorGetBuffer(buf), BMT_ALLOCFND);
-#endif /* BMTRACE */
+#endif /* BMTRACE */
SpinRelease(BufMgrLock);
@@ -480,7 +478,7 @@ BufferAlloc(Relation reln,
*/
Assert(S_LOCK_FREE(&(buf->io_in_progress_lock)));
S_LOCK(&(buf->io_in_progress_lock));
-#endif /* HAS_TEST_AND_SET */
+#endif /* HAS_TEST_AND_SET */
/*
* Write the buffer out, being careful to release BufMgrLock
@@ -493,7 +491,7 @@ BufferAlloc(Relation reln,
smok = BufferReplace(buf, true);
#ifndef OPTIMIZE_SINGLE
SpinAcquire(BufMgrLock);
-#endif /* OPTIMIZE_SINGLE */
+#endif /* OPTIMIZE_SINGLE */
if (smok == FALSE)
{
@@ -507,7 +505,7 @@ BufferAlloc(Relation reln,
#else /* !HAS_TEST_AND_SET */
if (buf->refcount > 1)
SignalIO(buf);
-#endif /* !HAS_TEST_AND_SET */
+#endif /* !HAS_TEST_AND_SET */
PrivateRefCount[BufferDescriptorGetBuffer(buf) - 1] = 0;
buf->refcount--;
if (buf->refcount == 0)
@@ -553,7 +551,7 @@ BufferAlloc(Relation reln,
#else /* !HAS_TEST_AND_SET */
if (buf->refcount > 1)
SignalIO(buf);
-#endif /* !HAS_TEST_AND_SET */
+#endif /* !HAS_TEST_AND_SET */
PrivateRefCount[BufferDescriptorGetBuffer(buf) - 1] = 0;
buf->refcount--;
buf = (BufferDesc *) NULL;
@@ -583,7 +581,7 @@ BufferAlloc(Relation reln,
#else /* !HAS_TEST_AND_SET */
if (buf->refcount > 1)
SignalIO(buf);
-#endif /* !HAS_TEST_AND_SET */
+#endif /* !HAS_TEST_AND_SET */
/* give up the buffer since we don't need it any more */
buf->refcount--;
@@ -656,12 +654,12 @@ BufferAlloc(Relation reln,
#ifdef HAS_TEST_AND_SET
Assert(S_LOCK_FREE(&(buf->io_in_progress_lock)));
S_LOCK(&(buf->io_in_progress_lock));
-#endif /* HAS_TEST_AND_SET */
+#endif /* HAS_TEST_AND_SET */
}
#ifdef BMTRACE
_bm_trace((reln->rd_rel->relisshared ? 0 : MyDatabaseId), RelationGetRelid(reln), blockNum, BufferDescriptorGetBuffer(buf), BMT_ALLOCNOTFND);
-#endif /* BMTRACE */
+#endif /* BMTRACE */
SpinRelease(BufMgrLock);
@@ -1018,7 +1016,7 @@ BufferSync()
#ifndef OPTIMIZE_SINGLE
SpinRelease(BufMgrLock);
-#endif /* OPTIMIZE_SINGLE */
+#endif /* OPTIMIZE_SINGLE */
if (reln == (Relation) NULL)
{
status = smgrblindwrt(DEFAULT_SMGR, bufHdr->sb_dbname,
@@ -1034,7 +1032,7 @@ BufferSync()
}
#ifndef OPTIMIZE_SINGLE
SpinAcquire(BufMgrLock);
-#endif /* OPTIMIZE_SINGLE */
+#endif /* OPTIMIZE_SINGLE */
UnpinBuffer(bufHdr);
if (status == SM_FAIL)
@@ -1129,7 +1127,7 @@ SignalIO(BufferDesc *buf)
*NWaitIOBackendP = 0;
}
-#endif /* HAS_TEST_AND_SET */
+#endif /* HAS_TEST_AND_SET */
long NDirectFileRead; /* some I/O's are direct file access.
* bypass bufmgr */
@@ -1575,7 +1573,7 @@ BlowawayRelationBuffers(Relation rel, BlockNumber block)
if (buf->flags & BM_DIRTY)
{
elog(NOTICE, "BlowawayRelationBuffers(%s (local), %u): block %u is dirty",
- rel->rd_rel->relname.data, block, buf->tag.blockNum);
+ rel->rd_rel->relname.data, block, buf->tag.blockNum);
return -1;
}
if (LocalRefCount[i] > 0)
@@ -1888,7 +1886,7 @@ _bm_die(Oid dbId, Oid relId, int blkNo, int bufNo,
kill(getpid(), SIGILL);
}
-#endif /* BMTRACE */
+#endif /* BMTRACE */
void
BufferRefCountReset(int *refcountsave)
diff --git a/src/backend/storage/buffer/freelist.c b/src/backend/storage/buffer/freelist.c
index 421bce86e2..8b853ec7c6 100644
--- a/src/backend/storage/buffer/freelist.c
+++ b/src/backend/storage/buffer/freelist.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/freelist.c,v 1.12 1998/09/01 03:25:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/freelist.c,v 1.13 1998/09/01 04:31:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -68,7 +68,7 @@ AddBufferToFreelist(BufferDesc *bf)
#ifdef BMTRACE
_bm_trace(bf->tag.relId.dbId, bf->tag.relId.relId, bf->tag.blockNum,
BufferDescriptorGetBuffer(bf), BMT_DEALLOC);
-#endif /* BMTRACE */
+#endif /* BMTRACE */
NotInQueue(bf);
/* change bf so it points to inFrontOfNew and its successor */
diff --git a/src/backend/storage/buffer/s_lock.c b/src/backend/storage/buffer/s_lock.c
index 23bc0ec2c4..84b9868bc0 100644
--- a/src/backend/storage/buffer/s_lock.c
+++ b/src/backend/storage/buffer/s_lock.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.8 1998/06/16 07:18:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.9 1998/09/01 04:31:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,12 +27,12 @@
* granularity.
* note: total time to cycle through all 16 entries might be about .07 sec.
*/
-#define S_NSPINCYCLE 20
-#define S_MAX_BUSY 500 * S_NSPINCYCLE
+#define S_NSPINCYCLE 20
+#define S_MAX_BUSY 500 * S_NSPINCYCLE
-int s_spincycle[S_NSPINCYCLE] =
-{ 0, 0, 0, 0, 10000, 0, 0, 0, 10000, 0,
- 0, 10000, 0, 0, 10000, 0, 10000, 0, 10000, 10000
+int s_spincycle[S_NSPINCYCLE] =
+{0, 0, 0, 0, 10000, 0, 0, 0, 10000, 0,
+ 0, 10000, 0, 0, 10000, 0, 10000, 0, 10000, 10000
};
@@ -111,11 +111,12 @@ success: \n\
blr \n\
");
}
-#endif /* PPC */
+#endif /* PPC */
-#else /* defined(__GNUC__) */
+
+#else /* defined(__GNUC__) */
/***************************************************************************
* All non gcc
*/
@@ -124,7 +125,8 @@ success: \n\
#if defined(sun3)
static void
-tas_dummy() /* really means: extern int tas(slock_t *lock); */
+tas_dummy() /* really means: extern int tas(slock_t
+ * *lock); */
{
asm("LLA0:");
asm(" .data");
@@ -143,7 +145,8 @@ tas_dummy() /* really means: extern int tas(slock_t *lock); */
asm(" rts");
asm(" .data");
}
-#endif /* sun3 */
+
+#endif /* sun3 */
@@ -152,11 +155,13 @@ tas_dummy() /* really means: extern int tas(slock_t *lock); */
* sparc machines not using gcc
*/
static void
-tas_dummy() /* really means: extern int tas(slock_t *lock); */
+tas_dummy() /* really means: extern int tas(slock_t
+ * *lock); */
{
asm(".seg \"data\"");
asm(".seg \"text\"");
asm("_tas:");
+
/*
* Sparc atomic test and set (sparc calls it "atomic load-store")
*/
@@ -165,18 +170,18 @@ tas_dummy() /* really means: extern int tas(slock_t *lock); */
asm("nop");
}
-#endif /* NEED_SPARC_TAS_ASM */
+#endif /* NEED_SPARC_TAS_ASM */
#if defined(NEED_I386_TAS_ASM)
/* non gcc i386 based things */
-#endif /* NEED_I386_TAS_ASM */
+#endif /* NEED_I386_TAS_ASM */
-#endif /* not __GNUC__ */
+#endif /* not __GNUC__ */
@@ -188,7 +193,7 @@ tas_dummy() /* really means: extern int tas(slock_t *lock); */
* test program for verifying a port.
*/
-volatile slock_t test_lock;
+volatile slock_t test_lock;
void
main()
@@ -219,5 +224,4 @@ main()
}
-#endif /* S_LOCK_TEST */
-
+#endif /* S_LOCK_TEST */