diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-02-10 01:55:27 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-02-10 01:55:27 +0000 |
commit | 87bd95638552b8fc1f5f787ce5b862bb6fc2eb80 (patch) | |
tree | b2b98d5a934750a9ee791992120343b109dac31d /src/backend/storage/buffer/localbuf.c | |
parent | f06e79525a57ccbf54ae5d0b673cd904ca978d67 (diff) |
Restructure smgr API as per recent proposal. smgr no longer depends on
the relcache, and so the notion of 'blind write' is gone. This should
improve efficiency in bgwriter and background checkpoint processes.
Internal restructuring in md.c to remove the not-very-useful array of
MdfdVec objects --- might as well just use pointers.
Also remove the long-dead 'persistent main memory' storage manager (mm.c),
since it seems quite unlikely to ever get resurrected.
Diffstat (limited to 'src/backend/storage/buffer/localbuf.c')
-rw-r--r-- | src/backend/storage/buffer/localbuf.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c index 01c83039280..bcbedc9c651 100644 --- a/src/backend/storage/buffer/localbuf.c +++ b/src/backend/storage/buffer/localbuf.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.51 2004/01/07 18:56:27 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.52 2004/02/10 01:55:25 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -90,24 +90,15 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr) */ if (bufHdr->flags & BM_DIRTY || bufHdr->cntxDirty) { - Relation bufrel = RelationNodeCacheGetRelation(bufHdr->tag.rnode); + SMgrRelation reln; - /* flush this page */ - if (bufrel == NULL) - { - smgrblindwrt(DEFAULT_SMGR, - bufHdr->tag.rnode, - bufHdr->tag.blockNum, - (char *) MAKE_PTR(bufHdr->data)); - } - else - { - smgrwrite(DEFAULT_SMGR, bufrel, - bufHdr->tag.blockNum, - (char *) MAKE_PTR(bufHdr->data)); - /* drop refcount incremented by RelationNodeCacheGetRelation */ - RelationDecrementReferenceCount(bufrel); - } + /* Find smgr relation for buffer */ + reln = smgropen(bufHdr->tag.rnode); + + /* And write... */ + smgrwrite(reln, + bufHdr->tag.blockNum, + (char *) MAKE_PTR(bufHdr->data)); LocalBufferFlushCount++; } @@ -143,9 +134,6 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr) /* * it's all ours now. - * - * We need not in tblNode currently but will in future I think, when - * we'll give up rel->rd_fd to fmgr cache. */ bufHdr->tag.rnode = reln->rd_node; bufHdr->tag.blockNum = blockNum; |