Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8d928e3

Browse files
committed
Rename BufferAccessStrategyData.ring_size to nbuffers
The new name better reflects what the field is - the size of the buffers[] array. ring_size sounded more like it is in units of bytes. An upcoming commit allows a BufferAccessStrategy of custom sizes, so it seems relevant to improve this beforehand. Author: Melanie Plageman Reviewed-by: David Rowley Discussion: https://postgr.es/m/CAAKRu_YefVbhg4rAxU2frYFdTap61UftH-kUNQZBvAs%2BYK81Zg%40mail.gmail.com
1 parent 4830f10 commit 8d928e3

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/backend/storage/buffer/freelist.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ typedef struct BufferAccessStrategyData
7474
/* Overall strategy type */
7575
BufferAccessStrategyType btype;
7676
/* Number of elements in buffers[] array */
77-
int ring_size;
77+
int nbuffers;
7878

7979
/*
8080
* Index of the "current" slot in the ring, ie, the one most recently
@@ -541,7 +541,7 @@ BufferAccessStrategy
541541
GetAccessStrategy(BufferAccessStrategyType btype)
542542
{
543543
BufferAccessStrategy strategy;
544-
int ring_size;
544+
int nbuffers;
545545

546546
/*
547547
* Select ring size to use. See buffer/README for rationales.
@@ -556,13 +556,13 @@ GetAccessStrategy(BufferAccessStrategyType btype)
556556
return NULL;
557557

558558
case BAS_BULKREAD:
559-
ring_size = 256 * 1024 / BLCKSZ;
559+
nbuffers = 256 * 1024 / BLCKSZ;
560560
break;
561561
case BAS_BULKWRITE:
562-
ring_size = 16 * 1024 * 1024 / BLCKSZ;
562+
nbuffers = 16 * 1024 * 1024 / BLCKSZ;
563563
break;
564564
case BAS_VACUUM:
565-
ring_size = 256 * 1024 / BLCKSZ;
565+
nbuffers = 256 * 1024 / BLCKSZ;
566566
break;
567567

568568
default:
@@ -572,16 +572,16 @@ GetAccessStrategy(BufferAccessStrategyType btype)
572572
}
573573

574574
/* Make sure ring isn't an undue fraction of shared buffers */
575-
ring_size = Min(NBuffers / 8, ring_size);
575+
nbuffers = Min(NBuffers / 8, nbuffers);
576576

577577
/* Allocate the object and initialize all elements to zeroes */
578578
strategy = (BufferAccessStrategy)
579579
palloc0(offsetof(BufferAccessStrategyData, buffers) +
580-
ring_size * sizeof(Buffer));
580+
nbuffers * sizeof(Buffer));
581581

582582
/* Set fields that don't start out zero */
583583
strategy->btype = btype;
584-
strategy->ring_size = ring_size;
584+
strategy->nbuffers = nbuffers;
585585

586586
return strategy;
587587
}
@@ -615,7 +615,7 @@ GetBufferFromRing(BufferAccessStrategy strategy, uint32 *buf_state)
615615

616616

617617
/* Advance to next ring slot */
618-
if (++strategy->current >= strategy->ring_size)
618+
if (++strategy->current >= strategy->nbuffers)
619619
strategy->current = 0;
620620

621621
/*

0 commit comments

Comments
 (0)