mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-17 03:47:01 +08:00
With real AIO it doesn't make sense to cross segment boundaries with one IO. Add smgrmaxcombine() to allow upper layers to query which buffers can be merged. We could continue to cross segment boundaries when not using AIO, but it doesn't really make sense, because md.c will never be able to perform the read across the segment boundary in one system call. Which means we'll mark more buffers as undergoing IO than really makes sense - if another backend desires to read the same blocks, it'll be blocked longer than necessary. So it seems better to just never cross the boundary. Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi> Reviewed-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/1f6b50a7-38ef-4d87-8246-786d39f46ab9@iki.fi
59 lines
2.4 KiB
C
59 lines
2.4 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* md.h
|
|
* magnetic disk storage manager public interface declarations.
|
|
*
|
|
*
|
|
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/include/storage/md.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef MD_H
|
|
#define MD_H
|
|
|
|
#include "storage/block.h"
|
|
#include "storage/relfilelocator.h"
|
|
#include "storage/smgr.h"
|
|
#include "storage/sync.h"
|
|
|
|
/* md storage manager functionality */
|
|
extern void mdinit(void);
|
|
extern void mdopen(SMgrRelation reln);
|
|
extern void mdclose(SMgrRelation reln, ForkNumber forknum);
|
|
extern void mdcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo);
|
|
extern bool mdexists(SMgrRelation reln, ForkNumber forknum);
|
|
extern void mdunlink(RelFileLocatorBackend rlocator, ForkNumber forknum, bool isRedo);
|
|
extern void mdextend(SMgrRelation reln, ForkNumber forknum,
|
|
BlockNumber blocknum, const void *buffer, bool skipFsync);
|
|
extern void mdzeroextend(SMgrRelation reln, ForkNumber forknum,
|
|
BlockNumber blocknum, int nblocks, bool skipFsync);
|
|
extern bool mdprefetch(SMgrRelation reln, ForkNumber forknum,
|
|
BlockNumber blocknum, int nblocks);
|
|
extern uint32 mdmaxcombine(SMgrRelation reln, ForkNumber forknum,
|
|
BlockNumber blocknum);
|
|
extern void mdreadv(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
|
void **buffers, BlockNumber nblocks);
|
|
extern void mdwritev(SMgrRelation reln, ForkNumber forknum,
|
|
BlockNumber blocknum,
|
|
const void **buffers, BlockNumber nblocks, bool skipFsync);
|
|
extern void mdwriteback(SMgrRelation reln, ForkNumber forknum,
|
|
BlockNumber blocknum, BlockNumber nblocks);
|
|
extern BlockNumber mdnblocks(SMgrRelation reln, ForkNumber forknum);
|
|
extern void mdtruncate(SMgrRelation reln, ForkNumber forknum,
|
|
BlockNumber nblocks);
|
|
extern void mdimmedsync(SMgrRelation reln, ForkNumber forknum);
|
|
extern void mdregistersync(SMgrRelation reln, ForkNumber forknum);
|
|
|
|
extern void ForgetDatabaseSyncRequests(Oid dbid);
|
|
extern void DropRelationFiles(RelFileLocator *delrels, int ndelrels, bool isRedo);
|
|
|
|
/* md sync callbacks */
|
|
extern int mdsyncfiletag(const FileTag *ftag, char *path);
|
|
extern int mdunlinkfiletag(const FileTag *ftag, char *path);
|
|
extern bool mdfiletagmatches(const FileTag *ftag, const FileTag *candidate);
|
|
|
|
#endif /* MD_H */
|