bool *hit);
static bool PinBuffer(BufferDesc *buf, BufferAccessStrategy strategy);
static void PinBuffer_Locked(BufferDesc *buf);
-static void UnpinBuffer(BufferDesc *buf, bool fixOwner);
+static void UnpinBuffer(BufferDesc *buf);
static void BufferSync(int flags);
static uint32 WaitBufHdrUnlocked(BufferDesc *buf);
static int SyncOneBuffer(int buf_id, bool skip_recently_used,
{
/* Drop lock/pin and loop around for another buffer */
LWLockRelease(BufferDescriptorGetContentLock(buf));
- UnpinBuffer(buf, true);
+ UnpinBuffer(buf);
continue;
}
}
* Someone else has locked the buffer, so give it up and loop
* back to get another one.
*/
- UnpinBuffer(buf, true);
+ UnpinBuffer(buf);
continue;
}
}
* pool in the first place. First, give up the buffer we were
* planning to use.
*/
- UnpinBuffer(buf, true);
+ UnpinBuffer(buf);
/* Can give up that buffer's mapping partition lock now */
if (oldPartitionLock != NULL &&
oldPartitionLock != newPartitionLock)
LWLockRelease(oldPartitionLock);
LWLockRelease(newPartitionLock);
- UnpinBuffer(buf, true);
+ UnpinBuffer(buf);
}
/*
BufTagMatchesRelFileLocator(&bufHdr->tag, &relation->rd_locator) &&
BufTagGetForkNum(&bufHdr->tag) == forkNum)
return buffer;
- UnpinBuffer(bufHdr, true);
+ UnpinBuffer(bufHdr);
}
}
/*
* UnpinBuffer -- make buffer available for replacement.
*
- * This should be applied only to shared buffers, never local ones.
- *
- * Most but not all callers want CurrentResourceOwner to be adjusted.
- * Those that don't should pass fixOwner = false.
+ * This should be applied only to shared buffers, never local ones. This
+ * always adjusts CurrentResourceOwner.
*/
static void
-UnpinBuffer(BufferDesc *buf, bool fixOwner)
+UnpinBuffer(BufferDesc *buf)
{
PrivateRefCountEntry *ref;
Buffer b = BufferDescriptorGetBuffer(buf);
ref = GetPrivateRefCountEntry(b, false);
Assert(ref != NULL);
- if (fixOwner)
- ResourceOwnerForgetBuffer(CurrentResourceOwner, b);
+ ResourceOwnerForgetBuffer(CurrentResourceOwner, b);
Assert(ref->refcount > 0);
ref->refcount--;
tag = bufHdr->tag;
- UnpinBuffer(bufHdr, true);
+ UnpinBuffer(bufHdr);
ScheduleBufferTagForWriteback(wb_context, &tag);
LWLockAcquire(BufferDescriptorGetContentLock(bufHdr), LW_SHARED);
FlushBuffer(bufHdr, RelationGetSmgr(rel));
LWLockRelease(BufferDescriptorGetContentLock(bufHdr));
- UnpinBuffer(bufHdr, true);
+ UnpinBuffer(bufHdr);
}
else
UnlockBufHdr(bufHdr, buf_state);
LWLockAcquire(BufferDescriptorGetContentLock(bufHdr), LW_SHARED);
FlushBuffer(bufHdr, srelent->srel);
LWLockRelease(BufferDescriptorGetContentLock(bufHdr));
- UnpinBuffer(bufHdr, true);
+ UnpinBuffer(bufHdr);
}
else
UnlockBufHdr(bufHdr, buf_state);
LWLockAcquire(BufferDescriptorGetContentLock(bufHdr), LW_SHARED);
FlushBuffer(bufHdr, NULL);
LWLockRelease(BufferDescriptorGetContentLock(bufHdr));
- UnpinBuffer(bufHdr, true);
+ UnpinBuffer(bufHdr);
}
else
UnlockBufHdr(bufHdr, buf_state);
return;
}
- UnpinBuffer(GetBufferDescriptor(buffer - 1), true);
+ UnpinBuffer(GetBufferDescriptor(buffer - 1));
}
/*