Hi, While working on the fix for [0] I noticed that bulk_write doens't use any of the new vectorized IO features, which seemed like a waste. After looking into it a bit deeper, I noticed the opportunity for write vectorization was not very high, as one would expect most bulk_write IOs to be smgrextend(), which only does page-sized writes. That's something that can be solved, though, and so I started this patch.
I've attached two patches to address these two items: Patch 1/2 reworks smgrextend to smgrextendv, which does mostly the same stuff as the current smgrextend, but operates on multiple pages. Patch 2/2 updates bulk_write to make use of smgrwritev, smgrzeroextend, and the new smgrextendv API, thus reducing the syscall burden in processes that use bulk extend APIs. Open question: In my version of smgrextendv, I reject any failure to extend by the requested size. This is different from smgrwrite, which tries to write again when FileWriteV returns a short write. Should smgrextendv do retries, too? Kind regards, Matthias van de Meent Neon (https://neon.tech) [0] https://postgr.es/m/flat/CACAa4VJ%2BQY4pY7M0ECq29uGkrOygikYtao1UG9yCDFosxaps9g%40mail.gmail.com
v0-0001-Vectorize-smgrextend.patch
Description: Binary data
v0-0002-Modernize-bulk_write-s-internals-with-vectorized-.patch
Description: Binary data