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

Commit52676dc

Browse files
committed
Update parameter name context to wb_context
For clarity of review, renaming the function parameter "context" inScheduleBufferTagForWriteback() and IssuePendingWritebacks() to"wb_context" is a separate commit. The next commit adds an "io_context"parameter and "wb_context" makes it more clear which is which.Author: Melanie Plageman <melanieplageman@gmail.com>Discussion:https://postgr.es/m/CAAKRu_acc6iL4M3hvOTeztf_ZPpsB3Pqio5aVHgZ5q=Pi3BZKg@mail.gmail.com
1 parent3228755 commit52676dc

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

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

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5445,7 +5445,7 @@ WritebackContextInit(WritebackContext *context, int *max_pending)
54455445
* Add buffer to list of pending writeback requests.
54465446
*/
54475447
void
5448-
ScheduleBufferTagForWriteback(WritebackContext*context,BufferTag*tag)
5448+
ScheduleBufferTagForWriteback(WritebackContext*wb_context,BufferTag*tag)
54495449
{
54505450
PendingWriteback*pending;
54515451

@@ -5456,11 +5456,11 @@ ScheduleBufferTagForWriteback(WritebackContext *context, BufferTag *tag)
54565456
* Add buffer to the pending writeback array, unless writeback control is
54575457
* disabled.
54585458
*/
5459-
if (*context->max_pending>0)
5459+
if (*wb_context->max_pending>0)
54605460
{
5461-
Assert(*context->max_pending <=WRITEBACK_MAX_PENDING_FLUSHES);
5461+
Assert(*wb_context->max_pending <=WRITEBACK_MAX_PENDING_FLUSHES);
54625462

5463-
pending=&context->pending_writebacks[context->nr_pending++];
5463+
pending=&wb_context->pending_writebacks[wb_context->nr_pending++];
54645464

54655465
pending->tag=*tag;
54665466
}
@@ -5470,8 +5470,8 @@ ScheduleBufferTagForWriteback(WritebackContext *context, BufferTag *tag)
54705470
* includes the case where previously an item has been added, but control
54715471
* is now disabled.
54725472
*/
5473-
if (context->nr_pending >=*context->max_pending)
5474-
IssuePendingWritebacks(context);
5473+
if (wb_context->nr_pending >=*wb_context->max_pending)
5474+
IssuePendingWritebacks(wb_context);
54755475
}
54765476

54775477
#defineST_SORT sort_pending_writebacks
@@ -5489,25 +5489,26 @@ ScheduleBufferTagForWriteback(WritebackContext *context, BufferTag *tag)
54895489
* error out - it's just a hint.
54905490
*/
54915491
void
5492-
IssuePendingWritebacks(WritebackContext*context)
5492+
IssuePendingWritebacks(WritebackContext*wb_context)
54935493
{
54945494
inti;
54955495

5496-
if (context->nr_pending==0)
5496+
if (wb_context->nr_pending==0)
54975497
return;
54985498

54995499
/*
55005500
* Executing the writes in-order can make them a lot faster, and allows to
55015501
* merge writeback requests to consecutive blocks into larger writebacks.
55025502
*/
5503-
sort_pending_writebacks(context->pending_writebacks,context->nr_pending);
5503+
sort_pending_writebacks(wb_context->pending_writebacks,
5504+
wb_context->nr_pending);
55045505

55055506
/*
55065507
* Coalesce neighbouring writes, but nothing else. For that we iterate
55075508
* through the, now sorted, array of pending flushes, and look forward to
55085509
* find all neighbouring (or identical) writes.
55095510
*/
5510-
for (i=0;i<context->nr_pending;i++)
5511+
for (i=0;i<wb_context->nr_pending;i++)
55115512
{
55125513
PendingWriteback*cur;
55135514
PendingWriteback*next;
@@ -5517,18 +5518,18 @@ IssuePendingWritebacks(WritebackContext *context)
55175518
RelFileLocatorcurrlocator;
55185519
Sizenblocks=1;
55195520

5520-
cur=&context->pending_writebacks[i];
5521+
cur=&wb_context->pending_writebacks[i];
55215522
tag=cur->tag;
55225523
currlocator=BufTagGetRelFileLocator(&tag);
55235524

55245525
/*
55255526
* Peek ahead, into following writeback requests, to see if they can
55265527
* be combined with the current one.
55275528
*/
5528-
for (ahead=0;i+ahead+1<context->nr_pending;ahead++)
5529+
for (ahead=0;i+ahead+1<wb_context->nr_pending;ahead++)
55295530
{
55305531

5531-
next=&context->pending_writebacks[i+ahead+1];
5532+
next=&wb_context->pending_writebacks[i+ahead+1];
55325533

55335534
/* different file, stop */
55345535
if (!RelFileLocatorEquals(currlocator,
@@ -5555,7 +5556,7 @@ IssuePendingWritebacks(WritebackContext *context)
55555556
smgrwriteback(reln,BufTagGetForkNum(&tag),tag.blockNum,nblocks);
55565557
}
55575558

5558-
context->nr_pending=0;
5559+
wb_context->nr_pending=0;
55595560
}
55605561

55615562

‎src/include/storage/buf_internals.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ extern PGDLLIMPORT CkptSortItem *CkptBufferIds;
388388
*/
389389
/* bufmgr.c */
390390
externvoidWritebackContextInit(WritebackContext*context,int*max_pending);
391-
externvoidIssuePendingWritebacks(WritebackContext*context);
392-
externvoidScheduleBufferTagForWriteback(WritebackContext*context,BufferTag*tag);
391+
externvoidIssuePendingWritebacks(WritebackContext*wb_context);
392+
externvoidScheduleBufferTagForWriteback(WritebackContext*wb_context,BufferTag*tag);
393393

394394
/* freelist.c */
395395
externIOContextIOContextForStrategy(BufferAccessStrategystrategy);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp