aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/lmgr/single.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/storage/lmgr/single.c')
-rw-r--r--src/backend/storage/lmgr/single.c93
1 files changed, 45 insertions, 48 deletions
diff --git a/src/backend/storage/lmgr/single.c b/src/backend/storage/lmgr/single.c
index 20feddbed9f..80220368437 100644
--- a/src/backend/storage/lmgr/single.c
+++ b/src/backend/storage/lmgr/single.c
@@ -1,19 +1,19 @@
/*-------------------------------------------------------------------------
*
* single.c--
- * set single locks in the multi-level lock hierarchy
+ * set single locks in the multi-level lock hierarchy
*
- * Sometimes we don't want to set all levels of the multi-level
- * lock hierarchy at once. This allows us to set and release
- * one level at a time. It's useful in index scans when
- * you can set an intent lock at the beginning and thereafter
- * only set page locks. Tends to speed things up.
+ * Sometimes we don't want to set all levels of the multi-level
+ * lock hierarchy at once. This allows us to set and release
+ * one level at a time. It's useful in index scans when
+ * you can set an intent lock at the beginning and thereafter
+ * only set page locks. Tends to speed things up.
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/single.c,v 1.2 1996/11/03 05:07:33 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/single.c,v 1.3 1997/09/07 04:49:04 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,7 +21,7 @@
#include "postgres.h"
-#include "storage/lmgr.h" /* where the declarations go */
+#include "storage/lmgr.h" /* where the declarations go */
#include "storage/lock.h"
#include "storage/multilev.h"
#include "utils/rel.h"
@@ -34,28 +34,27 @@
bool
SingleLockReln(LockInfo linfo, LOCKT lockt, int action)
{
- LOCKTAG tag;
-
- /*
- * LOCKTAG has two bytes of padding, unfortunately. The
- * hash function will return miss if the padding bytes aren't
- * zero'd.
- */
- memset(&tag,0,sizeof(tag));
- tag.relId = linfo->lRelId.relId;
- tag.dbId = linfo->lRelId.dbId;
- BlockIdSet(&(tag.tupleId.ip_blkid), InvalidBlockNumber);
- tag.tupleId.ip_posid = InvalidOffsetNumber;
-
- if (action == UNLOCK)
- return(LockRelease(MultiTableId, &tag, lockt));
- else
- return(LockAcquire(MultiTableId, &tag, lockt));
+ LOCKTAG tag;
+
+ /*
+ * LOCKTAG has two bytes of padding, unfortunately. The hash function
+ * will return miss if the padding bytes aren't zero'd.
+ */
+ memset(&tag, 0, sizeof(tag));
+ tag.relId = linfo->lRelId.relId;
+ tag.dbId = linfo->lRelId.dbId;
+ BlockIdSet(&(tag.tupleId.ip_blkid), InvalidBlockNumber);
+ tag.tupleId.ip_posid = InvalidOffsetNumber;
+
+ if (action == UNLOCK)
+ return (LockRelease(MultiTableId, &tag, lockt));
+ else
+ return (LockAcquire(MultiTableId, &tag, lockt));
}
/*
* SingleLockPage -- use multi-level lock table, but lock
- * only at the page level.
+ * only at the page level.
*
* Assumes that an INTENT lock has already been set in the
* multi-level lock table.
@@ -63,27 +62,25 @@ SingleLockReln(LockInfo linfo, LOCKT lockt, int action)
*/
bool
SingleLockPage(LockInfo linfo,
- ItemPointer tidPtr,
- LOCKT lockt,
- int action)
+ ItemPointer tidPtr,
+ LOCKT lockt,
+ int action)
{
- LOCKTAG tag;
-
- /*
- * LOCKTAG has two bytes of padding, unfortunately. The
- * hash function will return miss if the padding bytes aren't
- * zero'd.
- */
- memset(&tag,0,sizeof(tag));
- tag.relId = linfo->lRelId.relId;
- tag.dbId = linfo->lRelId.dbId;
- BlockIdCopy(&(tag.tupleId.ip_blkid), &(tidPtr->ip_blkid));
- tag.tupleId.ip_posid = InvalidOffsetNumber;
-
-
- if (action == UNLOCK)
- return(LockRelease(MultiTableId, &tag, lockt));
- else
- return(LockAcquire(MultiTableId, &tag, lockt));
-}
+ LOCKTAG tag;
+ /*
+ * LOCKTAG has two bytes of padding, unfortunately. The hash function
+ * will return miss if the padding bytes aren't zero'd.
+ */
+ memset(&tag, 0, sizeof(tag));
+ tag.relId = linfo->lRelId.relId;
+ tag.dbId = linfo->lRelId.dbId;
+ BlockIdCopy(&(tag.tupleId.ip_blkid), &(tidPtr->ip_blkid));
+ tag.tupleId.ip_posid = InvalidOffsetNumber;
+
+
+ if (action == UNLOCK)
+ return (LockRelease(MultiTableId, &tag, lockt));
+ else
+ return (LockAcquire(MultiTableId, &tag, lockt));
+}