diff -c -r src.orig/backend/access/gin/ginvacuum.c src/backend/access/gin/ginvacuum.c
*** src.orig/backend/access/gin/ginvacuum.c	Thu May 31 15:19:23 2007
--- src/backend/access/gin/ginvacuum.c	Thu May 31 17:15:42 2007
***************
*** 28,33 ****
--- 28,34 ----
  	IndexBulkDeleteCallback callback;
  	void	   *callback_state;
  	GinState	ginstate;
+ 	BufferAccessStrategy	strategy;
  } GinVacuumState;
  
  
***************
*** 152,158 ****
  static bool
  ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot, Buffer *rootBuffer)
  {
! 	Buffer		buffer = ReadBuffer(gvs->index, blkno);
  	Page		page = BufferGetPage(buffer);
  	bool		hasVoidPage = FALSE;
  
--- 153,159 ----
  static bool
  ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot, Buffer *rootBuffer)
  {
! 	Buffer		buffer = ReadBufferWithStrategy(gvs->index, blkno, gvs->strategy);
  	Page		page = BufferGetPage(buffer);
  	bool		hasVoidPage = FALSE;
  
***************
*** 238,246 ****
  ginDeletePage(GinVacuumState *gvs, BlockNumber deleteBlkno, BlockNumber leftBlkno,
  			  BlockNumber parentBlkno, OffsetNumber myoff, bool isParentRoot)
  {
! 	Buffer		dBuffer = ReadBuffer(gvs->index, deleteBlkno);
! 	Buffer		lBuffer = (leftBlkno == InvalidBlockNumber) ? InvalidBuffer : ReadBuffer(gvs->index, leftBlkno);
! 	Buffer		pBuffer = ReadBuffer(gvs->index, parentBlkno);
  	Page		page,
  				parentPage;
  
--- 239,248 ----
  ginDeletePage(GinVacuumState *gvs, BlockNumber deleteBlkno, BlockNumber leftBlkno,
  			  BlockNumber parentBlkno, OffsetNumber myoff, bool isParentRoot)
  {
! 	Buffer		dBuffer = ReadBufferWithStrategy(gvs->index, deleteBlkno, gvs->strategy);
! 	Buffer		lBuffer = (leftBlkno == InvalidBlockNumber) ? 
! 							InvalidBuffer : ReadBufferWithStrategy(gvs->index, leftBlkno, gvs->strategy);
! 	Buffer		pBuffer = ReadBufferWithStrategy(gvs->index, parentBlkno, gvs->strategy);
  	Page		page,
  				parentPage;
  
***************
*** 390,396 ****
  			me = parent->child;
  	}
  
! 	buffer = ReadBuffer(gvs->index, blkno);
  	page = BufferGetPage(buffer);
  
  	Assert(GinPageIsData(page));
--- 392,398 ----
  			me = parent->child;
  	}
  
! 	buffer = ReadBufferWithStrategy(gvs->index, blkno, gvs->strategy);
  	page = BufferGetPage(buffer);
  
  	Assert(GinPageIsData(page));
***************
*** 574,582 ****
  	gvs.result = stats;
  	gvs.callback = callback;
  	gvs.callback_state = callback_state;
  	initGinState(&gvs.ginstate, index);
  
! 	buffer = ReadBuffer(index, blkno);
  
  	/* find leaf page */
  	for (;;)
--- 576,585 ----
  	gvs.result = stats;
  	gvs.callback = callback;
  	gvs.callback_state = callback_state;
+ 	gvs.strategy = info->strategy;
  	initGinState(&gvs.ginstate, index);
  
! 	buffer = ReadBufferWithStrategy(index, blkno, info->strategy);
  
  	/* find leaf page */
  	for (;;)
***************
*** 607,614 ****
  		blkno = GinItemPointerGetBlockNumber(&(itup)->t_tid);
  		Assert(blkno != InvalidBlockNumber);
  
! 		LockBuffer(buffer, GIN_UNLOCK);
! 		buffer = ReleaseAndReadBuffer(buffer, index, blkno);
  	}
  
  	/* right now we found leftmost page in entry's BTree */
--- 610,617 ----
  		blkno = GinItemPointerGetBlockNumber(&(itup)->t_tid);
  		Assert(blkno != InvalidBlockNumber);
  
! 		UnlockReleaseBuffer(buffer);
! 		buffer = ReadBufferWithStrategy(index, blkno, info->strategy);
  	}
  
  	/* right now we found leftmost page in entry's BTree */
***************
*** 650,656 ****
  		if (blkno == InvalidBlockNumber)		/* rightmost page */
  			break;
  
! 		buffer = ReadBuffer(index, blkno);
  		LockBuffer(buffer, GIN_EXCLUSIVE);
  	}
  
--- 653,659 ----
  		if (blkno == InvalidBlockNumber)		/* rightmost page */
  			break;
  
! 		buffer = ReadBufferWithStrategy(index, blkno, info->strategy);
  		LockBuffer(buffer, GIN_EXCLUSIVE);
  	}
  
***************
*** 713,719 ****
  
  		vacuum_delay_point();
  
! 		buffer = ReadBuffer(index, blkno);
  		LockBuffer(buffer, GIN_SHARE);
  		page = (Page) BufferGetPage(buffer);
  
--- 716,722 ----
  
  		vacuum_delay_point();
  
! 		buffer = ReadBufferWithStrategy(index, blkno, info->strategy);
  		LockBuffer(buffer, GIN_SHARE);
  		page = (Page) BufferGetPage(buffer);
  
diff -c -r src.orig/backend/access/gist/gistvacuum.c src/backend/access/gist/gistvacuum.c
*** src.orig/backend/access/gist/gistvacuum.c	Thu May 31 15:19:23 2007
--- src/backend/access/gist/gistvacuum.c	Thu May 31 16:34:07 2007
***************
*** 35,40 ****
--- 35,41 ----
  	Relation	index;
  	MemoryContext opCtx;
  	GistBulkDeleteResult *result;
+ 	BufferAccessStrategy	strategy;
  } GistVacuum;
  
  typedef struct
***************
*** 83,89 ****
  	Buffer		buffer;
  	Page		page;
  
! 	buffer = ReadBuffer(gv->index, blkno);
  	LockBuffer(buffer, GIST_EXCLUSIVE);
  	page = (Page) BufferGetPage(buffer);
  
--- 84,90 ----
  	Buffer		buffer;
  	Page		page;
  
! 	buffer = ReadBufferWithStrategy(gv->index, blkno, gv->strategy);
  	LockBuffer(buffer, GIST_EXCLUSIVE);
  	page = (Page) BufferGetPage(buffer);
  
***************
*** 303,309 ****
  
  	vacuum_delay_point();
  
! 	buffer = ReadBuffer(gv->index, blkno);
  	LockBuffer(buffer, GIST_EXCLUSIVE);
  	gistcheckpage(gv->index, buffer);
  	page = (Page) BufferGetPage(buffer);
--- 304,310 ----
  
  	vacuum_delay_point();
  
! 	buffer = ReadBufferWithStrategy(gv->index, blkno, gv->strategy);
  	LockBuffer(buffer, GIST_EXCLUSIVE);
  	gistcheckpage(gv->index, buffer);
  	page = (Page) BufferGetPage(buffer);
***************
*** 550,555 ****
--- 551,557 ----
  		initGISTstate(&(gv.giststate), rel);
  		gv.opCtx = createTempGistContext();
  		gv.result = stats;
+ 		gv.strategy = info->strategy;
  
  		/* walk through the entire index for update tuples */
  		res = gistVacuumUpdate(&gv, GIST_ROOT_BLKNO, false);
***************
*** 600,606 ****
  
  		vacuum_delay_point();
  
! 		buffer = ReadBuffer(rel, blkno);
  		LockBuffer(buffer, GIST_SHARE);
  		page = (Page) BufferGetPage(buffer);
  
--- 602,608 ----
  
  		vacuum_delay_point();
  
! 		buffer = ReadBufferWithStrategy(rel, blkno, info->strategy);
  		LockBuffer(buffer, GIST_SHARE);
  		page = (Page) BufferGetPage(buffer);
  
***************
*** 704,710 ****
  
  	while (stack)
  	{
! 		Buffer		buffer = ReadBuffer(rel, stack->blkno);
  		Page		page;
  		OffsetNumber i,
  					maxoff;
--- 706,712 ----
  
  	while (stack)
  	{
! 		Buffer		buffer = ReadBufferWithStrategy(rel, stack->blkno, info->strategy);
  		Page		page;
  		OffsetNumber i,
  					maxoff;
