}
void
-FileWriteback(File file, off_t offset, int amount)
+FileWriteback(File file, off_t offset, off_t nbytes)
{
int returnCode;
Assert(FileIsValid(file));
- DO_DB(elog(LOG, "FileWriteback: %d (%s) " INT64_FORMAT " %d",
+ DO_DB(elog(LOG, "FileWriteback: %d (%s) " INT64_FORMAT " " INT64_FORMAT,
file, VfdCache[file].fileName,
- (int64) offset, amount));
+ (int64) offset, (int64) nbytes));
/*
- * Caution: do not call pg_flush_data with amount = 0, it could trash the
- * file's seek position.
+ * Caution: do not call pg_flush_data with nbytes = 0, it could trash the
+ * file's seek position. We prefer to define that as a no-op here.
*/
- if (amount <= 0)
+ if (nbytes <= 0)
return;
returnCode = FileAccess(file);
if (returnCode < 0)
return;
- pg_flush_data(VfdCache[file].fd, offset, amount);
+ pg_flush_data(VfdCache[file].fd, offset, nbytes);
}
int
* 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,
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;
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);
*/
void
smgrwriteback(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
- int nblocks)
+ BlockNumber nblocks)
{
(*(smgrsw[reln->smgr_which].smgr_writeback)) (reln, forknum, blocknum,
nblocks);
extern int FileSync(File file);
extern off_t FileSeek(File file, off_t offset, int whence);
extern int FileTruncate(File file, off_t offset);
-extern void FileWriteback(File file, off_t offset, int amount);
+extern void FileWriteback(File file, off_t offset, off_t nbytes);
extern char *FilePathName(File file);
extern int FileGetRawDesc(File file);
extern int FileGetRawFlags(File file);
extern void smgrwrite(SMgrRelation reln, ForkNumber forknum,
BlockNumber blocknum, char *buffer, bool skipFsync);
extern void smgrwriteback(SMgrRelation reln, ForkNumber forknum,
- BlockNumber blocknum, int nblocks);
+ BlockNumber blocknum, BlockNumber nblocks);
extern BlockNumber smgrnblocks(SMgrRelation reln, ForkNumber forknum);
extern void smgrtruncate(SMgrRelation reln, ForkNumber forknum,
BlockNumber nblocks);
extern void mdwrite(SMgrRelation reln, ForkNumber forknum,
BlockNumber blocknum, char *buffer, bool skipFsync);
extern void mdwriteback(SMgrRelation reln, ForkNumber forknum,
- BlockNumber blocknum, int nblocks);
+ BlockNumber blocknum, BlockNumber nblocks);
extern BlockNumber mdnblocks(SMgrRelation reln, ForkNumber forknum);
extern void mdtruncate(SMgrRelation reln, ForkNumber forknum,
BlockNumber nblocks);