Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit65b158a

Browse files
committed
Remove useless argument from UnpinBuffer()
The last caller of UnpinBuffer() that did not want to adjustCurrentResourceOwner was removed in 2d115e4, and nothing has beenintroduced in bufmgr.c to do the same thing since. This simplifies 10code paths.Author: Aleksander AlekseevReviewed-by: Nathan Bossart, Zhang Mingli, Bharath RupireddyDiscussion:https://postgr.es/m/CAJ7c6TOmmFpb6ohurLhTC7hKNJWGzdwf8s4EAtAZxD48g-e6Jw@mail.gmail.com
1 parentccf36ea commit65b158a

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

‎src/backend/storage/buffer/bufmgr.c

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ static Buffer ReadBuffer_common(SMgrRelation smgr, char relpersistence,
465465
bool*hit);
466466
staticboolPinBuffer(BufferDesc*buf,BufferAccessStrategystrategy);
467467
staticvoidPinBuffer_Locked(BufferDesc*buf);
468-
staticvoidUnpinBuffer(BufferDesc*buf,boolfixOwner);
468+
staticvoidUnpinBuffer(BufferDesc*buf);
469469
staticvoidBufferSync(intflags);
470470
staticuint32WaitBufHdrUnlocked(BufferDesc*buf);
471471
staticintSyncOneBuffer(intbuf_id,boolskip_recently_used,
@@ -1258,7 +1258,7 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
12581258
{
12591259
/* Drop lock/pin and loop around for another buffer */
12601260
LWLockRelease(BufferDescriptorGetContentLock(buf));
1261-
UnpinBuffer(buf, true);
1261+
UnpinBuffer(buf);
12621262
continue;
12631263
}
12641264
}
@@ -1286,7 +1286,7 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
12861286
* Someone else has locked the buffer, so give it up and loop
12871287
* back to get another one.
12881288
*/
1289-
UnpinBuffer(buf, true);
1289+
UnpinBuffer(buf);
12901290
continue;
12911291
}
12921292
}
@@ -1353,7 +1353,7 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
13531353
* pool in the first place. First, give up the buffer we were
13541354
* planning to use.
13551355
*/
1356-
UnpinBuffer(buf, true);
1356+
UnpinBuffer(buf);
13571357

13581358
/* Can give up that buffer's mapping partition lock now */
13591359
if (oldPartitionLock!=NULL&&
@@ -1414,7 +1414,7 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
14141414
oldPartitionLock!=newPartitionLock)
14151415
LWLockRelease(oldPartitionLock);
14161416
LWLockRelease(newPartitionLock);
1417-
UnpinBuffer(buf, true);
1417+
UnpinBuffer(buf);
14181418
}
14191419

14201420
/*
@@ -1671,7 +1671,7 @@ ReleaseAndReadBuffer(Buffer buffer,
16711671
BufTagMatchesRelFileLocator(&bufHdr->tag,&relation->rd_locator)&&
16721672
BufTagGetForkNum(&bufHdr->tag)==forkNum)
16731673
returnbuffer;
1674-
UnpinBuffer(bufHdr, true);
1674+
UnpinBuffer(bufHdr);
16751675
}
16761676
}
16771677

@@ -1843,13 +1843,11 @@ PinBuffer_Locked(BufferDesc *buf)
18431843
/*
18441844
* UnpinBuffer -- make buffer available for replacement.
18451845
*
1846-
* This should be applied only to shared buffers, never local ones.
1847-
*
1848-
* Most but not all callers want CurrentResourceOwner to be adjusted.
1849-
* Those that don't should pass fixOwner = false.
1846+
* This should be applied only to shared buffers, never local ones. This
1847+
* always adjusts CurrentResourceOwner.
18501848
*/
18511849
staticvoid
1852-
UnpinBuffer(BufferDesc*buf,boolfixOwner)
1850+
UnpinBuffer(BufferDesc*buf)
18531851
{
18541852
PrivateRefCountEntry*ref;
18551853
Bufferb=BufferDescriptorGetBuffer(buf);
@@ -1858,8 +1856,7 @@ UnpinBuffer(BufferDesc *buf, bool fixOwner)
18581856
ref=GetPrivateRefCountEntry(b, false);
18591857
Assert(ref!=NULL);
18601858

1861-
if (fixOwner)
1862-
ResourceOwnerForgetBuffer(CurrentResourceOwner,b);
1859+
ResourceOwnerForgetBuffer(CurrentResourceOwner,b);
18631860

18641861
Assert(ref->refcount>0);
18651862
ref->refcount--;
@@ -2579,7 +2576,7 @@ SyncOneBuffer(int buf_id, bool skip_recently_used, WritebackContext *wb_context)
25792576

25802577
tag=bufHdr->tag;
25812578

2582-
UnpinBuffer(bufHdr, true);
2579+
UnpinBuffer(bufHdr);
25832580

25842581
ScheduleBufferTagForWriteback(wb_context,&tag);
25852582

@@ -3591,7 +3588,7 @@ FlushRelationBuffers(Relation rel)
35913588
LWLockAcquire(BufferDescriptorGetContentLock(bufHdr),LW_SHARED);
35923589
FlushBuffer(bufHdr,RelationGetSmgr(rel));
35933590
LWLockRelease(BufferDescriptorGetContentLock(bufHdr));
3594-
UnpinBuffer(bufHdr, true);
3591+
UnpinBuffer(bufHdr);
35953592
}
35963593
else
35973594
UnlockBufHdr(bufHdr,buf_state);
@@ -3689,7 +3686,7 @@ FlushRelationsAllBuffers(SMgrRelation *smgrs, int nrels)
36893686
LWLockAcquire(BufferDescriptorGetContentLock(bufHdr),LW_SHARED);
36903687
FlushBuffer(bufHdr,srelent->srel);
36913688
LWLockRelease(BufferDescriptorGetContentLock(bufHdr));
3692-
UnpinBuffer(bufHdr, true);
3689+
UnpinBuffer(bufHdr);
36933690
}
36943691
else
36953692
UnlockBufHdr(bufHdr,buf_state);
@@ -3899,7 +3896,7 @@ FlushDatabaseBuffers(Oid dbid)
38993896
LWLockAcquire(BufferDescriptorGetContentLock(bufHdr),LW_SHARED);
39003897
FlushBuffer(bufHdr,NULL);
39013898
LWLockRelease(BufferDescriptorGetContentLock(bufHdr));
3902-
UnpinBuffer(bufHdr, true);
3899+
UnpinBuffer(bufHdr);
39033900
}
39043901
else
39053902
UnlockBufHdr(bufHdr,buf_state);
@@ -3945,7 +3942,7 @@ ReleaseBuffer(Buffer buffer)
39453942
return;
39463943
}
39473944

3948-
UnpinBuffer(GetBufferDescriptor(buffer-1), true);
3945+
UnpinBuffer(GetBufferDescriptor(buffer-1));
39493946
}
39503947

39513948
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp