diff --git a/src/backend/access/heap/hio.c b/src/backend/access/heap/hio.c
index 7c662cdf46e..b83f3211aa2 100644
--- a/src/backend/access/heap/hio.c
+++ b/src/backend/access/heap/hio.c
@@ -297,8 +297,11 @@ RelationAddBlocks(Relation relation, BulkInsertState bistate,
 		 *   prevent future contention.
 		 * ---
 		 */
+
+#ifdef HAVE_POSIX_FALLOCATE
 		if (bistate)
 			extend_by_pages = Max(extend_by_pages, bistate->already_extended_by);
+#endif
 
 		/*
 		 * Can't extend by more than MAX_BUFFERS_TO_EXTEND_BY, we need to pin
@@ -426,7 +429,9 @@ RelationAddBlocks(Relation relation, BulkInsertState bistate,
 		/* maintain bistate->current_buf */
 		IncrBufferRefCount(buffer);
 		bistate->current_buf = buffer;
+#ifdef HAVE_POSIX_FALLOCATE
 		bistate->already_extended_by += extend_by_pages;
+#endif
 	}
 
 	return buffer;
