summaryrefslogtreecommitdiff
path: root/src/backend/access/gist/gistutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/gist/gistutil.c')
-rw-r--r--src/backend/access/gist/gistutil.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/backend/access/gist/gistutil.c b/src/backend/access/gist/gistutil.c
index a607464b97..f9f51152b8 100644
--- a/src/backend/access/gist/gistutil.c
+++ b/src/backend/access/gist/gistutil.c
@@ -824,7 +824,6 @@ Buffer
gistNewBuffer(Relation r, Relation heaprel)
{
Buffer buffer;
- bool needLock;
/* First, try to get a page from FSM */
for (;;)
@@ -878,16 +877,8 @@ gistNewBuffer(Relation r, Relation heaprel)
}
/* Must extend the file */
- needLock = !RELATION_IS_LOCAL(r);
-
- if (needLock)
- LockRelationForExtension(r, ExclusiveLock);
-
- buffer = ReadBuffer(r, P_NEW);
- LockBuffer(buffer, GIST_EXCLUSIVE);
-
- if (needLock)
- UnlockRelationForExtension(r, ExclusiveLock);
+ buffer = ExtendBufferedRel(EB_REL(r), MAIN_FORKNUM, NULL,
+ EB_LOCK_FIRST);
return buffer;
}