? .pc
? GNUmakefile
? config.log
? config.status
? include
? patches
? qpatches
? src/Makefile.global
? src/cscope.out
? src/backend/postgres
? src/backend/catalog/postgres.bki
? src/backend/catalog/postgres.description
? src/backend/catalog/postgres.shdescription
? src/backend/utils/mb/conversion_procs/conversion_create.sql
? src/backend/utils/mb/conversion_procs/ascii_and_mic/libascii_and_mic.so.0.0
? src/backend/utils/mb/conversion_procs/cyrillic_and_mic/libcyrillic_and_mic.so.0.0
? src/backend/utils/mb/conversion_procs/euc_cn_and_mic/libeuc_cn_and_mic.so.0.0
? src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/libeuc_jp_and_sjis.so.0.0
? src/backend/utils/mb/conversion_procs/euc_kr_and_mic/libeuc_kr_and_mic.so.0.0
? src/backend/utils/mb/conversion_procs/euc_tw_and_big5/libeuc_tw_and_big5.so.0.0
? src/backend/utils/mb/conversion_procs/latin2_and_win1250/liblatin2_and_win1250.so.0.0
? src/backend/utils/mb/conversion_procs/latin_and_mic/liblatin_and_mic.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_ascii/libutf8_and_ascii.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_big5/libutf8_and_big5.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/libutf8_and_cyrillic.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/libutf8_and_euc_cn.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/libutf8_and_euc_jp.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/libutf8_and_euc_kr.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/libutf8_and_euc_tw.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_gb18030/libutf8_and_gb18030.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_gbk/libutf8_and_gbk.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_iso8859/libutf8_and_iso8859.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/libutf8_and_iso8859_1.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_johab/libutf8_and_johab.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_sjis/libutf8_and_sjis.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_uhc/libutf8_and_uhc.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_win/libutf8_and_win.so.0.0
? src/bin/initdb/initdb
? src/bin/ipcclean/ipcclean
? src/bin/pg_config/pg_config
? src/bin/pg_controldata/pg_controldata
? src/bin/pg_ctl/pg_ctl
? src/bin/pg_dump/pg_dump
? src/bin/pg_dump/pg_dumpall
? src/bin/pg_dump/pg_restore
? src/bin/pg_resetxlog/pg_resetxlog
? src/bin/psql/psql
? src/bin/scripts/clusterdb
? src/bin/scripts/createdb
? src/bin/scripts/createlang
? src/bin/scripts/createuser
? src/bin/scripts/dropdb
? src/bin/scripts/droplang
? src/bin/scripts/dropuser
? src/bin/scripts/reindexdb
? src/bin/scripts/vacuumdb
? src/include/pg_config.h
? src/include/stamp-h
? src/interfaces/ecpg/compatlib/libecpg_compat.so.1.2
? src/interfaces/ecpg/compatlib/libecpg_compat.so.2.2
? src/interfaces/ecpg/ecpglib/libecpg.so.4.3
? src/interfaces/ecpg/ecpglib/libecpg.so.5.2
? src/interfaces/ecpg/pgtypeslib/libpgtypes.so.1.3
? src/interfaces/ecpg/pgtypeslib/libpgtypes.so.2.2
? src/interfaces/ecpg/preproc/ecpg
? src/interfaces/libpq/libpq.so.3.3
? src/interfaces/libpq/libpq.so.4.2
? src/pl/plpgsql/src/libplpgsql.so.1.0
? src/port/pg_config_paths.h
? src/test/regress/libregress.so.0.0
? src/test/regress/log
? src/test/regress/pg_regress
? src/test/regress/testtablespace
? src/test/regress/tmp_check
? src/test/regress/expected/constraints.out
? src/test/regress/expected/copy.out
? src/test/regress/expected/create_function_1.out
? src/test/regress/expected/create_function_2.out
? src/test/regress/expected/misc.out
? src/test/regress/expected/tablespace.out
? src/test/regress/sql/constraints.sql
? src/test/regress/sql/copy.sql
? src/test/regress/sql/create_function_1.sql
? src/test/regress/sql/create_function_2.sql
? src/test/regress/sql/misc.sql
? src/test/regress/sql/tablespace.sql
? src/timezone/zic
Index: src/backend/access/gist/gist.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/gist/gist.c,v
retrieving revision 1.129
diff -c -r1.129 gist.c
*** src/backend/access/gist/gist.c	5 Mar 2006 15:58:20 -0000	1.129
--- src/backend/access/gist/gist.c	22 Mar 2006 18:35:31 -0000
***************
*** 1123,1129 ****
  		ROTATEDIST(*dist);
  		(*dist)->block.blkno = BufferGetBlockNumber(rightbuf);
  		(*dist)->block.num = v.spl_nright;
! 		(*dist)->list = (IndexTupleData *) palloc(BLCKSZ);
  		ptr = (char *) ((*dist)->list);
  		for (i = 0; i < v.spl_nright; i++)
  		{
--- 1123,1129 ----
  		ROTATEDIST(*dist);
  		(*dist)->block.blkno = BufferGetBlockNumber(rightbuf);
  		(*dist)->block.num = v.spl_nright;
! 		(*dist)->list = (IndexTupleData *) palloc(LOG_BLCKSZ);
  		ptr = (char *) ((*dist)->list);
  		for (i = 0; i < v.spl_nright; i++)
  		{
***************
*** 1159,1165 ****
  		ROTATEDIST(*dist);
  		(*dist)->block.blkno = BufferGetBlockNumber(leftbuf);
  		(*dist)->block.num = v.spl_nleft;
! 		(*dist)->list = (IndexTupleData *) palloc(BLCKSZ);
  		ptr = (char *) ((*dist)->list);
  		for (i = 0; i < v.spl_nleft; i++)
  		{
--- 1159,1165 ----
  		ROTATEDIST(*dist);
  		(*dist)->block.blkno = BufferGetBlockNumber(leftbuf);
  		(*dist)->block.num = v.spl_nleft;
! 		(*dist)->list = (IndexTupleData *) palloc(LOG_BLCKSZ);
  		ptr = (char *) ((*dist)->list);
  		for (i = 0; i < v.spl_nleft; i++)
  		{
Index: src/backend/access/gist/gistutil.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/gist/gistutil.c,v
retrieving revision 1.10
diff -c -r1.10 gistutil.c
*** src/backend/access/gist/gistutil.c	5 Mar 2006 15:58:20 -0000	1.10
--- src/backend/access/gist/gistutil.c	22 Mar 2006 18:35:31 -0000
***************
*** 894,900 ****
  	 * Additionally check that the special area looks sane.
  	 */
  	if (((PageHeader) (page))->pd_special !=
! 		(BLCKSZ - MAXALIGN(sizeof(GISTPageOpaqueData))))
  		ereport(ERROR,
  				(errcode(ERRCODE_INDEX_CORRUPTED),
  				 errmsg("index \"%s\" contains corrupted page at block %u",
--- 894,900 ----
  	 * Additionally check that the special area looks sane.
  	 */
  	if (((PageHeader) (page))->pd_special !=
! 		(DATA_BLCKSZ - MAXALIGN(sizeof(GISTPageOpaqueData))))
  		ereport(ERROR,
  				(errcode(ERRCODE_INDEX_CORRUPTED),
  				 errmsg("index \"%s\" contains corrupted page at block %u",
Index: src/backend/access/hash/hashpage.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/hash/hashpage.c,v
retrieving revision 1.56
diff -c -r1.56 hashpage.c
*** src/backend/access/hash/hashpage.c	5 Mar 2006 15:58:20 -0000	1.56
--- src/backend/access/hash/hashpage.c	22 Mar 2006 18:35:31 -0000
***************
*** 251,257 ****
  								 RelationGetDescr(rel)->attrs[0]->atttypmod);
  	item_width = MAXALIGN(sizeof(IndexTupleData)) + MAXALIGN(data_width) +
  		sizeof(ItemIdData);		/* include the line pointer */
! 	ffactor = (BLCKSZ * 3 / 4) / item_width;
  	/* keep to a sane range */
  	if (ffactor < 10)
  		ffactor = 10;
--- 251,257 ----
  								 RelationGetDescr(rel)->attrs[0]->atttypmod);
  	item_width = MAXALIGN(sizeof(IndexTupleData)) + MAXALIGN(data_width) +
  		sizeof(ItemIdData);		/* include the line pointer */
! 	ffactor = (DATA_BLCKSZ * 3 / 4) / item_width;
  	/* keep to a sane range */
  	if (ffactor < 10)
  		ffactor = 10;
Index: src/backend/access/hash/hashutil.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/hash/hashutil.c,v
retrieving revision 1.47
diff -c -r1.47 hashutil.c
*** src/backend/access/hash/hashutil.c	5 Mar 2006 15:58:21 -0000	1.47
--- src/backend/access/hash/hashutil.c	22 Mar 2006 18:35:31 -0000
***************
*** 131,137 ****
  	 * Additionally check that the special area looks sane.
  	 */
  	if (((PageHeader) (page))->pd_special !=
! 		(BLCKSZ - MAXALIGN(sizeof(HashPageOpaqueData))))
  		ereport(ERROR,
  				(errcode(ERRCODE_INDEX_CORRUPTED),
  				 errmsg("index \"%s\" contains corrupted page at block %u",
--- 131,137 ----
  	 * Additionally check that the special area looks sane.
  	 */
  	if (((PageHeader) (page))->pd_special !=
! 		(DATA_BLCKSZ - MAXALIGN(sizeof(HashPageOpaqueData))))
  		ereport(ERROR,
  				(errcode(ERRCODE_INDEX_CORRUPTED),
  				 errmsg("index \"%s\" contains corrupted page at block %u",
Index: src/backend/access/heap/heapam.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/heap/heapam.c,v
retrieving revision 1.208
diff -c -r1.208 heapam.c
*** src/backend/access/heap/heapam.c	5 Mar 2006 15:58:21 -0000	1.208
--- src/backend/access/heap/heapam.c	22 Mar 2006 18:35:31 -0000
***************
*** 2955,2962 ****
  		elog(PANIC, "heap_newpage_redo: no block");
  	page = (Page) BufferGetPage(buffer);
  
! 	Assert(record->xl_len == SizeOfHeapNewpage + BLCKSZ);
! 	memcpy(page, (char *) xlrec + SizeOfHeapNewpage, BLCKSZ);
  
  	PageSetLSN(page, lsn);
  	PageSetTLI(page, ThisTimeLineID);
--- 2955,2962 ----
  		elog(PANIC, "heap_newpage_redo: no block");
  	page = (Page) BufferGetPage(buffer);
  
! 	Assert(record->xl_len == SizeOfHeapNewpage + DATA_BLCKSZ);
! 	memcpy(page, (char *) xlrec + SizeOfHeapNewpage, DATA_BLCKSZ);
  
  	PageSetLSN(page, lsn);
  	PageSetTLI(page, ThisTimeLineID);
Index: src/backend/access/nbtree/nbtpage.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v
retrieving revision 1.93
diff -c -r1.93 nbtpage.c
*** src/backend/access/nbtree/nbtpage.c	5 Mar 2006 15:58:21 -0000	1.93
--- src/backend/access/nbtree/nbtpage.c	22 Mar 2006 18:35:31 -0000
***************
*** 101,107 ****
  	BTMetaPageData *metad;
  	BTPageOpaque metaopaque;
  
! 	_bt_pageinit(page, BLCKSZ);
  
  	metad = BTPageGetMeta(page);
  	metad->btm_magic = BTREE_MAGIC;
--- 101,107 ----
  	BTMetaPageData *metad;
  	BTPageOpaque metaopaque;
  
! 	_bt_pageinit(page, DATA_BLCKSZ);
  
  	metad = BTPageGetMeta(page);
  	metad->btm_magic = BTREE_MAGIC;
***************
*** 429,435 ****
  	 * Additionally check that the special area looks sane.
  	 */
  	if (((PageHeader) (page))->pd_special !=
! 		(BLCKSZ - MAXALIGN(sizeof(BTPageOpaqueData))))
  		ereport(ERROR,
  				(errcode(ERRCODE_INDEX_CORRUPTED),
  				 errmsg("index \"%s\" contains corrupted page at block %u",
--- 429,435 ----
  	 * Additionally check that the special area looks sane.
  	 */
  	if (((PageHeader) (page))->pd_special !=
! 		(DATA_BLCKSZ - MAXALIGN(sizeof(BTPageOpaqueData))))
  		ereport(ERROR,
  				(errcode(ERRCODE_INDEX_CORRUPTED),
  				 errmsg("index \"%s\" contains corrupted page at block %u",
Index: src/backend/access/nbtree/nbtsort.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v
retrieving revision 1.100
diff -c -r1.100 nbtsort.c
*** src/backend/access/nbtree/nbtsort.c	10 Mar 2006 20:18:15 -0000	1.100
--- src/backend/access/nbtree/nbtsort.c	22 Mar 2006 18:35:31 -0000
***************
*** 234,243 ****
  	Page		page;
  	BTPageOpaque opaque;
  
! 	page = (Page) palloc(BLCKSZ);
  
  	/* Zero the page and set up standard page header info */
! 	_bt_pageinit(page, BLCKSZ);
  
  	/* Initialize BT opaque state */
  	opaque = (BTPageOpaque) PageGetSpecialPointer(page);
--- 234,243 ----
  	Page		page;
  	BTPageOpaque opaque;
  
! 	page = (Page) palloc(DATA_BLCKSZ);
  
  	/* Zero the page and set up standard page header info */
! 	_bt_pageinit(page, DATA_BLCKSZ);
  
  	/* Initialize BT opaque state */
  	opaque = (BTPageOpaque) PageGetSpecialPointer(page);
***************
*** 280,286 ****
  		rdata[0].next = &(rdata[1]);
  
  		rdata[1].data = (char *) page;
! 		rdata[1].len = BLCKSZ;
  		rdata[1].buffer = InvalidBuffer;
  		rdata[1].next = NULL;
  
--- 280,286 ----
  		rdata[0].next = &(rdata[1]);
  
  		rdata[1].data = (char *) page;
! 		rdata[1].len = DATA_BLCKSZ;
  		rdata[1].buffer = InvalidBuffer;
  		rdata[1].next = NULL;
  
***************
*** 307,313 ****
  	while (blkno > wstate->btws_pages_written)
  	{
  		if (!wstate->btws_zeropage)
! 			wstate->btws_zeropage = (Page) palloc0(BLCKSZ);
  		smgrwrite(wstate->index->rd_smgr, wstate->btws_pages_written++,
  				  (char *) wstate->btws_zeropage,
  				  true);
--- 307,313 ----
  	while (blkno > wstate->btws_pages_written)
  	{
  		if (!wstate->btws_zeropage)
! 			wstate->btws_zeropage = (Page) palloc0(DATA_BLCKSZ);
  		smgrwrite(wstate->index->rd_smgr, wstate->btws_pages_written++,
  				  (char *) wstate->btws_zeropage,
  				  true);
***************
*** 662,668 ****
  	 * set to point to "P_NONE").  This changes the index to the "valid" state
  	 * by filling in a valid magic number in the metapage.
  	 */
! 	metapage = (Page) palloc(BLCKSZ);
  	_bt_initmetapage(metapage, rootblkno, rootlevel);
  	_bt_blwritepage(wstate, metapage, BTREE_METAPAGE);
  }
--- 662,668 ----
  	 * set to point to "P_NONE").  This changes the index to the "valid" state
  	 * by filling in a valid magic number in the metapage.
  	 */
! 	metapage = (Page) palloc(DATA_BLCKSZ);
  	_bt_initmetapage(metapage, rootblkno, rootlevel);
  	_bt_blwritepage(wstate, metapage, BTREE_METAPAGE);
  }
Index: src/backend/access/transam/clog.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/transam/clog.c,v
retrieving revision 1.37
diff -c -r1.37 clog.c
*** src/backend/access/transam/clog.c	5 Mar 2006 15:58:21 -0000	1.37
--- src/backend/access/transam/clog.c	22 Mar 2006 18:35:31 -0000
***************
*** 36,42 ****
  
  
  /*
!  * Defines for CLOG page sizes.  A page is the same BLCKSZ as is used
   * everywhere else in Postgres.
   *
   * Note: because TransactionIds are 32 bits and wrap around at 0xFFFFFFFF,
--- 36,42 ----
  
  
  /*
!  * Defines for CLOG page sizes.  A page is the same LOG_BLCKSZ as is used
   * everywhere else in Postgres.
   *
   * Note: because TransactionIds are 32 bits and wrap around at 0xFFFFFFFF,
***************
*** 49,55 ****
  /* We need two bits per xact, so four xacts fit in a byte */
  #define CLOG_BITS_PER_XACT	2
  #define CLOG_XACTS_PER_BYTE 4
! #define CLOG_XACTS_PER_PAGE (BLCKSZ * CLOG_XACTS_PER_BYTE)
  #define CLOG_XACT_BITMASK	((1 << CLOG_BITS_PER_XACT) - 1)
  
  #define TransactionIdToPage(xid)	((xid) / (TransactionId) CLOG_XACTS_PER_PAGE)
--- 49,55 ----
  /* We need two bits per xact, so four xacts fit in a byte */
  #define CLOG_BITS_PER_XACT	2
  #define CLOG_XACTS_PER_BYTE 4
! #define CLOG_XACTS_PER_PAGE (LOG_BLCKSZ * CLOG_XACTS_PER_BYTE)
  #define CLOG_XACT_BITMASK	((1 << CLOG_BITS_PER_XACT) - 1)
  
  #define TransactionIdToPage(xid)	((xid) / (TransactionId) CLOG_XACTS_PER_PAGE)
***************
*** 245,251 ****
  		/* Zero so-far-unused positions in the current byte */
  		*byteptr &= (1 << bshift) - 1;
  		/* Zero the rest of the page */
! 		MemSet(byteptr + 1, 0, BLCKSZ - byteno - 1);
  
  		ClogCtl->shared->page_dirty[slotno] = true;
  	}
--- 245,251 ----
  		/* Zero so-far-unused positions in the current byte */
  		*byteptr &= (1 << bshift) - 1;
  		/* Zero the rest of the page */
! 		MemSet(byteptr + 1, 0, LOG_BLCKSZ - byteno - 1);
  
  		ClogCtl->shared->page_dirty[slotno] = true;
  	}
Index: src/backend/access/transam/multixact.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/transam/multixact.c,v
retrieving revision 1.16
diff -c -r1.16 multixact.c
*** src/backend/access/transam/multixact.c	5 Mar 2006 15:58:21 -0000	1.16
--- src/backend/access/transam/multixact.c	22 Mar 2006 18:35:32 -0000
***************
*** 59,65 ****
  
  
  /*
!  * Defines for MultiXactOffset page sizes.	A page is the same BLCKSZ as is
   * used everywhere else in Postgres.
   *
   * Note: because both MultiXactOffsets and TransactionIds are 32 bits and
--- 59,65 ----
  
  
  /*
!  * Defines for MultiXactOffset page sizes.	A page is the same LOG_BLCKSZ as is
   * used everywhere else in Postgres.
   *
   * Note: because both MultiXactOffsets and TransactionIds are 32 bits and
***************
*** 72,79 ****
   */
  
  /* We need four bytes per offset and also four bytes per member */
! #define MULTIXACT_OFFSETS_PER_PAGE (BLCKSZ / sizeof(MultiXactOffset))
! #define MULTIXACT_MEMBERS_PER_PAGE (BLCKSZ / sizeof(TransactionId))
  
  #define MultiXactIdToOffsetPage(xid) \
  	((xid) / (MultiXactOffset) MULTIXACT_OFFSETS_PER_PAGE)
--- 72,79 ----
   */
  
  /* We need four bytes per offset and also four bytes per member */
! #define MULTIXACT_OFFSETS_PER_PAGE (LOG_BLCKSZ / sizeof(MultiXactOffset))
! #define MULTIXACT_MEMBERS_PER_PAGE (LOG_BLCKSZ / sizeof(TransactionId))
  
  #define MultiXactIdToOffsetPage(xid) \
  	((xid) / (MultiXactOffset) MULTIXACT_OFFSETS_PER_PAGE)
***************
*** 1406,1412 ****
  		offptr = (MultiXactOffset *) MultiXactOffsetCtl->shared->page_buffer[slotno];
  		offptr += entryno;
  
! 		MemSet(offptr, 0, BLCKSZ - (entryno * sizeof(MultiXactOffset)));
  
  		MultiXactOffsetCtl->shared->page_dirty[slotno] = true;
  	}
--- 1406,1412 ----
  		offptr = (MultiXactOffset *) MultiXactOffsetCtl->shared->page_buffer[slotno];
  		offptr += entryno;
  
! 		MemSet(offptr, 0, LOG_BLCKSZ - (entryno * sizeof(MultiXactOffset)));
  
  		MultiXactOffsetCtl->shared->page_dirty[slotno] = true;
  	}
***************
*** 1436,1442 ****
  		xidptr = (TransactionId *) MultiXactMemberCtl->shared->page_buffer[slotno];
  		xidptr += entryno;
  
! 		MemSet(xidptr, 0, BLCKSZ - (entryno * sizeof(TransactionId)));
  
  		MultiXactMemberCtl->shared->page_dirty[slotno] = true;
  	}
--- 1436,1442 ----
  		xidptr = (TransactionId *) MultiXactMemberCtl->shared->page_buffer[slotno];
  		xidptr += entryno;
  
! 		MemSet(xidptr, 0, LOG_BLCKSZ - (entryno * sizeof(TransactionId)));
  
  		MultiXactMemberCtl->shared->page_dirty[slotno] = true;
  	}
Index: src/backend/access/transam/slru.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/transam/slru.c,v
retrieving revision 1.36
diff -c -r1.36 slru.c
*** src/backend/access/transam/slru.c	5 Mar 2006 15:58:21 -0000	1.36
--- src/backend/access/transam/slru.c	22 Mar 2006 18:35:32 -0000
***************
*** 59,65 ****
  
  
  /*
!  * Define segment size.  A page is the same BLCKSZ as is used everywhere
   * else in Postgres.  The segment size can be chosen somewhat arbitrarily;
   * we make it 32 pages by default, or 256Kb, i.e. 1M transactions for CLOG
   * or 64K transactions for SUBTRANS.
--- 59,65 ----
  
  
  /*
!  * Define segment size.  A page is the same DATA_BLCKSZ as is used everywhere
   * else in Postgres.  The segment size can be chosen somewhat arbitrarily;
   * we make it 32 pages by default, or 256Kb, i.e. 1M transactions for CLOG
   * or 64K transactions for SUBTRANS.
***************
*** 164,170 ****
  	sz += MAXALIGN(nslots * sizeof(int));				/* page_lru_count[] */
  	sz += MAXALIGN(nslots * sizeof(LWLockId));			/* buffer_locks[] */
  	
! 	return BUFFERALIGN(sz) + BLCKSZ * nslots;
  }
  
  void
--- 164,170 ----
  	sz += MAXALIGN(nslots * sizeof(int));				/* page_lru_count[] */
  	sz += MAXALIGN(nslots * sizeof(LWLockId));			/* buffer_locks[] */
  	
! 	return BUFFERALIGN(sz) + DATA_BLCKSZ * nslots;
  }
  
  void
***************
*** 220,226 ****
  			shared->page_dirty[slotno] = false;
  			shared->page_lru_count[slotno] = 0;
  			shared->buffer_locks[slotno] = LWLockAssign();
! 			ptr += BLCKSZ;
  		}
  	}
  	else
--- 220,226 ----
  			shared->page_dirty[slotno] = false;
  			shared->page_lru_count[slotno] = 0;
  			shared->buffer_locks[slotno] = LWLockAssign();
! 			ptr += DATA_BLCKSZ;
  		}
  	}
  	else
***************
*** 263,269 ****
  	SlruRecentlyUsed(shared, slotno);
  
  	/* Set the buffer to zeroes */
! 	MemSet(shared->page_buffer[slotno], 0, BLCKSZ);
  
  	/* Assume this page is now the latest active page */
  	shared->latest_page_number = pageno;
--- 263,269 ----
  	SlruRecentlyUsed(shared, slotno);
  
  	/* Set the buffer to zeroes */
! 	MemSet(shared->page_buffer[slotno], 0, DATA_BLCKSZ);
  
  	/* Assume this page is now the latest active page */
  	shared->latest_page_number = pageno;
***************
*** 539,545 ****
  	SlruShared	shared = ctl->shared;
  	int			segno = pageno / SLRU_PAGES_PER_SEGMENT;
  	int			rpageno = pageno % SLRU_PAGES_PER_SEGMENT;
! 	int			offset = rpageno * BLCKSZ;
  	char		path[MAXPGPATH];
  	int			fd;
  
--- 539,545 ----
  	SlruShared	shared = ctl->shared;
  	int			segno = pageno / SLRU_PAGES_PER_SEGMENT;
  	int			rpageno = pageno % SLRU_PAGES_PER_SEGMENT;
! 	int			offset = rpageno * DATA_BLCKSZ;
  	char		path[MAXPGPATH];
  	int			fd;
  
***************
*** 565,571 ****
  		ereport(LOG,
  				(errmsg("file \"%s\" doesn't exist, reading as zeroes",
  						path)));
! 		MemSet(shared->page_buffer[slotno], 0, BLCKSZ);
  		return true;
  	}
  
--- 565,571 ----
  		ereport(LOG,
  				(errmsg("file \"%s\" doesn't exist, reading as zeroes",
  						path)));
! 		MemSet(shared->page_buffer[slotno], 0, DATA_BLCKSZ);
  		return true;
  	}
  
***************
*** 578,584 ****
  	}
  
  	errno = 0;
! 	if (read(fd, shared->page_buffer[slotno], BLCKSZ) != BLCKSZ)
  	{
  		slru_errcause = SLRU_READ_FAILED;
  		slru_errno = errno;
--- 578,584 ----
  	}
  
  	errno = 0;
! 	if (read(fd, shared->page_buffer[slotno], DATA_BLCKSZ) != DATA_BLCKSZ)
  	{
  		slru_errcause = SLRU_READ_FAILED;
  		slru_errno = errno;
***************
*** 616,622 ****
  	SlruShared	shared = ctl->shared;
  	int			segno = pageno / SLRU_PAGES_PER_SEGMENT;
  	int			rpageno = pageno % SLRU_PAGES_PER_SEGMENT;
! 	int			offset = rpageno * BLCKSZ;
  	char		path[MAXPGPATH];
  	int			fd = -1;
  
--- 616,622 ----
  	SlruShared	shared = ctl->shared;
  	int			segno = pageno / SLRU_PAGES_PER_SEGMENT;
  	int			rpageno = pageno % SLRU_PAGES_PER_SEGMENT;
! 	int			offset = rpageno * DATA_BLCKSZ;
  	char		path[MAXPGPATH];
  	int			fd = -1;
  
***************
*** 695,701 ****
  	}
  
  	errno = 0;
! 	if (write(fd, shared->page_buffer[slotno], BLCKSZ) != BLCKSZ)
  	{
  		/* if write didn't set errno, assume problem is no disk space */
  		if (errno == 0)
--- 695,701 ----
  	}
  
  	errno = 0;
! 	if (write(fd, shared->page_buffer[slotno], DATA_BLCKSZ) != DATA_BLCKSZ)
  	{
  		/* if write didn't set errno, assume problem is no disk space */
  		if (errno == 0)
***************
*** 741,747 ****
  {
  	int			segno = pageno / SLRU_PAGES_PER_SEGMENT;
  	int			rpageno = pageno % SLRU_PAGES_PER_SEGMENT;
! 	int			offset = rpageno * BLCKSZ;
  	char		path[MAXPGPATH];
  
  	SlruFileName(ctl, path, segno);
--- 741,747 ----
  {
  	int			segno = pageno / SLRU_PAGES_PER_SEGMENT;
  	int			rpageno = pageno % SLRU_PAGES_PER_SEGMENT;
! 	int			offset = rpageno * DATA_BLCKSZ;
  	char		path[MAXPGPATH];
  
  	SlruFileName(ctl, path, segno);
Index: src/backend/access/transam/subtrans.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/transam/subtrans.c,v
retrieving revision 1.16
diff -c -r1.16 subtrans.c
*** src/backend/access/transam/subtrans.c	5 Mar 2006 15:58:22 -0000	1.16
--- src/backend/access/transam/subtrans.c	22 Mar 2006 18:35:32 -0000
***************
*** 34,40 ****
  
  
  /*
!  * Defines for SubTrans page sizes.  A page is the same BLCKSZ as is used
   * everywhere else in Postgres.
   *
   * Note: because TransactionIds are 32 bits and wrap around at 0xFFFFFFFF,
--- 34,40 ----
  
  
  /*
!  * Defines for SubTrans page sizes.  A page is the same DATA_BLCKSZ as is used
   * everywhere else in Postgres.
   *
   * Note: because TransactionIds are 32 bits and wrap around at 0xFFFFFFFF,
***************
*** 46,52 ****
   */
  
  /* We need four bytes per xact */
! #define SUBTRANS_XACTS_PER_PAGE (BLCKSZ / sizeof(TransactionId))
  
  #define TransactionIdToPage(xid) ((xid) / (TransactionId) SUBTRANS_XACTS_PER_PAGE)
  #define TransactionIdToEntry(xid) ((xid) % (TransactionId) SUBTRANS_XACTS_PER_PAGE)
--- 46,52 ----
   */
  
  /* We need four bytes per xact */
! #define SUBTRANS_XACTS_PER_PAGE (DATA_BLCKSZ / sizeof(TransactionId))
  
  #define TransactionIdToPage(xid) ((xid) / (TransactionId) SUBTRANS_XACTS_PER_PAGE)
  #define TransactionIdToEntry(xid) ((xid) % (TransactionId) SUBTRANS_XACTS_PER_PAGE)
Index: src/backend/access/transam/xlog.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/transam/xlog.c,v
retrieving revision 1.227
diff -c -r1.227 xlog.c
*** src/backend/access/transam/xlog.c	5 Mar 2006 15:58:22 -0000	1.227
--- src/backend/access/transam/xlog.c	22 Mar 2006 18:35:32 -0000
***************
*** 113,122 ****
  
  /*
   * Limitation of buffer-alignment for direct IO depends on OS and filesystem,
!  * but BLCKSZ is assumed to be enough for it.
   */
  #ifdef O_DIRECT
! #define ALIGNOF_XLOG_BUFFER		BLCKSZ
  #else
  #define ALIGNOF_XLOG_BUFFER		ALIGNOF_BUFFER
  #endif
--- 113,122 ----
  
  /*
   * Limitation of buffer-alignment for direct IO depends on OS and filesystem,
!  * but LOG_BLCKSZ is assumed to be enough for it.
   */
  #ifdef O_DIRECT
! #define ALIGNOF_XLOG_BUFFER		LOG_BLCKSZ
  #else
  #define ALIGNOF_XLOG_BUFFER		ALIGNOF_BUFFER
  #endif
***************
*** 374,380 ****
  	 * and xlblocks values depends on WALInsertLock and WALWriteLock.
  	 */
  	char	   *pages;			/* buffers for unwritten XLOG pages */
! 	XLogRecPtr *xlblocks;		/* 1st byte ptr-s + BLCKSZ */
  	Size		XLogCacheByte;	/* # bytes in xlog buffers */
  	int			XLogCacheBlck;	/* highest allocated xlog buffer index */
  	TimeLineID	ThisTimeLineID;
--- 374,380 ----
  	 * and xlblocks values depends on WALInsertLock and WALWriteLock.
  	 */
  	char	   *pages;			/* buffers for unwritten XLOG pages */
! 	XLogRecPtr *xlblocks;		/* 1st byte ptr-s + LOG_BLCKSZ */
  	Size		XLogCacheByte;	/* # bytes in xlog buffers */
  	int			XLogCacheBlck;	/* highest allocated xlog buffer index */
  	TimeLineID	ThisTimeLineID;
***************
*** 397,403 ****
  
  /* Free space remaining in the current xlog page buffer */
  #define INSERT_FREESPACE(Insert)  \
! 	(BLCKSZ - ((Insert)->currpos - (char *) (Insert)->currpage))
  
  /* Construct XLogRecPtr value for current insertion point */
  #define INSERT_RECPTR(recptr,Insert,curridx)  \
--- 397,403 ----
  
  /* Free space remaining in the current xlog page buffer */
  #define INSERT_FREESPACE(Insert)  \
! 	(LOG_BLCKSZ - ((Insert)->currpos - (char *) (Insert)->currpage))
  
  /* Construct XLogRecPtr value for current insertion point */
  #define INSERT_RECPTR(recptr,Insert,curridx)  \
***************
*** 441,447 ****
  static uint32 readSeg = 0;
  static uint32 readOff = 0;
  
! /* Buffer for currently read page (BLCKSZ bytes) */
  static char *readBuf = NULL;
  
  /* Buffer for current ReadRecord result (expandable) */
--- 441,447 ----
  static uint32 readSeg = 0;
  static uint32 readOff = 0;
  
! /* Buffer for currently read page (LOG_BLCKSZ bytes) */
  static char *readBuf = NULL;
  
  /* Buffer for current ReadRecord result (expandable) */
***************
*** 662,668 ****
  			{
  				COMP_CRC32(rdata_crc,
  						   page,
! 						   BLCKSZ);
  			}
  			else
  			{
--- 662,668 ----
  			{
  				COMP_CRC32(rdata_crc,
  						   page,
! 						   LOG_BLCKSZ);
  			}
  			else
  			{
***************
*** 672,678 ****
  						   bkpb->hole_offset);
  				COMP_CRC32(rdata_crc,
  						   page + (bkpb->hole_offset + bkpb->hole_length),
! 						   BLCKSZ - (bkpb->hole_offset + bkpb->hole_length));
  			}
  		}
  	}
--- 672,678 ----
  						   bkpb->hole_offset);
  				COMP_CRC32(rdata_crc,
  						   page + (bkpb->hole_offset + bkpb->hole_length),
! 						   LOG_BLCKSZ - (bkpb->hole_offset + bkpb->hole_length));
  			}
  		}
  	}
***************
*** 705,711 ****
  	 * If cache is half filled then try to acquire write lock and do
  	 * XLogWrite. Ignore any fractional blocks in performing this check.
  	 */
! 	LogwrtRqst.Write.xrecoff -= LogwrtRqst.Write.xrecoff % BLCKSZ;
  	if (LogwrtRqst.Write.xlogid != LogwrtResult.Write.xlogid ||
  		(LogwrtRqst.Write.xrecoff >= LogwrtResult.Write.xrecoff +
  		 XLogCtl->XLogCacheByte / 2))
--- 705,711 ----
  	 * If cache is half filled then try to acquire write lock and do
  	 * XLogWrite. Ignore any fractional blocks in performing this check.
  	 */
! 	LogwrtRqst.Write.xrecoff -= LogwrtRqst.Write.xrecoff % LOG_BLCKSZ;
  	if (LogwrtRqst.Write.xlogid != LogwrtResult.Write.xlogid ||
  		(LogwrtRqst.Write.xrecoff >= LogwrtResult.Write.xrecoff +
  		 XLogCtl->XLogCacheByte / 2))
***************
*** 795,802 ****
  		if (bkpb->hole_length == 0)
  		{
  			rdt->data = page;
! 			rdt->len = BLCKSZ;
! 			write_len += BLCKSZ;
  			rdt->next = NULL;
  		}
  		else
--- 795,802 ----
  		if (bkpb->hole_length == 0)
  		{
  			rdt->data = page;
! 			rdt->len = LOG_BLCKSZ;
! 			write_len += LOG_BLCKSZ;
  			rdt->next = NULL;
  		}
  		else
***************
*** 810,816 ****
  			rdt = rdt->next;
  
  			rdt->data = page + (bkpb->hole_offset + bkpb->hole_length);
! 			rdt->len = BLCKSZ - (bkpb->hole_offset + bkpb->hole_length);
  			write_len += rdt->len;
  			rdt->next = NULL;
  		}
--- 810,816 ----
  			rdt = rdt->next;
  
  			rdt->data = page + (bkpb->hole_offset + bkpb->hole_length);
! 			rdt->len = LOG_BLCKSZ - (bkpb->hole_offset + bkpb->hole_length);
  			write_len += rdt->len;
  			rdt->next = NULL;
  		}
***************
*** 993,999 ****
  
  			if (lower >= SizeOfPageHeaderData &&
  				upper > lower &&
! 				upper <= BLCKSZ)
  			{
  				bkpb->hole_offset = lower;
  				bkpb->hole_length = upper - lower;
--- 993,999 ----
  
  			if (lower >= SizeOfPageHeaderData &&
  				upper > lower &&
! 				upper <= LOG_BLCKSZ)
  			{
  				bkpb->hole_offset = lower;
  				bkpb->hole_length = upper - lower;
***************
*** 1225,1236 ****
  	{
  		/* crossing a logid boundary */
  		NewPageEndPtr.xlogid += 1;
! 		NewPageEndPtr.xrecoff = BLCKSZ;
  	}
  	else
! 		NewPageEndPtr.xrecoff += BLCKSZ;
  	XLogCtl->xlblocks[nextidx] = NewPageEndPtr;
! 	NewPage = (XLogPageHeader) (XLogCtl->pages + nextidx * (Size) BLCKSZ);
  
  	Insert->curridx = nextidx;
  	Insert->currpage = NewPage;
--- 1225,1236 ----
  	{
  		/* crossing a logid boundary */
  		NewPageEndPtr.xlogid += 1;
! 		NewPageEndPtr.xrecoff = LOG_BLCKSZ;
  	}
  	else
! 		NewPageEndPtr.xrecoff += LOG_BLCKSZ;
  	XLogCtl->xlblocks[nextidx] = NewPageEndPtr;
! 	NewPage = (XLogPageHeader) (XLogCtl->pages + nextidx * (Size) LOG_BLCKSZ);
  
  	Insert->curridx = nextidx;
  	Insert->currpage = NewPage;
***************
*** 1241,1247 ****
  	 * Be sure to re-zero the buffer so that bytes beyond what we've written
  	 * will look like zeroes and not valid XLOG records...
  	 */
! 	MemSet((char *) NewPage, 0, BLCKSZ);
  
  	/*
  	 * Fill the new page's header
--- 1241,1247 ----
  	 * Be sure to re-zero the buffer so that bytes beyond what we've written
  	 * will look like zeroes and not valid XLOG records...
  	 */
! 	MemSet((char *) NewPage, 0, LOG_BLCKSZ);
  
  	/*
  	 * Fill the new page's header
***************
*** 1251,1257 ****
  	/* NewPage->xlp_info = 0; */	/* done by memset */
  	NewPage   ->xlp_tli = ThisTimeLineID;
  	NewPage   ->xlp_pageaddr.xlogid = NewPageEndPtr.xlogid;
! 	NewPage   ->xlp_pageaddr.xrecoff = NewPageEndPtr.xrecoff - BLCKSZ;
  
  	/*
  	 * If first page of an XLOG segment file, make it a long header.
--- 1251,1257 ----
  	/* NewPage->xlp_info = 0; */	/* done by memset */
  	NewPage   ->xlp_tli = ThisTimeLineID;
  	NewPage   ->xlp_pageaddr.xlogid = NewPageEndPtr.xlogid;
! 	NewPage   ->xlp_pageaddr.xrecoff = NewPageEndPtr.xrecoff - LOG_BLCKSZ;
  
  	/*
  	 * If first page of an XLOG segment file, make it a long header.
***************
*** 1425,1431 ****
  		{
  			/* first of group */
  			startidx = curridx;
! 			startoffset = (LogwrtResult.Write.xrecoff - BLCKSZ) % XLogSegSize;
  		}
  		npages++;
  
--- 1425,1432 ----
  		{
  			/* first of group */
  			startidx = curridx;
! 			startoffset =
! 					(LogwrtResult.Write.xrecoff - LOG_BLCKSZ) % XLogSegSize;
  		}
  		npages++;
  
***************
*** 1436,1442 ****
  		 * segment.
  		 */
  		finishing_seg = !ispartialpage &&
! 			(startoffset + npages * BLCKSZ) >= XLogSegSize;
  
  		if (!XLByteLT(LogwrtResult.Write, WriteRqst.Write) ||
  			curridx == XLogCtl->XLogCacheBlck ||
--- 1437,1443 ----
  		 * segment.
  		 */
  		finishing_seg = !ispartialpage &&
! 			(startoffset + npages * LOG_BLCKSZ) >= XLogSegSize;
  
  		if (!XLByteLT(LogwrtResult.Write, WriteRqst.Write) ||
  			curridx == XLogCtl->XLogCacheBlck ||
***************
*** 1458,1465 ****
  			}
  
  			/* OK to write the page(s) */
! 			from = XLogCtl->pages + startidx * (Size) BLCKSZ;
! 			nbytes = npages * (Size) BLCKSZ;
  			errno = 0;
  			if (write(openLogFile, from, nbytes) != nbytes)
  			{
--- 1459,1466 ----
  			}
  
  			/* OK to write the page(s) */
! 			from = XLogCtl->pages + startidx * (Size) LOG_BLCKSZ;
! 			nbytes = npages * (Size) LOG_BLCKSZ;
  			errno = 0;
  			if (write(openLogFile, from, nbytes) != nbytes)
  			{
***************
*** 1717,1723 ****
  {
  	char		path[MAXPGPATH];
  	char		tmppath[MAXPGPATH];
! 	char		zbuffer[BLCKSZ];
  	uint32		installed_log;
  	uint32		installed_seg;
  	int			max_advance;
--- 1718,1724 ----
  {
  	char		path[MAXPGPATH];
  	char		tmppath[MAXPGPATH];
! 	char		zbuffer[LOG_BLCKSZ];
  	uint32		installed_log;
  	uint32		installed_seg;
  	int			max_advance;
***************
*** 1855,1861 ****
  {
  	char		path[MAXPGPATH];
  	char		tmppath[MAXPGPATH];
! 	char		buffer[BLCKSZ];
  	int			srcfd;
  	int			fd;
  	int			nbytes;
--- 1856,1862 ----
  {
  	char		path[MAXPGPATH];
  	char		tmppath[MAXPGPATH];
! 	char		buffer[LOG_BLCKSZ];
  	int			srcfd;
  	int			fd;
  	int			nbytes;
***************
*** 2516,2531 ****
  
  				if (bkpb.hole_length == 0)
  				{
! 					memcpy((char *) page, blk, BLCKSZ);
  				}
  				else
  				{
  					/* must zero-fill the hole */
! 					MemSet((char *) page, 0, BLCKSZ);
  					memcpy((char *) page, blk, bkpb.hole_offset);
  					memcpy((char *) page + (bkpb.hole_offset + bkpb.hole_length),
  						   blk + bkpb.hole_offset,
! 						   BLCKSZ - (bkpb.hole_offset + bkpb.hole_length));
  				}
  
  				PageSetLSN(page, lsn);
--- 2517,2532 ----
  
  				if (bkpb.hole_length == 0)
  				{
! 					memcpy((char *) page, blk, LOG_BLCKSZ);
  				}
  				else
  				{
  					/* must zero-fill the hole */
! 					MemSet((char *) page, 0, LOG_BLCKSZ);
  					memcpy((char *) page, blk, bkpb.hole_offset);
  					memcpy((char *) page + (bkpb.hole_offset + bkpb.hole_length),
  						   blk + bkpb.hole_offset,
! 						   LOG_BLCKSZ - (bkpb.hole_offset + bkpb.hole_length));
  				}
  
  				PageSetLSN(page, lsn);
***************
*** 2535,2541 ****
  			}
  		}
  
! 		blk += BLCKSZ - bkpb.hole_length;
  	}
  }
  
--- 2536,2542 ----
  			}
  		}
  
! 		blk += LOG_BLCKSZ - bkpb.hole_length;
  	}
  }
  
***************
*** 2569,2582 ****
  			continue;
  
  		memcpy(&bkpb, blk, sizeof(BkpBlock));
! 		if (bkpb.hole_offset + bkpb.hole_length > BLCKSZ)
  		{
  			ereport(emode,
  					(errmsg("incorrect hole size in record at %X/%X",
  							recptr.xlogid, recptr.xrecoff)));
  			return false;
  		}
! 		blen = sizeof(BkpBlock) + BLCKSZ - bkpb.hole_length;
  		COMP_CRC32(crc, blk, blen);
  		blk += blen;
  	}
--- 2570,2583 ----
  			continue;
  
  		memcpy(&bkpb, blk, sizeof(BkpBlock));
! 		if (bkpb.hole_offset + bkpb.hole_length > LOG_BLCKSZ)
  		{
  			ereport(emode,
  					(errmsg("incorrect hole size in record at %X/%X",
  							recptr.xlogid, recptr.xrecoff)));
  			return false;
  		}
! 		blen = sizeof(BkpBlock) + LOG_BLCKSZ - bkpb.hole_length;
  		COMP_CRC32(crc, blk, blen);
  		blk += blen;
  	}
***************
*** 2640,2646 ****
  		 * (2) a static char array isn't guaranteed to have any particular
  		 * alignment, whereas malloc() will provide MAXALIGN'd storage.
  		 */
! 		readBuf = (char *) malloc(BLCKSZ);
  		Assert(readBuf != NULL);
  	}
  
--- 2641,2647 ----
  		 * (2) a static char array isn't guaranteed to have any particular
  		 * alignment, whereas malloc() will provide MAXALIGN'd storage.
  		 */
! 		readBuf = (char *) malloc(LOG_BLCKSZ);
  		Assert(readBuf != NULL);
  	}
  
***************
*** 2654,2661 ****
  			goto got_record;
  		}
  		/* align old recptr to next page */
! 		if (tmpRecPtr.xrecoff % BLCKSZ != 0)
! 			tmpRecPtr.xrecoff += (BLCKSZ - tmpRecPtr.xrecoff % BLCKSZ);
  		if (tmpRecPtr.xrecoff >= XLogFileSize)
  		{
  			(tmpRecPtr.xlogid)++;
--- 2655,2662 ----
  			goto got_record;
  		}
  		/* align old recptr to next page */
! 		if (tmpRecPtr.xrecoff % LOG_BLCKSZ != 0)
! 			tmpRecPtr.xrecoff += (LOG_BLCKSZ - tmpRecPtr.xrecoff % LOG_BLCKSZ);
  		if (tmpRecPtr.xrecoff >= XLogFileSize)
  		{
  			(tmpRecPtr.xlogid)++;
***************
*** 2699,2705 ****
  		readOff = (uint32) (-1);	/* force read to occur below */
  	}
  
! 	targetPageOff = ((RecPtr->xrecoff % XLogSegSize) / BLCKSZ) * BLCKSZ;
  	if (readOff != targetPageOff)
  	{
  		readOff = targetPageOff;
--- 2700,2706 ----
  		readOff = (uint32) (-1);	/* force read to occur below */
  	}
  
! 	targetPageOff = ((RecPtr->xrecoff % XLogSegSize) / LOG_BLCKSZ) * LOG_BLCKSZ;
  	if (readOff != targetPageOff)
  	{
  		readOff = targetPageOff;
***************
*** 2711,2717 ****
  							readId, readSeg, readOff)));
  			goto next_record_is_invalid;
  		}
! 		if (read(readFile, readBuf, BLCKSZ) != BLCKSZ)
  		{
  			ereport(emode,
  					(errcode_for_file_access(),
--- 2712,2718 ----
  							readId, readSeg, readOff)));
  			goto next_record_is_invalid;
  		}
! 		if (read(readFile, readBuf, LOG_BLCKSZ) != LOG_BLCKSZ)
  		{
  			ereport(emode,
  					(errcode_for_file_access(),
***************
*** 2723,2729 ****
  			goto next_record_is_invalid;
  	}
  	pageHeaderSize = XLogPageHeaderSize((XLogPageHeader) readBuf);
! 	targetRecOff = RecPtr->xrecoff % BLCKSZ;
  	if (targetRecOff == 0)
  	{
  		/*
--- 2724,2730 ----
  			goto next_record_is_invalid;
  	}
  	pageHeaderSize = XLogPageHeaderSize((XLogPageHeader) readBuf);
! 	targetRecOff = RecPtr->xrecoff % LOG_BLCKSZ;
  	if (targetRecOff == 0)
  	{
  		/*
***************
*** 2749,2755 ****
  						RecPtr->xlogid, RecPtr->xrecoff)));
  		goto next_record_is_invalid;
  	}
! 	record = (XLogRecord *) ((char *) readBuf + RecPtr->xrecoff % BLCKSZ);
  
  got_record:;
  
--- 2750,2756 ----
  						RecPtr->xlogid, RecPtr->xrecoff)));
  		goto next_record_is_invalid;
  	}
! 	record = (XLogRecord *) ((char *) readBuf + RecPtr->xrecoff % LOG_BLCKSZ);
  
  got_record:;
  
***************
*** 2766,2772 ****
  	}
  	if (record->xl_tot_len < SizeOfXLogRecord + record->xl_len ||
  		record->xl_tot_len > SizeOfXLogRecord + record->xl_len +
! 		XLR_MAX_BKP_BLOCKS * (sizeof(BkpBlock) + BLCKSZ))
  	{
  		ereport(emode,
  				(errmsg("invalid record length at %X/%X",
--- 2767,2773 ----
  	}
  	if (record->xl_tot_len < SizeOfXLogRecord + record->xl_len ||
  		record->xl_tot_len > SizeOfXLogRecord + record->xl_len +
! 		XLR_MAX_BKP_BLOCKS * (sizeof(BkpBlock) + LOG_BLCKSZ))
  	{
  		ereport(emode,
  				(errmsg("invalid record length at %X/%X",
***************
*** 2814,2821 ****
  
  	/*
  	 * Allocate or enlarge readRecordBuf as needed.  To avoid useless small
! 	 * increases, round its size to a multiple of BLCKSZ, and make sure it's
! 	 * at least 4*BLCKSZ to start with.  (That is enough for all "normal"
  	 * records, but very large commit or abort records might need more space.)
  	 */
  	total_len = record->xl_tot_len;
--- 2815,2822 ----
  
  	/*
  	 * Allocate or enlarge readRecordBuf as needed.  To avoid useless small
! 	 * increases, round its size to a multiple of LOG_BLCKSZ, and make sure it's
! 	 * at least 4*LOG_BLCKSZ to start with.  (That is enough for all "normal"
  	 * records, but very large commit or abort records might need more space.)
  	 */
  	total_len = record->xl_tot_len;
***************
*** 2823,2830 ****
  	{
  		uint32		newSize = total_len;
  
! 		newSize += BLCKSZ - (newSize % BLCKSZ);
! 		newSize = Max(newSize, 4 * BLCKSZ);
  		if (readRecordBuf)
  			free(readRecordBuf);
  		readRecordBuf = (char *) malloc(newSize);
--- 2824,2831 ----
  	{
  		uint32		newSize = total_len;
  
! 		newSize += LOG_BLCKSZ - (newSize % LOG_BLCKSZ);
! 		newSize = Max(newSize, 4 * LOG_BLCKSZ);
  		if (readRecordBuf)
  			free(readRecordBuf);
  		readRecordBuf = (char *) malloc(newSize);
***************
*** 2842,2848 ****
  
  	buffer = readRecordBuf;
  	nextRecord = NULL;
! 	len = BLCKSZ - RecPtr->xrecoff % BLCKSZ;
  	if (total_len > len)
  	{
  		/* Need to reassemble record */
--- 2843,2849 ----
  
  	buffer = readRecordBuf;
  	nextRecord = NULL;
! 	len = LOG_BLCKSZ - RecPtr->xrecoff % LOG_BLCKSZ;
  	if (total_len > len)
  	{
  		/* Need to reassemble record */
***************
*** 2854,2860 ****
  		buffer += len;
  		for (;;)
  		{
! 			readOff += BLCKSZ;
  			if (readOff >= XLogSegSize)
  			{
  				close(readFile);
--- 2855,2861 ----
  		buffer += len;
  		for (;;)
  		{
! 			readOff += LOG_BLCKSZ;
  			if (readOff >= XLogSegSize)
  			{
  				close(readFile);
***************
*** 2865,2871 ****
  					goto next_record_is_invalid;
  				readOff = 0;
  			}
! 			if (read(readFile, readBuf, BLCKSZ) != BLCKSZ)
  			{
  				ereport(emode,
  						(errcode_for_file_access(),
--- 2866,2872 ----
  					goto next_record_is_invalid;
  				readOff = 0;
  			}
! 			if (read(readFile, readBuf, LOG_BLCKSZ) != LOG_BLCKSZ)
  			{
  				ereport(emode,
  						(errcode_for_file_access(),
***************
*** 2893,2899 ****
  								readId, readSeg, readOff)));
  				goto next_record_is_invalid;
  			}
! 			len = BLCKSZ - pageHeaderSize - SizeOfXLogContRecord;
  			if (contrecord->xl_rem_len > len)
  			{
  				memcpy(buffer, (char *) contrecord + SizeOfXLogContRecord, len);
--- 2894,2900 ----
  								readId, readSeg, readOff)));
  				goto next_record_is_invalid;
  			}
! 			len = LOG_BLCKSZ - pageHeaderSize - SizeOfXLogContRecord;
  			if (contrecord->xl_rem_len > len)
  			{
  				memcpy(buffer, (char *) contrecord + SizeOfXLogContRecord, len);
***************
*** 2908,2914 ****
  		if (!RecordIsValid(record, *RecPtr, emode))
  			goto next_record_is_invalid;
  		pageHeaderSize = XLogPageHeaderSize((XLogPageHeader) readBuf);
! 		if (BLCKSZ - SizeOfXLogRecord >= pageHeaderSize +
  			MAXALIGN(SizeOfXLogContRecord + contrecord->xl_rem_len))
  		{
  			nextRecord = (XLogRecord *) ((char *) contrecord +
--- 2909,2915 ----
  		if (!RecordIsValid(record, *RecPtr, emode))
  			goto next_record_is_invalid;
  		pageHeaderSize = XLogPageHeaderSize((XLogPageHeader) readBuf);
! 		if (LOG_BLCKSZ - SizeOfXLogRecord >= pageHeaderSize +
  			MAXALIGN(SizeOfXLogContRecord + contrecord->xl_rem_len))
  		{
  			nextRecord = (XLogRecord *) ((char *) contrecord +
***************
*** 2925,2931 ****
  	/* Record does not cross a page boundary */
  	if (!RecordIsValid(record, *RecPtr, emode))
  		goto next_record_is_invalid;
! 	if (BLCKSZ - SizeOfXLogRecord >= RecPtr->xrecoff % BLCKSZ +
  		MAXALIGN(total_len))
  		nextRecord = (XLogRecord *) ((char *) record + MAXALIGN(total_len));
  	EndRecPtr.xlogid = RecPtr->xlogid;
--- 2926,2932 ----
  	/* Record does not cross a page boundary */
  	if (!RecordIsValid(record, *RecPtr, emode))
  		goto next_record_is_invalid;
! 	if (LOG_BLCKSZ - SizeOfXLogRecord >= RecPtr->xrecoff % LOG_BLCKSZ +
  		MAXALIGN(total_len))
  		nextRecord = (XLogRecord *) ((char *) record + MAXALIGN(total_len));
  	EndRecPtr.xlogid = RecPtr->xlogid;
***************
*** 3221,3227 ****
  	char		tmppath[MAXPGPATH];
  	char		histfname[MAXFNAMELEN];
  	char		xlogfname[MAXFNAMELEN];
! 	char		buffer[BLCKSZ];
  	int			srcfd;
  	int			fd;
  	int			nbytes;
--- 3222,3228 ----
  	char		tmppath[MAXPGPATH];
  	char		histfname[MAXFNAMELEN];
  	char		xlogfname[MAXFNAMELEN];
! 	char		buffer[LOG_BLCKSZ];
  	int			srcfd;
  	int			fd;
  	int			nbytes;
***************
*** 3393,3399 ****
  WriteControlFile(void)
  {
  	int			fd;
! 	char		buffer[BLCKSZ]; /* need not be aligned */
  	char	   *localeptr;
  
  	/*
--- 3394,3400 ----
  WriteControlFile(void)
  {
  	int			fd;
! 	char		buffer[LOG_BLCKSZ]; /* need not be aligned */
  	char	   *localeptr;
  
  	/*
***************
*** 3405,3411 ****
  	ControlFile->maxAlign = MAXIMUM_ALIGNOF;
  	ControlFile->floatFormat = FLOATFORMAT_VALUE;
  
! 	ControlFile->blcksz = BLCKSZ;
  	ControlFile->relseg_size = RELSEG_SIZE;
  	ControlFile->xlog_seg_size = XLOG_SEG_SIZE;
  
--- 3406,3412 ----
  	ControlFile->maxAlign = MAXIMUM_ALIGNOF;
  	ControlFile->floatFormat = FLOATFORMAT_VALUE;
  
! 	ControlFile->logBlcksz = LOG_BLCKSZ;
  	ControlFile->relseg_size = RELSEG_SIZE;
  	ControlFile->xlog_seg_size = XLOG_SEG_SIZE;
  
***************
*** 3438,3454 ****
  	FIN_CRC32(ControlFile->crc);
  
  	/*
! 	 * We write out BLCKSZ bytes into pg_control, zero-padding the excess over
! 	 * sizeof(ControlFileData).  This reduces the odds of premature-EOF errors
! 	 * when reading pg_control.  We'll still fail when we check the contents
! 	 * of the file, but hopefully with a more specific error than "couldn't
! 	 * read pg_control".
  	 */
! 	if (sizeof(ControlFileData) > BLCKSZ)
  		ereport(PANIC,
! 				(errmsg("sizeof(ControlFileData) is larger than BLCKSZ; fix either one")));
  
! 	memset(buffer, 0, BLCKSZ);
  	memcpy(buffer, ControlFile, sizeof(ControlFileData));
  
  	fd = BasicOpenFile(XLOG_CONTROL_FILE,
--- 3439,3455 ----
  	FIN_CRC32(ControlFile->crc);
  
  	/*
! 	 * We write out LOG_BLCKSZ bytes into pg_control, zero-padding the excess
! 	 * over sizeof(ControlFileData).  This reduces the odds of premature-EOF
! 	 * errors when reading pg_control.  We'll still fail when we check the
! 	 * contents of the file, but hopefully with a more specific error than
! 	 * "couldn't read pg_control".
  	 */
! 	if (sizeof(ControlFileData) > LOG_BLCKSZ)
  		ereport(PANIC,
! 				(errmsg("sizeof(ControlFileData) is larger than LOG_BLCKSZ; fix either one")));
  
! 	memset(buffer, 0, LOG_BLCKSZ);
  	memcpy(buffer, ControlFile, sizeof(ControlFileData));
  
  	fd = BasicOpenFile(XLOG_CONTROL_FILE,
***************
*** 3461,3467 ****
  						XLOG_CONTROL_FILE)));
  
  	errno = 0;
! 	if (write(fd, buffer, BLCKSZ) != BLCKSZ)
  	{
  		/* if write didn't set errno, assume problem is no disk space */
  		if (errno == 0)
--- 3462,3468 ----
  						XLOG_CONTROL_FILE)));
  
  	errno = 0;
! 	if (write(fd, buffer, LOG_BLCKSZ) != LOG_BLCKSZ)
  	{
  		/* if write didn't set errno, assume problem is no disk space */
  		if (errno == 0)
***************
*** 3561,3572 ****
  				(errmsg("database files are incompatible with server"),
  				 errdetail("The database cluster appears to use a different floating-point number format than the server executable."),
  				 errhint("It looks like you need to initdb.")));
! 	if (ControlFile->blcksz != BLCKSZ)
  		ereport(FATAL,
  				(errmsg("database files are incompatible with server"),
! 			 errdetail("The database cluster was initialized with BLCKSZ %d,"
! 					   " but the server was compiled with BLCKSZ %d.",
! 					   ControlFile->blcksz, BLCKSZ),
  				 errhint("It looks like you need to recompile or initdb.")));
  	if (ControlFile->relseg_size != RELSEG_SIZE)
  		ereport(FATAL,
--- 3562,3580 ----
  				(errmsg("database files are incompatible with server"),
  				 errdetail("The database cluster appears to use a different floating-point number format than the server executable."),
  				 errhint("It looks like you need to initdb.")));
! 	if (ControlFile->dataBlcksz != DATA_BLCKSZ)
  		ereport(FATAL,
  				(errmsg("database files are incompatible with server"),
! 			 errdetail("The database cluster was initialized with DATA_BLCKSZ %d,"
! 					   " but the server was compiled with DATA_BLCKSZ %d.",
! 					   ControlFile->dataBlcksz, DATA_BLCKSZ),
! 				 errhint("It looks like you need to recompile or initdb.")));
! 	if (ControlFile->logBlcksz != LOG_BLCKSZ)
! 		ereport(FATAL,
! 				(errmsg("database files are incompatible with server"),
! 			 errdetail("The database cluster was initialized with LOG_BLCKSZ %d,"
! 					   " but the server was compiled with LOG_BLCKSZ %d.",
! 					   ControlFile->logBlcksz, LOG_BLCKSZ),
  				 errhint("It looks like you need to recompile or initdb.")));
  	if (ControlFile->relseg_size != RELSEG_SIZE)
  		ereport(FATAL,
***************
*** 3699,3705 ****
  	/* extra alignment padding for XLOG I/O buffers */
  	size = add_size(size, ALIGNOF_XLOG_BUFFER);
  	/* and the buffers themselves */
! 	size = add_size(size, mul_size(BLCKSZ, XLOGbuffers));
  
  	/*
  	 * Note: we don't count ControlFileData, it comes out of the "slop factor"
--- 3707,3713 ----
  	/* extra alignment padding for XLOG I/O buffers */
  	size = add_size(size, ALIGNOF_XLOG_BUFFER);
  	/* and the buffers themselves */
! 	size = add_size(size, mul_size(LOG_BLCKSZ, XLOGbuffers));
  
  	/*
  	 * Note: we don't count ControlFileData, it comes out of the "slop factor"
***************
*** 3746,3758 ****
  	 */
  	allocptr = (char *) TYPEALIGN(ALIGNOF_XLOG_BUFFER, allocptr);
  	XLogCtl->pages = allocptr;
! 	memset(XLogCtl->pages, 0, (Size) BLCKSZ * XLOGbuffers);
  
  	/*
  	 * Do basic initialization of XLogCtl shared data. (StartupXLOG will fill
  	 * in additional info.)
  	 */
! 	XLogCtl->XLogCacheByte = (Size) BLCKSZ *XLOGbuffers;
  
  	XLogCtl->XLogCacheBlck = XLOGbuffers - 1;
  	XLogCtl->Insert.currpage = (XLogPageHeader) (XLogCtl->pages);
--- 3754,3766 ----
  	 */
  	allocptr = (char *) TYPEALIGN(ALIGNOF_XLOG_BUFFER, allocptr);
  	XLogCtl->pages = allocptr;
! 	memset(XLogCtl->pages, 0, (Size) LOG_BLCKSZ * XLOGbuffers);
  
  	/*
  	 * Do basic initialization of XLogCtl shared data. (StartupXLOG will fill
  	 * in additional info.)
  	 */
! 	XLogCtl->XLogCacheByte = (Size) LOG_BLCKSZ *XLOGbuffers;
  
  	XLogCtl->XLogCacheBlck = XLOGbuffers - 1;
  	XLogCtl->Insert.currpage = (XLogPageHeader) (XLogCtl->pages);
***************
*** 3804,3812 ****
  	ThisTimeLineID = 1;
  
  	/* page buffer must be aligned suitably for O_DIRECT */
! 	buffer = (char *) palloc(BLCKSZ + ALIGNOF_XLOG_BUFFER);
  	page = (XLogPageHeader) TYPEALIGN(ALIGNOF_XLOG_BUFFER, buffer);
! 	memset(page, 0, BLCKSZ);
  
  	/* Set up information for the initial checkpoint record */
  	checkPoint.redo.xlogid = 0;
--- 3812,3820 ----
  	ThisTimeLineID = 1;
  
  	/* page buffer must be aligned suitably for O_DIRECT */
! 	buffer = (char *) palloc(LOG_BLCKSZ + ALIGNOF_XLOG_BUFFER);
  	page = (XLogPageHeader) TYPEALIGN(ALIGNOF_XLOG_BUFFER, buffer);
! 	memset(page, 0, LOG_BLCKSZ);
  
  	/* Set up information for the initial checkpoint record */
  	checkPoint.redo.xlogid = 0;
***************
*** 3858,3864 ****
  
  	/* Write the first page with the initial record */
  	errno = 0;
! 	if (write(openLogFile, page, BLCKSZ) != BLCKSZ)
  	{
  		/* if write didn't set errno, assume problem is no disk space */
  		if (errno == 0)
--- 3866,3872 ----
  
  	/* Write the first page with the initial record */
  	errno = 0;
! 	if (write(openLogFile, page, LOG_BLCKSZ) != LOG_BLCKSZ)
  	{
  		/* if write didn't set errno, assume problem is no disk space */
  		if (errno == 0)
***************
*** 4702,4718 ****
  	Insert->PrevRecord = LastRec;
  	XLogCtl->xlblocks[0].xlogid = openLogId;
  	XLogCtl->xlblocks[0].xrecoff =
! 		((EndOfLog.xrecoff - 1) / BLCKSZ + 1) * BLCKSZ;
  
  	/*
  	 * Tricky point here: readBuf contains the *last* block that the LastRec
  	 * record spans, not the one it starts in.	The last block is indeed the
  	 * one we want to use.
  	 */
! 	Assert(readOff == (XLogCtl->xlblocks[0].xrecoff - BLCKSZ) % XLogSegSize);
! 	memcpy((char *) Insert->currpage, readBuf, BLCKSZ);
  	Insert->currpos = (char *) Insert->currpage +
! 		(EndOfLog.xrecoff + BLCKSZ - XLogCtl->xlblocks[0].xrecoff);
  
  	LogwrtResult.Write = LogwrtResult.Flush = EndOfLog;
  
--- 4710,4726 ----
  	Insert->PrevRecord = LastRec;
  	XLogCtl->xlblocks[0].xlogid = openLogId;
  	XLogCtl->xlblocks[0].xrecoff =
! 		((EndOfLog.xrecoff - 1) / LOG_BLCKSZ + 1) * LOG_BLCKSZ;
  
  	/*
  	 * Tricky point here: readBuf contains the *last* block that the LastRec
  	 * record spans, not the one it starts in.	The last block is indeed the
  	 * one we want to use.
  	 */
! 	Assert(readOff == (XLogCtl->xlblocks[0].xrecoff - LOG_BLCKSZ) % XLogSegSize);
! 	memcpy((char *) Insert->currpage, readBuf, LOG_BLCKSZ);
  	Insert->currpos = (char *) Insert->currpage +
! 		(EndOfLog.xrecoff + LOG_BLCKSZ - XLogCtl->xlblocks[0].xrecoff);
  
  	LogwrtResult.Write = LogwrtResult.Flush = EndOfLog;
  
Index: src/backend/commands/tablecmds.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/commands/tablecmds.c,v
retrieving revision 1.181
diff -c -r1.181 tablecmds.c
*** src/backend/commands/tablecmds.c	14 Mar 2006 22:48:18 -0000	1.181
--- src/backend/commands/tablecmds.c	22 Mar 2006 18:35:32 -0000
***************
*** 5786,5792 ****
  	bool		use_wal;
  	BlockNumber nblocks;
  	BlockNumber blkno;
! 	char		buf[BLCKSZ];
  	Page		page = (Page) buf;
  
  	/*
--- 5786,5792 ----
  	bool		use_wal;
  	BlockNumber nblocks;
  	BlockNumber blkno;
! 	char		buf[DATA_BLCKSZ];
  	Page		page = (Page) buf;
  
  	/*
***************
*** 5830,5836 ****
  			rdata[0].next = &(rdata[1]);
  
  			rdata[1].data = (char *) page;
! 			rdata[1].len = BLCKSZ;
  			rdata[1].buffer = InvalidBuffer;
  			rdata[1].next = NULL;
  
--- 5830,5836 ----
  			rdata[0].next = &(rdata[1]);
  
  			rdata[1].data = (char *) page;
! 			rdata[1].len = DATA_BLCKSZ;
  			rdata[1].buffer = InvalidBuffer;
  			rdata[1].next = NULL;
  
Index: src/backend/commands/vacuum.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/commands/vacuum.c,v
retrieving revision 1.325
diff -c -r1.325 vacuum.c
*** src/backend/commands/vacuum.c	5 Mar 2006 15:58:25 -0000	1.325
--- src/backend/commands/vacuum.c	22 Mar 2006 18:35:32 -0000
***************
*** 1501,1509 ****
  		 * Add the page to fraged_pages if it has a useful amount of free
  		 * space.  "Useful" means enough for a minimal-sized tuple. But we
  		 * don't know that accurately near the start of the relation, so add
! 		 * pages unconditionally if they have >= BLCKSZ/10 free space.
  		 */
! 		do_frag = (vacpage->free >= min_tlen || vacpage->free >= BLCKSZ / 10);
  
  		if (do_reap || do_frag)
  		{
--- 1501,1509 ----
  		 * Add the page to fraged_pages if it has a useful amount of free
  		 * space.  "Useful" means enough for a minimal-sized tuple. But we
  		 * don't know that accurately near the start of the relation, so add
! 		 * pages unconditionally if they have >= DATA_BLCKSZ/10 free space.
  		 */
! 		do_frag = (vacpage->free >= min_tlen || vacpage->free >= DATA_BLCKSZ / 10);
  
  		if (do_reap || do_frag)
  		{
Index: src/backend/nodes/tidbitmap.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/nodes/tidbitmap.c,v
retrieving revision 1.9
diff -c -r1.9 tidbitmap.c
*** src/backend/nodes/tidbitmap.c	5 Mar 2006 15:58:28 -0000	1.9
--- src/backend/nodes/tidbitmap.c	22 Mar 2006 18:35:32 -0000
***************
*** 13,19 ****
   * fact that a particular page needs to be visited.
   *
   * The "lossy" storage uses one bit per disk page, so at the standard 8K
!  * BLCKSZ, we can represent all pages in 64Gb of disk space in about 1Mb
   * of memory.  People pushing around tables of that size should have a
   * couple of Mb to spare, so we don't worry about providing a second level
   * of lossiness.  In theory we could fall back to page ranges at some
--- 13,19 ----
   * fact that a particular page needs to be visited.
   *
   * The "lossy" storage uses one bit per disk page, so at the standard 8K
!  * DATA_BLCKSZ, we can represent all pages in 64Gb of disk space in about 1Mb
   * of memory.  People pushing around tables of that size should have a
   * couple of Mb to spare, so we don't worry about providing a second level
   * of lossiness.  In theory we could fall back to page ranges at some
***************
*** 59,65 ****
   * also want PAGES_PER_CHUNK to be a power of 2 to avoid expensive integer
   * remainder operations.  So, define it like this:
   */
! #define PAGES_PER_CHUNK  (BLCKSZ / 32)
  
  /* The bitmap unit size can be adjusted by changing these declarations: */
  #define BITS_PER_BITMAPWORD 32
--- 59,65 ----
   * also want PAGES_PER_CHUNK to be a power of 2 to avoid expensive integer
   * remainder operations.  So, define it like this:
   */
! #define PAGES_PER_CHUNK  (DATA_BLCKSZ / 32)
  
  /* The bitmap unit size can be adjusted by changing these declarations: */
  #define BITS_PER_BITMAPWORD 32
Index: src/backend/optimizer/path/costsize.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v
retrieving revision 1.155
diff -c -r1.155 costsize.c
*** src/backend/optimizer/path/costsize.c	5 Mar 2006 15:58:28 -0000	1.155
--- src/backend/optimizer/path/costsize.c	22 Mar 2006 18:35:33 -0000
***************
*** 821,827 ****
  	/* disk costs */
  	if (nbytes > work_mem_bytes)
  	{
! 		double		npages = ceil(nbytes / BLCKSZ);
  		double		nruns = (nbytes / work_mem_bytes) * 0.5;
  		double		mergeorder = tuplesort_merge_order(work_mem_bytes);
  		double		log_runs;
--- 821,827 ----
  	/* disk costs */
  	if (nbytes > work_mem_bytes)
  	{
! 		double		npages = ceil(nbytes / DATA_BLCKSZ);
  		double		nruns = (nbytes / work_mem_bytes) * 0.5;
  		double		mergeorder = tuplesort_merge_order(work_mem_bytes);
  		double		log_runs;
***************
*** 868,874 ****
  	/* disk costs */
  	if (nbytes > work_mem_bytes)
  	{
! 		double		npages = ceil(nbytes / BLCKSZ);
  
  		/* We'll write during startup and read during retrieval */
  		startup_cost += npages;
--- 868,874 ----
  	/* disk costs */
  	if (nbytes > work_mem_bytes)
  	{
! 		double		npages = ceil(nbytes / DATA_BLCKSZ);
  
  		/* We'll write during startup and read during retrieval */
  		startup_cost += npages;
***************
*** 2082,2086 ****
  static double
  page_size(double tuples, int width)
  {
! 	return ceil(relation_byte_size(tuples, width) / BLCKSZ);
  }
--- 2082,2086 ----
  static double
  page_size(double tuples, int width)
  {
! 	return ceil(relation_byte_size(tuples, width) / DATA_BLCKSZ);
  }
Index: src/backend/optimizer/util/plancat.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v
retrieving revision 1.119
diff -c -r1.119 plancat.c
*** src/backend/optimizer/util/plancat.c	5 Mar 2006 15:58:31 -0000	1.119
--- src/backend/optimizer/util/plancat.c	22 Mar 2006 18:35:33 -0000
***************
*** 334,340 ****
  				tuple_width += sizeof(HeapTupleHeaderData);
  				tuple_width += sizeof(ItemPointerData);
  				/* note: integer division is intentional here */
! 				density = (BLCKSZ - sizeof(PageHeaderData)) / tuple_width;
  			}
  			*tuples = rint(density * (double) curpages);
  			break;
--- 334,340 ----
  				tuple_width += sizeof(HeapTupleHeaderData);
  				tuple_width += sizeof(ItemPointerData);
  				/* note: integer division is intentional here */
! 				density = (DATA_BLCKSZ - sizeof(PageHeaderData)) / tuple_width;
  			}
  			*tuples = rint(density * (double) curpages);
  			break;
Index: src/backend/storage/buffer/buf_init.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v
retrieving revision 1.78
diff -c -r1.78 buf_init.c
*** src/backend/storage/buffer/buf_init.c	5 Mar 2006 15:58:36 -0000	1.78
--- src/backend/storage/buffer/buf_init.c	22 Mar 2006 18:35:33 -0000
***************
*** 89,95 ****
  
  	BufferBlocks = (char *)
  		ShmemInitStruct("Buffer Blocks",
! 						NBuffers * (Size) BLCKSZ, &foundBufs);
  
  	if (foundDescs || foundBufs)
  	{
--- 89,95 ----
  
  	BufferBlocks = (char *)
  		ShmemInitStruct("Buffer Blocks",
! 						NBuffers * (Size) DATA_BLCKSZ, &foundBufs);
  
  	if (foundDescs || foundBufs)
  	{
***************
*** 177,183 ****
  	size = add_size(size, mul_size(NBuffers, sizeof(BufferDesc)));
  
  	/* size of data pages */
! 	size = add_size(size, mul_size(NBuffers, BLCKSZ));
  
  	/* size of stuff controlled by freelist.c */
  	size = add_size(size, StrategyShmemSize());
--- 177,183 ----
  	size = add_size(size, mul_size(NBuffers, sizeof(BufferDesc)));
  
  	/* size of data pages */
! 	size = add_size(size, mul_size(NBuffers, DATA_BLCKSZ));
  
  	/* size of stuff controlled by freelist.c */
  	size = add_size(size, StrategyShmemSize());
Index: src/backend/storage/buffer/bufmgr.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v
retrieving revision 1.204
diff -c -r1.204 bufmgr.c
*** src/backend/storage/buffer/bufmgr.c	5 Mar 2006 15:58:36 -0000	1.204
--- src/backend/storage/buffer/bufmgr.c	22 Mar 2006 18:35:33 -0000
***************
*** 55,61 ****
  
  
  /* Note: these two macros only work on shared buffers, not local ones! */
! #define BufHdrGetBlock(bufHdr)	((Block) (BufferBlocks + ((Size) (bufHdr)->buf_id) * BLCKSZ))
  #define BufferGetLSN(bufHdr)	(*((XLogRecPtr*) BufHdrGetBlock(bufHdr)))
  
  /* Note: this macro only works on local buffers, not shared ones! */
--- 55,61 ----
  
  
  /* Note: these two macros only work on shared buffers, not local ones! */
! #define BufHdrGetBlock(bufHdr)	((Block) (BufferBlocks + ((Size) (bufHdr)->buf_id) * DATA_BLCKSZ))
  #define BufferGetLSN(bufHdr)	(*((XLogRecPtr*) BufHdrGetBlock(bufHdr)))
  
  /* Note: this macro only works on local buffers, not shared ones! */
***************
*** 230,236 ****
  	if (isExtend)
  	{
  		/* new buffers are zero-filled */
! 		MemSet((char *) bufBlock, 0, BLCKSZ);
  		smgrextend(reln->rd_smgr, blockNum, (char *) bufBlock,
  				   reln->rd_istemp);
  	}
--- 230,236 ----
  	if (isExtend)
  	{
  		/* new buffers are zero-filled */
! 		MemSet((char *) bufBlock, 0, DATA_BLCKSZ);
  		smgrextend(reln->rd_smgr, blockNum, (char *) bufBlock,
  				   reln->rd_istemp);
  	}
***************
*** 252,258 ****
  						(errcode(ERRCODE_DATA_CORRUPTED),
  						 errmsg("invalid page header in block %u of relation \"%s\"; zeroing out page",
  								blockNum, RelationGetRelationName(reln))));
! 				MemSet((char *) bufBlock, 0, BLCKSZ);
  			}
  			else
  				ereport(ERROR,
--- 252,258 ----
  						(errcode(ERRCODE_DATA_CORRUPTED),
  						 errmsg("invalid page header in block %u of relation \"%s\"; zeroing out page",
  								blockNum, RelationGetRelationName(reln))));
! 				MemSet((char *) bufBlock, 0, DATA_BLCKSZ);
  			}
  			else
  				ereport(ERROR,
Index: src/backend/storage/buffer/localbuf.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v
retrieving revision 1.73
diff -c -r1.73 localbuf.c
*** src/backend/storage/buffer/localbuf.c	5 Mar 2006 15:58:36 -0000	1.73
--- src/backend/storage/buffer/localbuf.c	22 Mar 2006 18:35:33 -0000
***************
*** 169,175 ****
  	{
  		char	   *data;
  
! 		data = (char *) MemoryContextAlloc(TopMemoryContext, BLCKSZ);
  
  		/* Set pointer for use by BufferGetBlock() macro */
  		LocalBufHdrGetBlock(bufHdr) = (Block) data;
--- 169,175 ----
  	{
  		char	   *data;
  
! 		data = (char *) MemoryContextAlloc(TopMemoryContext, DATA_BLCKSZ);
  
  		/* Set pointer for use by BufferGetBlock() macro */
  		LocalBufHdrGetBlock(bufHdr) = (Block) data;
Index: src/backend/storage/file/buffile.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/file/buffile.c,v
retrieving revision 1.23
diff -c -r1.23 buffile.c
*** src/backend/storage/file/buffile.c	5 Mar 2006 15:58:37 -0000	1.23
--- src/backend/storage/file/buffile.c	22 Mar 2006 18:35:33 -0000
***************
*** 40,50 ****
  #include "storage/buffile.h"
  
  /*
!  * The maximum safe file size is presumed to be RELSEG_SIZE * BLCKSZ.
   * Note we adhere to this limit whether or not LET_OS_MANAGE_FILESIZE
   * is defined, although md.c ignores it when that symbol is defined.
   */
! #define MAX_PHYSICAL_FILESIZE  (RELSEG_SIZE * BLCKSZ)
  
  /*
   * This data structure represents a buffered file that consists of one or
--- 40,50 ----
  #include "storage/buffile.h"
  
  /*
!  * The maximum safe file size is presumed to be RELSEG_SIZE * DATA_BLCKSZ.
   * Note we adhere to this limit whether or not LET_OS_MANAGE_FILESIZE
   * is defined, although md.c ignores it when that symbol is defined.
   */
! #define MAX_PHYSICAL_FILESIZE  (RELSEG_SIZE * DATA_BLCKSZ)
  
  /*
   * This data structure represents a buffered file that consists of one or
***************
*** 75,81 ****
  	int			curOffset;		/* offset part of current pos */
  	int			pos;			/* next read/write position in buffer */
  	int			nbytes;			/* total # of valid bytes in buffer */
! 	char		buffer[BLCKSZ];
  };
  
  static BufFile *makeBufFile(File firstfile);
--- 75,81 ----
  	int			curOffset;		/* offset part of current pos */
  	int			pos;			/* next read/write position in buffer */
  	int			nbytes;			/* total # of valid bytes in buffer */
! 	char		buffer[DATA_BLCKSZ];
  };
  
  static BufFile *makeBufFile(File firstfile);
***************
*** 381,387 ****
  
  	while (size > 0)
  	{
! 		if (file->pos >= BLCKSZ)
  		{
  			/* Buffer full, dump it out */
  			if (file->dirty)
--- 381,387 ----
  
  	while (size > 0)
  	{
! 		if (file->pos >= DATA_BLCKSZ)
  		{
  			/* Buffer full, dump it out */
  			if (file->dirty)
***************
*** 399,405 ****
  			}
  		}
  
! 		nthistime = BLCKSZ - file->pos;
  		if (nthistime > size)
  			nthistime = size;
  		Assert(nthistime > 0);
--- 399,405 ----
  			}
  		}
  
! 		nthistime = DATA_BLCKSZ - file->pos;
  		if (nthistime > size)
  			nthistime = size;
  		Assert(nthistime > 0);
***************
*** 542,550 ****
  /*
   * BufFileSeekBlock --- block-oriented seek
   *
!  * Performs absolute seek to the start of the n'th BLCKSZ-sized block of
   * the file.  Note that users of this interface will fail if their files
!  * exceed BLCKSZ * LONG_MAX bytes, but that is quite a lot; we don't work
   * with tables bigger than that, either...
   *
   * Result is 0 if OK, EOF if not.  Logical position is not moved if an
--- 542,550 ----
  /*
   * BufFileSeekBlock --- block-oriented seek
   *
!  * Performs absolute seek to the start of the n'th DATA_BLCKSZ-sized block of
   * the file.  Note that users of this interface will fail if their files
!  * exceed DATA_BLCKSZ * LONG_MAX bytes, but that is quite a lot; we don't work
   * with tables bigger than that, either...
   *
   * Result is 0 if OK, EOF if not.  Logical position is not moved if an
***************
*** 555,561 ****
  {
  	return BufFileSeek(file,
  					   (int) (blknum / RELSEG_SIZE),
! 					   (blknum % RELSEG_SIZE) * BLCKSZ,
  					   SEEK_SET);
  }
  
--- 555,561 ----
  {
  	return BufFileSeek(file,
  					   (int) (blknum / RELSEG_SIZE),
! 					   (blknum % RELSEG_SIZE) * DATA_BLCKSZ,
  					   SEEK_SET);
  }
  
***************
*** 570,576 ****
  {
  	long		blknum;
  
! 	blknum = (file->curOffset + file->pos) / BLCKSZ;
  	blknum += file->curFile * RELSEG_SIZE;
  	return blknum;
  }
--- 570,576 ----
  {
  	long		blknum;
  
! 	blknum = (file->curOffset + file->pos) / DATA_BLCKSZ;
  	blknum += file->curFile * RELSEG_SIZE;
  	return blknum;
  }
Index: src/backend/storage/freespace/freespace.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/freespace/freespace.c,v
retrieving revision 1.52
diff -c -r1.52 freespace.c
*** src/backend/storage/freespace/freespace.c	5 Mar 2006 15:58:37 -0000	1.52
--- src/backend/storage/freespace/freespace.c	22 Mar 2006 18:35:33 -0000
***************
*** 281,287 ****
  	 * requests.  Ignore silly requests, however, to ensure that the average
  	 * stays sane.
  	 */
! 	if (spaceNeeded > 0 && spaceNeeded < BLCKSZ)
  	{
  		int			cur_avg = (int) fsmrel->avgRequest;
  
--- 281,287 ----
  	 * requests.  Ignore silly requests, however, to ensure that the average
  	 * stays sane.
  	 */
! 	if (spaceNeeded > 0 && spaceNeeded < DATA_BLCKSZ)
  	{
  		int			cur_avg = (int) fsmrel->avgRequest;
  
***************
*** 309,315 ****
  	BlockNumber freepage;
  
  	/* Sanity check: ensure spaceAvail will fit into OffsetNumber */
! 	AssertArg(oldSpaceAvail < BLCKSZ);
  
  	LWLockAcquire(FreeSpaceLock, LW_EXCLUSIVE);
  
--- 309,315 ----
  	BlockNumber freepage;
  
  	/* Sanity check: ensure spaceAvail will fit into OffsetNumber */
! 	AssertArg(oldSpaceAvail < DATA_BLCKSZ);
  
  	LWLockAcquire(FreeSpaceLock, LW_EXCLUSIVE);
  
***************
*** 325,331 ****
  	 * Update the moving average of space requests, same as in
  	 * GetPageWithFreeSpace.
  	 */
! 	if (spaceNeeded > 0 && spaceNeeded < BLCKSZ)
  	{
  		int			cur_avg = (int) fsmrel->avgRequest;
  
--- 325,331 ----
  	 * Update the moving average of space requests, same as in
  	 * GetPageWithFreeSpace.
  	 */
! 	if (spaceNeeded > 0 && spaceNeeded < DATA_BLCKSZ)
  	{
  		int			cur_avg = (int) fsmrel->avgRequest;
  
***************
*** 794,800 ****
  		/* Read and verify relation header, as best we can */
  		if (fread(&relheader, 1, sizeof(relheader), fp) != sizeof(relheader) ||
  			(relheader.isIndex != false && relheader.isIndex != true) ||
! 			relheader.avgRequest >= BLCKSZ ||
  			relheader.lastPageCount < 0 ||
  			relheader.storedPages < 0)
  		{
--- 794,800 ----
  		/* Read and verify relation header, as best we can */
  		if (fread(&relheader, 1, sizeof(relheader), fp) != sizeof(relheader) ||
  			(relheader.isIndex != false && relheader.isIndex != true) ||
! 			relheader.avgRequest >= DATA_BLCKSZ ||
  			relheader.lastPageCount < 0 ||
  			relheader.storedPages < 0)
  		{
***************
*** 1542,1550 ****
  	{
  		Size		avail = pageSpaces[i].avail;
  
! 		if (avail >= BLCKSZ)
  			elog(ERROR, "bogus freespace amount");
! 		avail /= (BLCKSZ / HISTOGRAM_BINS);
  		histogram[avail]++;
  	}
  	/* Find the breakpoint bin */
--- 1542,1550 ----
  	{
  		Size		avail = pageSpaces[i].avail;
  
! 		if (avail >= DATA_BLCKSZ)
  			elog(ERROR, "bogus freespace amount");
! 		avail /= (DATA_BLCKSZ / HISTOGRAM_BINS);
  		histogram[avail]++;
  	}
  	/* Find the breakpoint bin */
***************
*** 1558,1565 ****
  		above = sum;
  	}
  	Assert(i >= 0);
! 	thresholdL = i * BLCKSZ / HISTOGRAM_BINS;	/* low bound of bp bin */
! 	thresholdU = (i + 1) * BLCKSZ / HISTOGRAM_BINS;		/* hi bound */
  	binct = newPages - above;	/* number to take from bp bin */
  	/* And copy the appropriate data */
  	for (i = 0; i < nPages; i++)
--- 1558,1565 ----
  		above = sum;
  	}
  	Assert(i >= 0);
! 	thresholdL = i * DATA_BLCKSZ / HISTOGRAM_BINS;	/* low bound of bp bin */
! 	thresholdU = (i + 1) * DATA_BLCKSZ / HISTOGRAM_BINS;		/* hi bound */
  	binct = newPages - above;	/* number to take from bp bin */
  	/* And copy the appropriate data */
  	for (i = 0; i < nPages; i++)
***************
*** 1613,1621 ****
  		Size		avail = FSMPageGetSpace(oldLocation + i);
  
  		/* Shouldn't happen, but test to protect against stack clobber */
! 		if (avail >= BLCKSZ)
  			elog(ERROR, "bogus freespace amount");
! 		avail /= (BLCKSZ / HISTOGRAM_BINS);
  		histogram[avail]++;
  	}
  	/* Find the breakpoint bin */
--- 1613,1621 ----
  		Size		avail = FSMPageGetSpace(oldLocation + i);
  
  		/* Shouldn't happen, but test to protect against stack clobber */
! 		if (avail >= DATA_BLCKSZ)
  			elog(ERROR, "bogus freespace amount");
! 		avail /= (DATA_BLCKSZ / HISTOGRAM_BINS);
  		histogram[avail]++;
  	}
  	/* Find the breakpoint bin */
***************
*** 1629,1636 ****
  		above = sum;
  	}
  	Assert(i >= 0);
! 	thresholdL = i * BLCKSZ / HISTOGRAM_BINS;	/* low bound of bp bin */
! 	thresholdU = (i + 1) * BLCKSZ / HISTOGRAM_BINS;		/* hi bound */
  	binct = newPages - above;	/* number to take from bp bin */
  	/* And copy the appropriate data */
  	for (i = 0; i < oldPages; i++)
--- 1629,1636 ----
  		above = sum;
  	}
  	Assert(i >= 0);
! 	thresholdL = i * DATA_BLCKSZ / HISTOGRAM_BINS;	/* low bound of bp bin */
! 	thresholdU = (i + 1) * DATA_BLCKSZ / HISTOGRAM_BINS;		/* hi bound */
  	binct = newPages - above;	/* number to take from bp bin */
  	/* And copy the appropriate data */
  	for (i = 0; i < oldPages; i++)
Index: src/backend/storage/ipc/shmem.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v
retrieving revision 1.91
diff -c -r1.91 shmem.c
*** src/backend/storage/ipc/shmem.c	5 Mar 2006 15:58:37 -0000	1.91
--- src/backend/storage/ipc/shmem.c	22 Mar 2006 18:35:33 -0000
***************
*** 169,175 ****
  	newStart = shmemseghdr->freeoffset;
  
  	/* extra alignment for large requests, since they are probably buffers */
! 	if (size >= BLCKSZ)
  		newStart = BUFFERALIGN(newStart);
  
  	newFree = newStart + size;
--- 169,175 ----
  	newStart = shmemseghdr->freeoffset;
  
  	/* extra alignment for large requests, since they are probably buffers */
! 	if (size >= DATA_BLCKSZ)
  		newStart = BUFFERALIGN(newStart);
  
  	newFree = newStart + size;
Index: src/backend/storage/page/bufpage.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/page/bufpage.c,v
retrieving revision 1.69
diff -c -r1.69 bufpage.c
*** src/backend/storage/page/bufpage.c	5 Mar 2006 15:58:39 -0000	1.69
--- src/backend/storage/page/bufpage.c	22 Mar 2006 18:35:33 -0000
***************
*** 33,39 ****
  
  	specialSize = MAXALIGN(specialSize);
  
! 	Assert(pageSize == BLCKSZ);
  	Assert(pageSize > specialSize + SizeOfPageHeaderData);
  
  	/* Make sure all fields of page are zero, as well as unused space */
--- 33,39 ----
  
  	specialSize = MAXALIGN(specialSize);
  
! 	Assert(pageSize == DATA_BLCKSZ);
  	Assert(pageSize > specialSize + SizeOfPageHeaderData);
  
  	/* Make sure all fields of page are zero, as well as unused space */
***************
*** 71,88 ****
  	int			i;
  
  	/* Check normal case */
! 	if (PageGetPageSize(page) == BLCKSZ &&
  		PageGetPageLayoutVersion(page) == PG_PAGE_LAYOUT_VERSION &&
  		page->pd_lower >= SizeOfPageHeaderData &&
  		page->pd_lower <= page->pd_upper &&
  		page->pd_upper <= page->pd_special &&
! 		page->pd_special <= BLCKSZ &&
  		page->pd_special == MAXALIGN(page->pd_special))
  		return true;
  
  	/* Check all-zeroes case */
  	pagebytes = (char *) page;
! 	for (i = 0; i < BLCKSZ; i++)
  	{
  		if (pagebytes[i] != 0)
  			return false;
--- 71,88 ----
  	int			i;
  
  	/* Check normal case */
! 	if (PageGetPageSize(page) == DATA_BLCKSZ &&
  		PageGetPageLayoutVersion(page) == PG_PAGE_LAYOUT_VERSION &&
  		page->pd_lower >= SizeOfPageHeaderData &&
  		page->pd_lower <= page->pd_upper &&
  		page->pd_upper <= page->pd_special &&
! 		page->pd_special <= DATA_BLCKSZ &&
  		page->pd_special == MAXALIGN(page->pd_special))
  		return true;
  
  	/* Check all-zeroes case */
  	pagebytes = (char *) page;
! 	for (i = 0; i < DATA_BLCKSZ; i++)
  	{
  		if (pagebytes[i] != 0)
  			return false;
***************
*** 129,135 ****
  	if (phdr->pd_lower < SizeOfPageHeaderData ||
  		phdr->pd_lower > phdr->pd_upper ||
  		phdr->pd_upper > phdr->pd_special ||
! 		phdr->pd_special > BLCKSZ)
  		ereport(PANIC,
  				(errcode(ERRCODE_DATA_CORRUPTED),
  				 errmsg("corrupted page pointers: lower = %u, upper = %u, special = %u",
--- 129,135 ----
  	if (phdr->pd_lower < SizeOfPageHeaderData ||
  		phdr->pd_lower > phdr->pd_upper ||
  		phdr->pd_upper > phdr->pd_special ||
! 		phdr->pd_special > DATA_BLCKSZ)
  		ereport(PANIC,
  				(errcode(ERRCODE_DATA_CORRUPTED),
  				 errmsg("corrupted page pointers: lower = %u, upper = %u, special = %u",
***************
*** 326,332 ****
  	if (pd_lower < SizeOfPageHeaderData ||
  		pd_lower > pd_upper ||
  		pd_upper > pd_special ||
! 		pd_special > BLCKSZ ||
  		pd_special != MAXALIGN(pd_special))
  		ereport(ERROR,
  				(errcode(ERRCODE_DATA_CORRUPTED),
--- 326,332 ----
  	if (pd_lower < SizeOfPageHeaderData ||
  		pd_lower > pd_upper ||
  		pd_upper > pd_special ||
! 		pd_special > DATA_BLCKSZ ||
  		pd_special != MAXALIGN(pd_special))
  		ereport(ERROR,
  				(errcode(ERRCODE_DATA_CORRUPTED),
***************
*** 465,471 ****
  	if (phdr->pd_lower < SizeOfPageHeaderData ||
  		phdr->pd_lower > phdr->pd_upper ||
  		phdr->pd_upper > phdr->pd_special ||
! 		phdr->pd_special > BLCKSZ)
  		ereport(ERROR,
  				(errcode(ERRCODE_DATA_CORRUPTED),
  				 errmsg("corrupted page pointers: lower = %u, upper = %u, special = %u",
--- 465,471 ----
  	if (phdr->pd_lower < SizeOfPageHeaderData ||
  		phdr->pd_lower > phdr->pd_upper ||
  		phdr->pd_upper > phdr->pd_special ||
! 		phdr->pd_special > DATA_BLCKSZ)
  		ereport(ERROR,
  				(errcode(ERRCODE_DATA_CORRUPTED),
  				 errmsg("corrupted page pointers: lower = %u, upper = %u, special = %u",
***************
*** 592,598 ****
  	if (pd_lower < SizeOfPageHeaderData ||
  		pd_lower > pd_upper ||
  		pd_upper > pd_special ||
! 		pd_special > BLCKSZ ||
  		pd_special != MAXALIGN(pd_special))
  		ereport(ERROR,
  				(errcode(ERRCODE_DATA_CORRUPTED),
--- 592,598 ----
  	if (pd_lower < SizeOfPageHeaderData ||
  		pd_lower > pd_upper ||
  		pd_upper > pd_special ||
! 		pd_special > DATA_BLCKSZ ||
  		pd_special != MAXALIGN(pd_special))
  		ereport(ERROR,
  				(errcode(ERRCODE_DATA_CORRUPTED),
Index: src/backend/storage/smgr/md.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/smgr/md.c,v
retrieving revision 1.120
diff -c -r1.120 md.c
*** src/backend/storage/smgr/md.c	5 Mar 2006 15:58:39 -0000	1.120
--- src/backend/storage/smgr/md.c	22 Mar 2006 18:35:33 -0000
***************
*** 38,44 ****
   *	system's file size limit (often 2GBytes).  In order to do that,
   *	we break relations up into chunks of < 2GBytes and store one chunk
   *	in each of several files that represent the relation.  See the
!  *	BLCKSZ and RELSEG_SIZE configuration constants in pg_config_manual.h.
   *	All chunks except the last MUST have size exactly equal to RELSEG_SIZE
   *	blocks --- see mdnblocks() and mdtruncate().
   *
--- 38,44 ----
   *	system's file size limit (often 2GBytes).  In order to do that,
   *	we break relations up into chunks of < 2GBytes and store one chunk
   *	in each of several files that represent the relation.  See the
!  *	DATA_BLCKSZ and RELSEG_SIZE configuration constants in pg_config_manual.h.
   *	All chunks except the last MUST have size exactly equal to RELSEG_SIZE
   *	blocks --- see mdnblocks() and mdtruncate().
   *
***************
*** 278,287 ****
  	v = _mdfd_getseg(reln, blocknum, false);
  
  #ifndef LET_OS_MANAGE_FILESIZE
! 	seekpos = (long) (BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)));
! 	Assert(seekpos < BLCKSZ * RELSEG_SIZE);
  #else
! 	seekpos = (long) (BLCKSZ * (blocknum));
  #endif
  
  	/*
--- 278,287 ----
  	v = _mdfd_getseg(reln, blocknum, false);
  
  #ifndef LET_OS_MANAGE_FILESIZE
! 	seekpos = (long) (DATA_BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)));
! 	Assert(seekpos < DATA_BLCKSZ * RELSEG_SIZE);
  #else
! 	seekpos = (long) (DATA_BLCKSZ * (blocknum));
  #endif
  
  	/*
***************
*** 296,302 ****
  	if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
  		return false;
  
! 	if ((nbytes = FileWrite(v->mdfd_vfd, buffer, BLCKSZ)) != BLCKSZ)
  	{
  		if (nbytes > 0)
  		{
--- 296,302 ----
  	if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
  		return false;
  
! 	if ((nbytes = FileWrite(v->mdfd_vfd, buffer, DATA_BLCKSZ)) != DATA_BLCKSZ)
  	{
  		if (nbytes > 0)
  		{
***************
*** 317,323 ****
  	}
  
  #ifndef LET_OS_MANAGE_FILESIZE
! 	Assert(_mdnblocks(v->mdfd_vfd, BLCKSZ) <= ((BlockNumber) RELSEG_SIZE));
  #endif
  
  	return true;
--- 317,323 ----
  	}
  
  #ifndef LET_OS_MANAGE_FILESIZE
! 	Assert(_mdnblocks(v->mdfd_vfd, DATA_BLCKSZ) <= ((BlockNumber) RELSEG_SIZE));
  #endif
  
  	return true;
***************
*** 376,382 ****
  	mdfd->mdfd_segno = 0;
  #ifndef LET_OS_MANAGE_FILESIZE
  	mdfd->mdfd_chain = NULL;
! 	Assert(_mdnblocks(fd, BLCKSZ) <= ((BlockNumber) RELSEG_SIZE));
  #endif
  
  	return mdfd;
--- 376,382 ----
  	mdfd->mdfd_segno = 0;
  #ifndef LET_OS_MANAGE_FILESIZE
  	mdfd->mdfd_chain = NULL;
! 	Assert(_mdnblocks(fd, DATA_BLCKSZ) <= ((BlockNumber) RELSEG_SIZE));
  #endif
  
  	return mdfd;
***************
*** 433,449 ****
  	v = _mdfd_getseg(reln, blocknum, false);
  
  #ifndef LET_OS_MANAGE_FILESIZE
! 	seekpos = (long) (BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)));
! 	Assert(seekpos < BLCKSZ * RELSEG_SIZE);
  #else
! 	seekpos = (long) (BLCKSZ * (blocknum));
  #endif
  
  	if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
  		return false;
  
  	status = true;
! 	if ((nbytes = FileRead(v->mdfd_vfd, buffer, BLCKSZ)) != BLCKSZ)
  	{
  		/*
  		 * If we are at or past EOF, return zeroes without complaining. Also
--- 433,449 ----
  	v = _mdfd_getseg(reln, blocknum, false);
  
  #ifndef LET_OS_MANAGE_FILESIZE
! 	seekpos = (long) (DATA_BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)));
! 	Assert(seekpos < DATA_BLCKSZ * RELSEG_SIZE);
  #else
! 	seekpos = (long) (DATA_BLCKSZ * (blocknum));
  #endif
  
  	if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
  		return false;
  
  	status = true;
! 	if ((nbytes = FileRead(v->mdfd_vfd, buffer, DATA_BLCKSZ)) != DATA_BLCKSZ)
  	{
  		/*
  		 * If we are at or past EOF, return zeroes without complaining. Also
***************
*** 455,461 ****
  		 */
  		if (nbytes == 0 ||
  			(nbytes > 0 && mdnblocks(reln) == blocknum))
! 			MemSet(buffer, 0, BLCKSZ);
  		else
  			status = false;
  	}
--- 455,461 ----
  		 */
  		if (nbytes == 0 ||
  			(nbytes > 0 && mdnblocks(reln) == blocknum))
! 			MemSet(buffer, 0, DATA_BLCKSZ);
  		else
  			status = false;
  	}
***************
*** 475,490 ****
  	v = _mdfd_getseg(reln, blocknum, false);
  
  #ifndef LET_OS_MANAGE_FILESIZE
! 	seekpos = (long) (BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)));
! 	Assert(seekpos < BLCKSZ * RELSEG_SIZE);
  #else
! 	seekpos = (long) (BLCKSZ * (blocknum));
  #endif
  
  	if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
  		return false;
  
! 	if (FileWrite(v->mdfd_vfd, buffer, BLCKSZ) != BLCKSZ)
  		return false;
  
  	if (!isTemp)
--- 475,490 ----
  	v = _mdfd_getseg(reln, blocknum, false);
  
  #ifndef LET_OS_MANAGE_FILESIZE
! 	seekpos = (long) (DATA_BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)));
! 	Assert(seekpos < DATA_BLCKSZ * RELSEG_SIZE);
  #else
! 	seekpos = (long) (DATA_BLCKSZ * (blocknum));
  #endif
  
  	if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
  		return false;
  
! 	if (FileWrite(v->mdfd_vfd, buffer, DATA_BLCKSZ) != DATA_BLCKSZ)
  		return false;
  
  	if (!isTemp)
***************
*** 531,537 ****
  
  	for (;;)
  	{
! 		nblocks = _mdnblocks(v->mdfd_vfd, BLCKSZ);
  		if (nblocks > ((BlockNumber) RELSEG_SIZE))
  			elog(FATAL, "segment too big");
  		if (nblocks < ((BlockNumber) RELSEG_SIZE))
--- 531,537 ----
  
  	for (;;)
  	{
! 		nblocks = _mdnblocks(v->mdfd_vfd, DATA_BLCKSZ);
  		if (nblocks > ((BlockNumber) RELSEG_SIZE))
  			elog(FATAL, "segment too big");
  		if (nblocks < ((BlockNumber) RELSEG_SIZE))
***************
*** 558,564 ****
  		v = v->mdfd_chain;
  	}
  #else
! 	return _mdnblocks(v->mdfd_vfd, BLCKSZ);
  #endif
  }
  
--- 558,564 ----
  		v = v->mdfd_chain;
  	}
  #else
! 	return _mdnblocks(v->mdfd_vfd, DATA_BLCKSZ);
  #endif
  }
  
***************
*** 624,630 ****
  			 */
  			BlockNumber lastsegblocks = nblocks - priorblocks;
  
! 			if (FileTruncate(v->mdfd_vfd, lastsegblocks * BLCKSZ) < 0)
  				return InvalidBlockNumber;
  			if (!isTemp)
  			{
--- 624,630 ----
  			 */
  			BlockNumber lastsegblocks = nblocks - priorblocks;
  
! 			if (FileTruncate(v->mdfd_vfd, lastsegblocks * DATA_BLCKSZ) < 0)
  				return InvalidBlockNumber;
  			if (!isTemp)
  			{
***************
*** 645,651 ****
  		priorblocks += RELSEG_SIZE;
  	}
  #else
! 	if (FileTruncate(v->mdfd_vfd, nblocks * BLCKSZ) < 0)
  		return InvalidBlockNumber;
  	if (!isTemp)
  	{
--- 645,651 ----
  		priorblocks += RELSEG_SIZE;
  	}
  #else
! 	if (FileTruncate(v->mdfd_vfd, nblocks * DATA_BLCKSZ) < 0)
  		return InvalidBlockNumber;
  	if (!isTemp)
  	{
***************
*** 907,913 ****
  	v->mdfd_vfd = fd;
  	v->mdfd_segno = segno;
  	v->mdfd_chain = NULL;
! 	Assert(_mdnblocks(fd, BLCKSZ) <= ((BlockNumber) RELSEG_SIZE));
  
  	/* all done */
  	return v;
--- 907,913 ----
  	v->mdfd_vfd = fd;
  	v->mdfd_segno = segno;
  	v->mdfd_chain = NULL;
! 	Assert(_mdnblocks(fd, DATA_BLCKSZ) <= ((BlockNumber) RELSEG_SIZE));
  
  	/* all done */
  	return v;
Index: src/backend/utils/init/flatfiles.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/init/flatfiles.c,v
retrieving revision 1.17
diff -c -r1.17 flatfiles.c
*** src/backend/utils/init/flatfiles.c	5 Mar 2006 15:58:46 -0000	1.17
--- src/backend/utils/init/flatfiles.c	22 Mar 2006 18:35:33 -0000
***************
*** 398,404 ****
  	 */
  	totalblocks = RelationGetNumberOfBlocks(rel_authid);
  	totalblocks = totalblocks ? totalblocks : 1;
! 	est_rows = totalblocks * (BLCKSZ / (sizeof(HeapTupleHeaderData) + sizeof(FormData_pg_authid)));
  	auth_info = (auth_entry *) palloc(est_rows * sizeof(auth_entry));
  
  	scan = heap_beginscan(rel_authid, SnapshotNow, 0, NULL);
--- 398,404 ----
  	 */
  	totalblocks = RelationGetNumberOfBlocks(rel_authid);
  	totalblocks = totalblocks ? totalblocks : 1;
! 	est_rows = totalblocks * (DATA_BLCKSZ / (sizeof(HeapTupleHeaderData) + sizeof(FormData_pg_authid)));
  	auth_info = (auth_entry *) palloc(est_rows * sizeof(auth_entry));
  
  	scan = heap_beginscan(rel_authid, SnapshotNow, 0, NULL);
***************
*** 501,507 ****
  	 */
  	totalblocks = RelationGetNumberOfBlocks(rel_authmem);
  	totalblocks = totalblocks ? totalblocks : 1;
! 	est_rows = totalblocks * (BLCKSZ / (sizeof(HeapTupleHeaderData) + sizeof(FormData_pg_auth_members)));
  	authmem_info = (authmem_entry *) palloc(est_rows * sizeof(authmem_entry));
  
  	scan = heap_beginscan(rel_authmem, SnapshotNow, 0, NULL);
--- 501,507 ----
  	 */
  	totalblocks = RelationGetNumberOfBlocks(rel_authmem);
  	totalblocks = totalblocks ? totalblocks : 1;
! 	est_rows = totalblocks * (DATA_BLCKSZ / (sizeof(HeapTupleHeaderData) + sizeof(FormData_pg_auth_members)));
  	authmem_info = (authmem_entry *) palloc(est_rows * sizeof(authmem_entry));
  
  	scan = heap_beginscan(rel_authmem, SnapshotNow, 0, NULL);
Index: src/backend/utils/init/miscinit.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/init/miscinit.c,v
retrieving revision 1.154
diff -c -r1.154 miscinit.c
*** src/backend/utils/init/miscinit.c	5 Mar 2006 15:58:46 -0000	1.154
--- src/backend/utils/init/miscinit.c	22 Mar 2006 18:35:33 -0000
***************
*** 957,963 ****
  	int			fd;
  	int			len;
  	char	   *ptr;
! 	char		buffer[BLCKSZ];
  
  	fd = open(DIRECTORY_LOCK_FILE, O_RDWR | PG_BINARY, 0);
  	if (fd < 0)
--- 957,963 ----
  	int			fd;
  	int			len;
  	char	   *ptr;
! 	char		buffer[DATA_BLCKSZ];
  
  	fd = open(DIRECTORY_LOCK_FILE, O_RDWR | PG_BINARY, 0);
  	if (fd < 0)
Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.314
diff -c -r1.314 guc.c
*** src/backend/utils/misc/guc.c	7 Mar 2006 02:54:23 -0000	1.314
--- src/backend/utils/misc/guc.c	22 Mar 2006 18:35:33 -0000
***************
*** 1171,1177 ****
  						 "temporary disk files.")
  		},
  		&work_mem,
! 		1024, 8 * BLCKSZ / 1024, MAX_KILOBYTES, NULL, NULL
  	},
  
  	{
--- 1171,1177 ----
  						 "temporary disk files.")
  		},
  		&work_mem,
! 		1024, 8 * DATA_BLCKSZ / 1024, MAX_KILOBYTES, NULL, NULL
  	},
  
  	{
***************
*** 1507,1519 ****
  	},
  
  	{
! 		{"block_size", PGC_INTERNAL, PRESET_OPTIONS,
! 			gettext_noop("Shows size of a disk block"),
  			NULL,
  			GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
  		},
  		&block_size,
! 		BLCKSZ, BLCKSZ, BLCKSZ, NULL, NULL
  	},
  
  	{
--- 1507,1529 ----
  	},
  
  	{
! 		{"data_block_size", PGC_INTERNAL, PRESET_OPTIONS,
! 			gettext_noop("Shows size of a disk data block"),
  			NULL,
  			GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
  		},
  		&block_size,
! 		DATA_BLCKSZ, DATA_BLCKSZ, DATA_BLCKSZ, NULL, NULL
! 	},
! 
! 	{
! 		{"log_block_size", PGC_INTERNAL, PRESET_OPTIONS,
! 			gettext_noop("Shows size of a disk log block"),
! 			NULL,
! 			GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
! 		},
! 		&block_size,
! 		LOG_BLCKSZ, LOG_BLCKSZ, LOG_BLCKSZ, NULL, NULL
  	},
  
  	{
Index: src/backend/utils/sort/logtape.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/sort/logtape.c,v
retrieving revision 1.21
diff -c -r1.21 logtape.c
*** src/backend/utils/sort/logtape.c	7 Mar 2006 23:46:24 -0000	1.21
--- src/backend/utils/sort/logtape.c	22 Mar 2006 18:35:33 -0000
***************
*** 28,34 ****
   * larger size than the underlying OS may support.
   *
   * For simplicity, we allocate and release space in the underlying file
!  * in BLCKSZ-size blocks.  Space allocation boils down to keeping track
   * of which blocks in the underlying file belong to which logical tape,
   * plus any blocks that are free (recycled and not yet reused).
   * The blocks in each logical tape are remembered using a method borrowed
--- 28,34 ----
   * larger size than the underlying OS may support.
   *
   * For simplicity, we allocate and release space in the underlying file
!  * in DATA_BLCKSZ-size blocks.  Space allocation boils down to keeping track
   * of which blocks in the underlying file belong to which logical tape,
   * plus any blocks that are free (recycled and not yet reused).
   * The blocks in each logical tape are remembered using a method borrowed
***************
*** 84,90 ****
   * Block indexes are "long"s, so we can fit this many per indirect block.
   * NB: we assume this is an exact fit!
   */
! #define BLOCKS_PER_INDIR_BLOCK	((int) (BLCKSZ / sizeof(long)))
  
  /*
   * We use a struct like this for each active indirection level of each
--- 84,90 ----
   * Block indexes are "long"s, so we can fit this many per indirect block.
   * NB: we assume this is an exact fit!
   */
! #define BLOCKS_PER_INDIR_BLOCK	((int) (DATA_BLCKSZ / sizeof(long)))
  
  /*
   * We use a struct like this for each active indirection level of each
***************
*** 116,124 ****
  	bool		dirty;			/* does buffer need to be written? */
  
  	/*
! 	 * The total data volume in the logical tape is numFullBlocks * BLCKSZ +
! 	 * lastBlockBytes.	BUT: we do not update lastBlockBytes during writing,
! 	 * only at completion of a write phase.
  	 */
  	long		numFullBlocks;	/* number of complete blocks in log tape */
  	int			lastBlockBytes; /* valid bytes in last (incomplete) block */
--- 116,124 ----
  	bool		dirty;			/* does buffer need to be written? */
  
  	/*
! 	 * The total data volume in the logical tape is numFullBlocks *
! 	 * DATA_BLCKSZ + lastBlockBytes.  BUT: we do not update lastBlockBytes
! 	 * during writing, only at completion of a write phase.
  	 */
  	long		numFullBlocks;	/* number of complete blocks in log tape */
  	int			lastBlockBytes; /* valid bytes in last (incomplete) block */
***************
*** 206,212 ****
  ltsWriteBlock(LogicalTapeSet *lts, long blocknum, void *buffer)
  {
  	if (BufFileSeekBlock(lts->pfile, blocknum) != 0 ||
! 		BufFileWrite(lts->pfile, buffer, BLCKSZ) != BLCKSZ)
  		ereport(ERROR,
  		/* XXX is it okay to assume errno is correct? */
  				(errcode_for_file_access(),
--- 206,212 ----
  ltsWriteBlock(LogicalTapeSet *lts, long blocknum, void *buffer)
  {
  	if (BufFileSeekBlock(lts->pfile, blocknum) != 0 ||
! 		BufFileWrite(lts->pfile, buffer, DATA_BLCKSZ) != DATA_BLCKSZ)
  		ereport(ERROR,
  		/* XXX is it okay to assume errno is correct? */
  				(errcode_for_file_access(),
***************
*** 225,231 ****
  ltsReadBlock(LogicalTapeSet *lts, long blocknum, void *buffer)
  {
  	if (BufFileSeekBlock(lts->pfile, blocknum) != 0 ||
! 		BufFileRead(lts->pfile, buffer, BLCKSZ) != BLCKSZ)
  		ereport(ERROR,
  		/* XXX is it okay to assume errno is correct? */
  				(errcode_for_file_access(),
--- 225,231 ----
  ltsReadBlock(LogicalTapeSet *lts, long blocknum, void *buffer)
  {
  	if (BufFileSeekBlock(lts->pfile, blocknum) != 0 ||
! 		BufFileRead(lts->pfile, buffer, DATA_BLCKSZ) != DATA_BLCKSZ)
  		ereport(ERROR,
  		/* XXX is it okay to assume errno is correct? */
  				(errcode_for_file_access(),
***************
*** 635,641 ****
  
  	/* Allocate data buffer and first indirect block on first write */
  	if (lt->buffer == NULL)
! 		lt->buffer = (char *) palloc(BLCKSZ);
  	if (lt->indirect == NULL)
  	{
  		lt->indirect = (IndirectBlock *) palloc(sizeof(IndirectBlock));
--- 635,641 ----
  
  	/* Allocate data buffer and first indirect block on first write */
  	if (lt->buffer == NULL)
! 		lt->buffer = (char *) palloc(DATA_BLCKSZ);
  	if (lt->indirect == NULL)
  	{
  		lt->indirect = (IndirectBlock *) palloc(sizeof(IndirectBlock));
***************
*** 645,651 ****
  
  	while (size > 0)
  	{
! 		if (lt->pos >= BLCKSZ)
  		{
  			/* Buffer full, dump it out */
  			if (lt->dirty)
--- 645,651 ----
  
  	while (size > 0)
  	{
! 		if (lt->pos >= DATA_BLCKSZ)
  		{
  			/* Buffer full, dump it out */
  			if (lt->dirty)
***************
*** 661,667 ****
  			lt->nbytes = 0;
  		}
  
! 		nthistime = BLCKSZ - lt->pos;
  		if (nthistime > size)
  			nthistime = size;
  		Assert(nthistime > 0);
--- 661,667 ----
  			lt->nbytes = 0;
  		}
  
! 		nthistime = DATA_BLCKSZ - lt->pos;
  		if (nthistime > size)
  			nthistime = size;
  		Assert(nthistime > 0);
***************
*** 726,732 ****
  			if (!lt->frozen)
  				ltsReleaseBlock(lts, datablocknum);
  			lt->nbytes = (lt->curBlockNumber < lt->numFullBlocks) ?
! 				BLCKSZ : lt->lastBlockBytes;
  		}
  	}
  	else
--- 726,732 ----
  			if (!lt->frozen)
  				ltsReleaseBlock(lts, datablocknum);
  			lt->nbytes = (lt->curBlockNumber < lt->numFullBlocks) ?
! 				DATA_BLCKSZ : lt->lastBlockBytes;
  		}
  	}
  	else
***************
*** 797,803 ****
  			if (!lt->frozen)
  				ltsReleaseBlock(lts, datablocknum);
  			lt->nbytes = (lt->curBlockNumber < lt->numFullBlocks) ?
! 				BLCKSZ : lt->lastBlockBytes;
  			if (lt->nbytes <= 0)
  				break;			/* EOF (possible here?) */
  		}
--- 797,803 ----
  			if (!lt->frozen)
  				ltsReleaseBlock(lts, datablocknum);
  			lt->nbytes = (lt->curBlockNumber < lt->numFullBlocks) ?
! 				DATA_BLCKSZ : lt->lastBlockBytes;
  			if (lt->nbytes <= 0)
  				break;			/* EOF (possible here?) */
  		}
***************
*** 857,863 ****
  	{
  		ltsReadBlock(lts, datablocknum, (void *) lt->buffer);
  		lt->nbytes = (lt->curBlockNumber < lt->numFullBlocks) ?
! 			BLCKSZ : lt->lastBlockBytes;
  	}
  }
  
--- 857,863 ----
  	{
  		ltsReadBlock(lts, datablocknum, (void *) lt->buffer);
  		lt->nbytes = (lt->curBlockNumber < lt->numFullBlocks) ?
! 			DATA_BLCKSZ : lt->lastBlockBytes;
  	}
  }
  
***************
*** 896,907 ****
  	 * Not-so-easy case.  Figure out whether it's possible at all.
  	 */
  	size -= (size_t) lt->pos;	/* part within this block */
! 	nblocks = size / BLCKSZ;
! 	size = size % BLCKSZ;
  	if (size)
  	{
  		nblocks++;
! 		newpos = (int) (BLCKSZ - size);
  	}
  	else
  		newpos = 0;
--- 896,907 ----
  	 * Not-so-easy case.  Figure out whether it's possible at all.
  	 */
  	size -= (size_t) lt->pos;	/* part within this block */
! 	nblocks = size / DATA_BLCKSZ;
! 	size = size % DATA_BLCKSZ;
  	if (size)
  	{
  		nblocks++;
! 		newpos = (int) (DATA_BLCKSZ - size);
  	}
  	else
  		newpos = 0;
***************
*** 923,929 ****
  		if (nblocks == 0)
  		{
  			ltsReadBlock(lts, datablocknum, (void *) lt->buffer);
! 			lt->nbytes = BLCKSZ;
  		}
  	}
  	lt->pos = newpos;
--- 923,929 ----
  		if (nblocks == 0)
  		{
  			ltsReadBlock(lts, datablocknum, (void *) lt->buffer);
! 			lt->nbytes = DATA_BLCKSZ;
  		}
  	}
  	lt->pos = newpos;
***************
*** 947,953 ****
  	Assert(tapenum >= 0 && tapenum < lts->nTapes);
  	lt = &lts->tapes[tapenum];
  	Assert(lt->frozen);
! 	Assert(offset >= 0 && offset <= BLCKSZ);
  
  	/*
  	 * Easy case for seek within current block.
--- 947,953 ----
  	Assert(tapenum >= 0 && tapenum < lts->nTapes);
  	lt = &lts->tapes[tapenum];
  	Assert(lt->frozen);
! 	Assert(offset >= 0 && offset <= DATA_BLCKSZ);
  
  	/*
  	 * Easy case for seek within current block.
***************
*** 990,996 ****
  			ltsReadBlock(lts, datablocknum, (void *) lt->buffer);
  	}
  	lt->nbytes = (lt->curBlockNumber < lt->numFullBlocks) ?
! 		BLCKSZ : lt->lastBlockBytes;
  	lt->pos = offset;
  	return true;
  }
--- 990,996 ----
  			ltsReadBlock(lts, datablocknum, (void *) lt->buffer);
  	}
  	lt->nbytes = (lt->curBlockNumber < lt->numFullBlocks) ?
! 		DATA_BLCKSZ : lt->lastBlockBytes;
  	lt->pos = offset;
  	return true;
  }
Index: src/backend/utils/sort/tuplesort.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v
retrieving revision 1.65
diff -c -r1.65 tuplesort.c
*** src/backend/utils/sort/tuplesort.c	10 Mar 2006 23:19:00 -0000	1.65
--- src/backend/utils/sort/tuplesort.c	22 Mar 2006 18:35:34 -0000
***************
*** 178,185 ****
   * tape during a preread cycle (see discussion at top of file).
   */
  #define MINORDER		6		/* minimum merge order */
! #define TAPE_BUFFER_OVERHEAD		(BLCKSZ * 3)
! #define MERGE_BUFFER_SIZE			(BLCKSZ * 32)
  
  /*
   * Private state of a Tuplesort operation.
--- 178,185 ----
   * tape during a preread cycle (see discussion at top of file).
   */
  #define MINORDER		6		/* minimum merge order */
! #define TAPE_BUFFER_OVERHEAD		(DATA_BLCKSZ * 3)
! #define MERGE_BUFFER_SIZE			(DATA_BLCKSZ * 32)
  
  /*
   * Private state of a Tuplesort operation.
Index: src/bin/pg_controldata/pg_controldata.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_controldata/pg_controldata.c,v
retrieving revision 1.27
diff -c -r1.27 pg_controldata.c
*** src/bin/pg_controldata/pg_controldata.c	15 Oct 2005 02:49:37 -0000	1.27
--- src/bin/pg_controldata/pg_controldata.c	22 Mar 2006 18:35:34 -0000
***************
*** 170,176 ****
  	printf(_("Time of latest checkpoint:            %s\n"), ckpttime_str);
  	printf(_("Maximum data alignment:               %u\n"), ControlFile.maxAlign);
  	/* we don't print floatFormat since can't say much useful about it */
! 	printf(_("Database block size:                  %u\n"), ControlFile.blcksz);
  	printf(_("Blocks per segment of large relation: %u\n"), ControlFile.relseg_size);
  	printf(_("Bytes per WAL segment:                %u\n"), ControlFile.xlog_seg_size);
  	printf(_("Maximum length of identifiers:        %u\n"), ControlFile.nameDataLen);
--- 170,177 ----
  	printf(_("Time of latest checkpoint:            %s\n"), ckpttime_str);
  	printf(_("Maximum data alignment:               %u\n"), ControlFile.maxAlign);
  	/* we don't print floatFormat since can't say much useful about it */
! 	printf(_("Database data block size:             %u\n"), ControlFile.dataBlcksz);
! 	printf(_("Database log block size:              %u\n"), ControlFile.logBlcksz);
  	printf(_("Blocks per segment of large relation: %u\n"), ControlFile.relseg_size);
  	printf(_("Bytes per WAL segment:                %u\n"), ControlFile.xlog_seg_size);
  	printf(_("Maximum length of identifiers:        %u\n"), ControlFile.nameDataLen);
Index: src/bin/pg_resetxlog/pg_resetxlog.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v
retrieving revision 1.40
diff -c -r1.40 pg_resetxlog.c
*** src/bin/pg_resetxlog/pg_resetxlog.c	5 Mar 2006 15:58:51 -0000	1.40
--- src/bin/pg_resetxlog/pg_resetxlog.c	22 Mar 2006 18:35:34 -0000
***************
*** 365,373 ****
  	}
  
  	/* Use malloc to ensure we have a maxaligned buffer */
! 	buffer = (char *) malloc(BLCKSZ);
  
! 	len = read(fd, buffer, BLCKSZ);
  	if (len < 0)
  	{
  		fprintf(stderr, _("%s: could not read file \"%s\": %s\n"),
--- 365,373 ----
  	}
  
  	/* Use malloc to ensure we have a maxaligned buffer */
! 	buffer = (char *) malloc(LOG_BLCKSZ);
  
! 	len = read(fd, buffer, LOG_BLCKSZ);
  	if (len < 0)
  	{
  		fprintf(stderr, _("%s: could not read file \"%s\": %s\n"),
***************
*** 455,461 ****
  
  	ControlFile.maxAlign = MAXIMUM_ALIGNOF;
  	ControlFile.floatFormat = FLOATFORMAT_VALUE;
! 	ControlFile.blcksz = BLCKSZ;
  	ControlFile.relseg_size = RELSEG_SIZE;
  	ControlFile.xlog_seg_size = XLOG_SEG_SIZE;
  	ControlFile.nameDataLen = NAMEDATALEN;
--- 455,462 ----
  
  	ControlFile.maxAlign = MAXIMUM_ALIGNOF;
  	ControlFile.floatFormat = FLOATFORMAT_VALUE;
! 	ControlFile.dataBlcksz = DATA_BLCKSZ;
! 	ControlFile.logBlcksz = LOG_BLCKSZ;
  	ControlFile.relseg_size = RELSEG_SIZE;
  	ControlFile.xlog_seg_size = XLOG_SEG_SIZE;
  	ControlFile.nameDataLen = NAMEDATALEN;
***************
*** 524,530 ****
  	printf(_("Latest checkpoint's NextMultiOffset:  %u\n"), ControlFile.checkPointCopy.nextMultiOffset);
  	printf(_("Maximum data alignment:               %u\n"), ControlFile.maxAlign);
  	/* we don't print floatFormat since can't say much useful about it */
! 	printf(_("Database block size:                  %u\n"), ControlFile.blcksz);
  	printf(_("Blocks per segment of large relation: %u\n"), ControlFile.relseg_size);
  	printf(_("Maximum length of identifiers:        %u\n"), ControlFile.nameDataLen);
  	printf(_("Maximum columns in an index:          %u\n"), ControlFile.indexMaxKeys);
--- 525,532 ----
  	printf(_("Latest checkpoint's NextMultiOffset:  %u\n"), ControlFile.checkPointCopy.nextMultiOffset);
  	printf(_("Maximum data alignment:               %u\n"), ControlFile.maxAlign);
  	/* we don't print floatFormat since can't say much useful about it */
! 	printf(_("Database data block size:             %u\n"), ControlFile.dataBlcksz);
! 	printf(_("Database log block size:              %u\n"), ControlFile.logBlcksz);
  	printf(_("Blocks per segment of large relation: %u\n"), ControlFile.relseg_size);
  	printf(_("Maximum length of identifiers:        %u\n"), ControlFile.nameDataLen);
  	printf(_("Maximum columns in an index:          %u\n"), ControlFile.indexMaxKeys);
***************
*** 543,549 ****
  RewriteControlFile(void)
  {
  	int			fd;
! 	char		buffer[BLCKSZ]; /* need not be aligned */
  
  	/*
  	 * Adjust fields as needed to force an empty XLOG starting at the next
--- 545,551 ----
  RewriteControlFile(void)
  {
  	int			fd;
! 	char		buffer[DATA_BLCKSZ]; /* need not be aligned */
  
  	/*
  	 * Adjust fields as needed to force an empty XLOG starting at the next
***************
*** 584,596 ****
  	FIN_CRC32(ControlFile.crc);
  
  	/*
! 	 * We write out BLCKSZ bytes into pg_control, zero-padding the excess over
! 	 * sizeof(ControlFileData).  This reduces the odds of premature-EOF errors
! 	 * when reading pg_control.  We'll still fail when we check the contents
! 	 * of the file, but hopefully with a more specific error than "couldn't
! 	 * read pg_control".
  	 */
! 	if (sizeof(ControlFileData) > BLCKSZ)
  	{
  		fprintf(stderr,
  				_("%s: internal error -- sizeof(ControlFileData) is too large ... fix xlog.c\n"),
--- 586,598 ----
  	FIN_CRC32(ControlFile.crc);
  
  	/*
! 	 * We write out DATA_BLCKSZ bytes into pg_control, zero-padding the excess
! 	 * over sizeof(ControlFileData).  This reduces the odds of premature-EOF
! 	 * errors when reading pg_control.  We'll still fail when we check the
! 	 * contents of the file, but hopefully with a more specific error than
! 	 * "couldn't * read pg_control".
  	 */
! 	if (sizeof(ControlFileData) > DATA_BLCKSZ)
  	{
  		fprintf(stderr,
  				_("%s: internal error -- sizeof(ControlFileData) is too large ... fix xlog.c\n"),
***************
*** 598,604 ****
  		exit(1);
  	}
  
! 	memset(buffer, 0, BLCKSZ);
  	memcpy(buffer, &ControlFile, sizeof(ControlFileData));
  
  	unlink(XLOG_CONTROL_FILE);
--- 600,606 ----
  		exit(1);
  	}
  
! 	memset(buffer, 0, DATA_BLCKSZ);
  	memcpy(buffer, &ControlFile, sizeof(ControlFileData));
  
  	unlink(XLOG_CONTROL_FILE);
***************
*** 614,620 ****
  	}
  
  	errno = 0;
! 	if (write(fd, buffer, BLCKSZ) != BLCKSZ)
  	{
  		/* if write didn't set errno, assume problem is no disk space */
  		if (errno == 0)
--- 616,622 ----
  	}
  
  	errno = 0;
! 	if (write(fd, buffer, DATA_BLCKSZ) != DATA_BLCKSZ)
  	{
  		/* if write didn't set errno, assume problem is no disk space */
  		if (errno == 0)
***************
*** 705,713 ****
  	int			nbytes;
  
  	/* Use malloc() to ensure buffer is MAXALIGNED */
! 	buffer = (char *) malloc(BLCKSZ);
  	page = (XLogPageHeader) buffer;
! 	memset(buffer, 0, BLCKSZ);
  
  	/* Set up the XLOG page header */
  	page->xlp_magic = XLOG_PAGE_MAGIC;
--- 707,715 ----
  	int			nbytes;
  
  	/* Use malloc() to ensure buffer is MAXALIGNED */
! 	buffer = (char *) malloc(LOG_BLCKSZ);
  	page = (XLogPageHeader) buffer;
! 	memset(buffer, 0, LOG_BLCKSZ);
  
  	/* Set up the XLOG page header */
  	page->xlp_magic = XLOG_PAGE_MAGIC;
***************
*** 756,762 ****
  	}
  
  	errno = 0;
! 	if (write(fd, buffer, BLCKSZ) != BLCKSZ)
  	{
  		/* if write didn't set errno, assume problem is no disk space */
  		if (errno == 0)
--- 758,764 ----
  	}
  
  	errno = 0;
! 	if (write(fd, buffer, LOG_BLCKSZ) != LOG_BLCKSZ)
  	{
  		/* if write didn't set errno, assume problem is no disk space */
  		if (errno == 0)
***************
*** 767,777 ****
  	}
  
  	/* Fill the rest of the file with zeroes */
! 	memset(buffer, 0, BLCKSZ);
! 	for (nbytes = BLCKSZ; nbytes < XLogSegSize; nbytes += BLCKSZ)
  	{
  		errno = 0;
! 		if (write(fd, buffer, BLCKSZ) != BLCKSZ)
  		{
  			if (errno == 0)
  				errno = ENOSPC;
--- 769,779 ----
  	}
  
  	/* Fill the rest of the file with zeroes */
! 	memset(buffer, 0, LOG_BLCKSZ);
! 	for (nbytes = LOG_BLCKSZ; nbytes < XLogSegSize; nbytes += LOG_BLCKSZ)
  	{
  		errno = 0;
! 		if (write(fd, buffer, LOG_BLCKSZ) != LOG_BLCKSZ)
  		{
  			if (errno == 0)
  				errno = ENOSPC;
Index: src/include/pg_config_manual.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/pg_config_manual.h,v
retrieving revision 1.20
diff -c -r1.20 pg_config_manual.h
*** src/include/pg_config_manual.h	5 Jan 2006 03:01:37 -0000	1.20
--- src/include/pg_config_manual.h	22 Mar 2006 18:35:34 -0000
***************
*** 16,36 ****
   * reduce the need to have large tuples, since fields can be spread
   * across multiple tuples).
   *
!  * BLCKSZ must be a power of 2.  The maximum possible value of BLCKSZ
!  * is currently 2^15 (32768).  This is determined by the 15-bit widths
!  * of the lp_off and lp_len fields in ItemIdData (see
!  * include/storage/itemid.h).
   *
!  * Changing BLCKSZ requires an initdb.
   */
! #define BLCKSZ	8192
  
  /*
   * RELSEG_SIZE is the maximum number of blocks allowed in one disk
   * file.  Thus, the maximum size of a single file is RELSEG_SIZE *
!  * BLCKSZ; relations bigger than that are divided into multiple files.
   *
!  * RELSEG_SIZE * BLCKSZ must be less than your OS' limit on file size.
   * This is often 2 GB or 4GB in a 32-bit operating system, unless you
   * have large file support enabled.  By default, we make the limit 1
   * GB to avoid any possible integer-overflow problems within the OS.
--- 16,38 ----
   * reduce the need to have large tuples, since fields can be spread
   * across multiple tuples).
   *
!  * DATA_BLCKSZ is the block size for the data and LOG_BLCKSZ is the
!  * block size for logging.  Both DATA_BLCKSZ and LOG_BLCKSZ must be a
!  * power of 2.  The maximum possible value of BLCKSZ * is currently
!  * 2^15 (32768).  This is determined by the 15-bit widths of the
!  * lp_off and lp_len fields in ItemIdData (see include/storage/itemid.h).
   *
!  * Changing DATA_BLCKSZ or LOG_BLCKSZ requires an initdb.
   */
! #define DATA_BLCKSZ	8192
! #define LOG_BLCKSZ	4096
  
  /*
   * RELSEG_SIZE is the maximum number of blocks allowed in one disk
   * file.  Thus, the maximum size of a single file is RELSEG_SIZE *
!  * DATA_BLCKSZ; relations bigger than that are divided into multiple files.
   *
!  * RELSEG_SIZE * DATA_BLCKSZ must be less than your OS' limit on file size.
   * This is often 2 GB or 4GB in a 32-bit operating system, unless you
   * have large file support enabled.  By default, we make the limit 1
   * GB to avoid any possible integer-overflow problems within the OS.
***************
*** 41,51 ****
   *
   * Changing RELSEG_SIZE requires an initdb.
   */
! #define RELSEG_SIZE (0x40000000 / BLCKSZ)
  
  /*
   * XLOG_SEG_SIZE is the size of a single WAL file.	This must be a power of 2
!  * and larger than BLCKSZ (preferably, a great deal larger than BLCKSZ).
   *
   * Changing XLOG_SEG_SIZE requires an initdb.
   */
--- 43,53 ----
   *
   * Changing RELSEG_SIZE requires an initdb.
   */
! #define RELSEG_SIZE (0x40000000 / DATA_BLCKSZ)
  
  /*
   * XLOG_SEG_SIZE is the size of a single WAL file.	This must be a power of 2
!  * and larger than LOG_BLCKSZ (preferably, a great deal larger than LOG_BLCKSZ).
   *
   * Changing XLOG_SEG_SIZE requires an initdb.
   */
***************
*** 56,62 ****
   *
   * The minimum value is 8 (index creation uses 8-argument functions).
   * The maximum possible value is around 600 (limited by index tuple size in
!  * pg_proc's index; BLCKSZ larger than 8K would allow more).  Values larger
   * than needed will waste memory and processing time, but do not directly
   * cost disk space.
   *
--- 58,64 ----
   *
   * The minimum value is 8 (index creation uses 8-argument functions).
   * The maximum possible value is around 600 (limited by index tuple size in
!  * pg_proc's index; DATA_BLCKSZ larger than 8K would allow more).  Values larger
   * than needed will waste memory and processing time, but do not directly
   * cost disk space.
   *
Index: src/include/access/htup.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/access/htup.h,v
retrieving revision 1.81
diff -c -r1.81 htup.h
*** src/include/access/htup.h	5 Mar 2006 15:58:53 -0000	1.81
--- src/include/access/htup.h	22 Mar 2006 18:35:34 -0000
***************
*** 308,314 ****
  
  /*
   * MaxTupleSize is the maximum allowed size of a tuple, including header and
!  * MAXALIGN alignment padding.	Basically it's BLCKSZ minus the other stuff
   * that has to be on a disk page.  The "other stuff" includes access-method-
   * dependent "special space", which we assume will be no more than
   * MaxSpecialSpace bytes (currently, on heap pages it's actually zero).
--- 308,314 ----
  
  /*
   * MaxTupleSize is the maximum allowed size of a tuple, including header and
!  * MAXALIGN alignment padding.	Basically it's DATA_BLCKSZ minus the other stuff
   * that has to be on a disk page.  The "other stuff" includes access-method-
   * dependent "special space", which we assume will be no more than
   * MaxSpecialSpace bytes (currently, on heap pages it's actually zero).
***************
*** 319,325 ****
  #define MaxSpecialSpace  32
  
  #define MaxTupleSize	\
! 	(BLCKSZ - MAXALIGN(sizeof(PageHeaderData) + MaxSpecialSpace))
  
  /*
   * MaxHeapTuplesPerPage is an upper bound on the number of tuples that can
--- 319,325 ----
  #define MaxSpecialSpace  32
  
  #define MaxTupleSize	\
! 	(DATA_BLCKSZ - MAXALIGN(sizeof(PageHeaderData) + MaxSpecialSpace))
  
  /*
   * MaxHeapTuplesPerPage is an upper bound on the number of tuples that can
***************
*** 328,334 ****
   * must be maxaligned, and it must have an associated item pointer.
   */
  #define MaxHeapTuplesPerPage	\
! 	((int) ((BLCKSZ - offsetof(PageHeaderData, pd_linp)) / \
  			(MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) + sizeof(ItemIdData))))
  
  /*
--- 328,334 ----
   * must be maxaligned, and it must have an associated item pointer.
   */
  #define MaxHeapTuplesPerPage	\
! 	((int) ((DATA_BLCKSZ - offsetof(PageHeaderData, pd_linp)) / \
  			(MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) + sizeof(ItemIdData))))
  
  /*
Index: src/include/access/xlog_internal.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/access/xlog_internal.h,v
retrieving revision 1.10
diff -c -r1.10 xlog_internal.h
*** src/include/access/xlog_internal.h	5 Mar 2006 15:58:54 -0000	1.10
--- src/include/access/xlog_internal.h	22 Mar 2006 18:35:34 -0000
***************
*** 30,36 ****
   * contains only zero bytes.  If hole_length > 0 then we have removed
   * such a "hole" from the stored data (and it's not counted in the
   * XLOG record's CRC, either).  Hence, the amount of block data actually
!  * present following the BkpBlock struct is BLCKSZ - hole_length bytes.
   *
   * Note that we don't attempt to align either the BkpBlock struct or the
   * block's data.  So, the struct must be copied to aligned local storage
--- 30,36 ----
   * contains only zero bytes.  If hole_length > 0 then we have removed
   * such a "hole" from the stored data (and it's not counted in the
   * XLOG record's CRC, either).  Hence, the amount of block data actually
!  * present following the BkpBlock struct is LOG_BLCKSZ - hole_length bytes.
   *
   * Note that we don't attempt to align either the BkpBlock struct or the
   * block's data.  So, the struct must be copied to aligned local storage
***************
*** 182,189 ****
  
  /* Check if an xrecoff value is in a plausible range */
  #define XRecOffIsValid(xrecoff) \
! 		((xrecoff) % BLCKSZ >= SizeOfXLogShortPHD && \
! 		(BLCKSZ - (xrecoff) % BLCKSZ) >= SizeOfXLogRecord)
  
  /*
   * The XLog directory and control file (relative to $PGDATA)
--- 182,189 ----
  
  /* Check if an xrecoff value is in a plausible range */
  #define XRecOffIsValid(xrecoff) \
! 		((xrecoff) % LOG_BLCKSZ >= SizeOfXLogShortPHD && \
! 		(LOG_BLCKSZ - (xrecoff) % LOG_BLCKSZ) >= SizeOfXLogRecord)
  
  /*
   * The XLog directory and control file (relative to $PGDATA)
Index: src/include/catalog/pg_control.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_control.h,v
retrieving revision 1.27
diff -c -r1.27 pg_control.h
*** src/include/catalog/pg_control.h	5 Mar 2006 15:58:54 -0000	1.27
--- src/include/catalog/pg_control.h	22 Mar 2006 18:35:34 -0000
***************
*** 126,132 ****
  	 * This data is used to make sure that configuration of this database is
  	 * compatible with the backend executable.
  	 */
! 	uint32		blcksz;			/* block size for this DB */
  	uint32		relseg_size;	/* blocks per segment of large relation */
  
  	uint32		xlog_seg_size;	/* size of each WAL segment */
--- 126,133 ----
  	 * This data is used to make sure that configuration of this database is
  	 * compatible with the backend executable.
  	 */
! 	uint32		dataBlcksz;		/* data block size for this DB */
! 	uint32		logBlcksz;		/* log block size for this DB */
  	uint32		relseg_size;	/* blocks per segment of large relation */
  
  	uint32		xlog_seg_size;	/* size of each WAL segment */
Index: src/include/storage/bufmgr.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/storage/bufmgr.h,v
retrieving revision 1.98
diff -c -r1.98 bufmgr.h
*** src/include/storage/bufmgr.h	5 Mar 2006 15:58:59 -0000	1.98
--- src/include/storage/bufmgr.h	22 Mar 2006 18:35:34 -0000
***************
*** 107,113 ****
  	BufferIsLocal(buffer) ? \
  		LocalBufferBlockPointers[-(buffer) - 1] \
  	: \
! 		(Block) (BufferBlocks + ((Size) ((buffer) - 1)) * BLCKSZ) \
  )
  
  /*
--- 107,113 ----
  	BufferIsLocal(buffer) ? \
  		LocalBufferBlockPointers[-(buffer) - 1] \
  	: \
! 		(Block) (BufferBlocks + ((Size) ((buffer) - 1)) * DATA_BLCKSZ) \
  )
  
  /*
Index: src/include/storage/bufpage.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/storage/bufpage.h,v
retrieving revision 1.67
diff -c -r1.67 bufpage.h
*** src/include/storage/bufpage.h	5 Mar 2006 15:58:59 -0000	1.67
--- src/include/storage/bufpage.h	22 Mar 2006 18:35:34 -0000
***************
*** 192,198 ****
   * PageSizeIsValid
   *		True iff the page size is valid.
   */
! #define PageSizeIsValid(pageSize) ((pageSize) == BLCKSZ)
  
  /*
   * PageGetPageSize
--- 192,198 ----
   * PageSizeIsValid
   *		True iff the page size is valid.
   */
! #define PageSizeIsValid(pageSize) ((pageSize) == DATA_BLCKSZ)
  
  /*
   * PageGetPageSize
***************
*** 276,282 ****
  #define BufferGetPageSize(buffer) \
  ( \
  	AssertMacro(BufferIsValid(buffer)), \
! 	(Size)BLCKSZ \
  )
  
  /*
--- 276,282 ----
  #define BufferGetPageSize(buffer) \
  ( \
  	AssertMacro(BufferIsValid(buffer)), \
! 	(Size)DATA_BLCKSZ \
  )
  
  /*
Index: src/include/storage/freespace.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/storage/freespace.h,v
retrieving revision 1.20
diff -c -r1.20 freespace.h
*** src/include/storage/freespace.h	5 Mar 2006 15:58:59 -0000	1.20
--- src/include/storage/freespace.h	22 Mar 2006 18:35:34 -0000
***************
*** 30,36 ****
  
  
  /* Initial value for average-request moving average */
! #define INITIAL_AVERAGE ((Size) (BLCKSZ / 32))
  
  /*
   * Number of pages and bytes per allocation chunk.	Indexes can squeeze 50%
--- 30,36 ----
  
  
  /* Initial value for average-request moving average */
! #define INITIAL_AVERAGE ((Size) (DATA_BLCKSZ / 32))
  
  /*
   * Number of pages and bytes per allocation chunk.	Indexes can squeeze 50%
Index: src/include/storage/large_object.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/storage/large_object.h,v
retrieving revision 1.33
diff -c -r1.33 large_object.h
*** src/include/storage/large_object.h	5 Mar 2006 15:58:59 -0000	1.33
--- src/include/storage/large_object.h	22 Mar 2006 18:35:34 -0000
***************
*** 50,56 ****
  /*
   * Each "page" (tuple) of a large object can hold this much data
   *
!  * We could set this as high as BLCKSZ less some overhead, but it seems
   * better to make it a smaller value, so that not as much space is used
   * up when a page-tuple is updated.  Note that the value is deliberately
   * chosen large enough to trigger the tuple toaster, so that we will
--- 50,56 ----
  /*
   * Each "page" (tuple) of a large object can hold this much data
   *
!  * We could set this as high as DATA_BLCKSZ less some overhead, but it seems
   * better to make it a smaller value, so that not as much space is used
   * up when a page-tuple is updated.  Note that the value is deliberately
   * chosen large enough to trigger the tuple toaster, so that we will
***************
*** 61,67 ****
   * since clients will often be written to send data in power-of-2 blocks.
   * This avoids unnecessary tuple updates caused by partial-page writes.
   */
! #define LOBLKSIZE		(BLCKSZ / 4)
  
  
  /*
--- 61,67 ----
   * since clients will often be written to send data in power-of-2 blocks.
   * This avoids unnecessary tuple updates caused by partial-page writes.
   */
! #define LOBLKSIZE		(DATA_BLCKSZ / 4)
  
  
  /*
Index: src/include/storage/off.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/storage/off.h,v
retrieving revision 1.20
diff -c -r1.20 off.h
*** src/include/storage/off.h	5 Mar 2006 15:58:59 -0000	1.20
--- src/include/storage/off.h	22 Mar 2006 18:35:34 -0000
***************
*** 25,31 ****
  
  #define InvalidOffsetNumber		((OffsetNumber) 0)
  #define FirstOffsetNumber		((OffsetNumber) 1)
! #define MaxOffsetNumber			((OffsetNumber) (BLCKSZ / sizeof(ItemIdData)))
  #define OffsetNumberMask		(0xffff)		/* valid uint16 bits */
  
  /* ----------------
--- 25,31 ----
  
  #define InvalidOffsetNumber		((OffsetNumber) 0)
  #define FirstOffsetNumber		((OffsetNumber) 1)
! #define MaxOffsetNumber			((OffsetNumber) (DATA_BLCKSZ / sizeof(ItemIdData)))
  #define OffsetNumberMask		(0xffff)		/* valid uint16 bits */
  
  /* ----------------
Index: src/port/copydir.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/port/copydir.c,v
retrieving revision 1.17
diff -c -r1.17 copydir.c
*** src/port/copydir.c	5 Mar 2006 15:59:10 -0000	1.17
--- src/port/copydir.c	22 Mar 2006 18:35:36 -0000
***************
*** 105,111 ****
  	int			nbytes;
  
  	/* Use palloc to ensure we get a maxaligned buffer */
! #define COPY_BUF_SIZE (8 * BLCKSZ)
  
  	buffer = palloc(COPY_BUF_SIZE);
  
--- 105,111 ----
  	int			nbytes;
  
  	/* Use palloc to ensure we get a maxaligned buffer */
! #define COPY_BUF_SIZE (8 * DATA_BLCKSZ)
  
  	buffer = palloc(COPY_BUF_SIZE);
  
