From acab1b0914e426d28789731f50f5964dd4d2f054 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Wed, 5 Apr 2023 18:57:29 -0700 Subject: Convert many uses of ReadBuffer[Extended](P_NEW) to ExtendBufferedRel() A few places are not converted. Some because they are tackled in later commits (e.g. hio.c, xlogutils.c), some because they are more complicated (e.g. brin_pageops.c). Having a few users of ReadBuffer(P_NEW) is good anyway, to ensure the backward compat path stays working. Discussion: https://postgr.es/m/20221029025420.eplyow6k7tgu6he3@awork3.anarazel.de --- contrib/bloom/blutils.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'contrib/bloom/blutils.c') diff --git a/contrib/bloom/blutils.c b/contrib/bloom/blutils.c index a6d9f09f315..d935ed8fbdf 100644 --- a/contrib/bloom/blutils.c +++ b/contrib/bloom/blutils.c @@ -353,7 +353,6 @@ Buffer BloomNewBuffer(Relation index) { Buffer buffer; - bool needLock; /* First, try to get a page from FSM */ for (;;) @@ -387,15 +386,8 @@ BloomNewBuffer(Relation index) } /* Must extend the file */ - needLock = !RELATION_IS_LOCAL(index); - if (needLock) - LockRelationForExtension(index, ExclusiveLock); - - buffer = ReadBuffer(index, P_NEW); - LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE); - - if (needLock) - UnlockRelationForExtension(index, ExclusiveLock); + buffer = ExtendBufferedRel(EB_REL(index), MAIN_FORKNUM, NULL, + EB_LOCK_FIRST); return buffer; } -- cgit v1.2.3