mirror of
https://github.com/postgres/postgres.git
synced 2025-11-28 11:44:57 +03:00
Widen amount-to-flush arguments of FileWriteback and callers.
It's silly to define these counts as narrower than they might someday need to be. Also, I believe that the BLCKSZ * nflush calculation in mdwriteback was capable of overflowing an int.
This commit is contained in:
@@ -669,15 +669,16 @@ mdprefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum)
|
||||
* considerably more efficient than doing so individually.
|
||||
*/
|
||||
void
|
||||
mdwriteback(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, int nblocks)
|
||||
mdwriteback(SMgrRelation reln, ForkNumber forknum,
|
||||
BlockNumber blocknum, BlockNumber nblocks)
|
||||
{
|
||||
/*
|
||||
* Issue flush requests in as few requests as possible; have to split at
|
||||
* segment boundaries though, since those are actually separate files.
|
||||
*/
|
||||
while (nblocks != 0)
|
||||
while (nblocks > 0)
|
||||
{
|
||||
int nflush = nblocks;
|
||||
BlockNumber nflush = nblocks;
|
||||
off_t seekpos;
|
||||
MdfdVec *v;
|
||||
int segnum_start,
|
||||
@@ -706,7 +707,7 @@ mdwriteback(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, int nbl
|
||||
|
||||
seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE));
|
||||
|
||||
FileWriteback(v->mdfd_vfd, seekpos, BLCKSZ * nflush);
|
||||
FileWriteback(v->mdfd_vfd, seekpos, (off_t) BLCKSZ * nflush);
|
||||
|
||||
nblocks -= nflush;
|
||||
blocknum += nflush;
|
||||
|
||||
@@ -54,7 +54,7 @@ typedef struct f_smgr
|
||||
void (*smgr_write) (SMgrRelation reln, ForkNumber forknum,
|
||||
BlockNumber blocknum, char *buffer, bool skipFsync);
|
||||
void (*smgr_writeback) (SMgrRelation reln, ForkNumber forknum,
|
||||
BlockNumber blocknum, int nblocks);
|
||||
BlockNumber blocknum, BlockNumber nblocks);
|
||||
BlockNumber (*smgr_nblocks) (SMgrRelation reln, ForkNumber forknum);
|
||||
void (*smgr_truncate) (SMgrRelation reln, ForkNumber forknum,
|
||||
BlockNumber nblocks);
|
||||
@@ -658,7 +658,7 @@ smgrwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||
*/
|
||||
void
|
||||
smgrwriteback(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||
int nblocks)
|
||||
BlockNumber nblocks)
|
||||
{
|
||||
(*(smgrsw[reln->smgr_which].smgr_writeback)) (reln, forknum, blocknum,
|
||||
nblocks);
|
||||
|
||||
Reference in New Issue
Block a user