Andres Freund <and...@anarazel.de> writes: > Is there a good reason to rely on P_NEW at all? Both from an efficiency > and robustness POV it seems like it'd be better to use smgrextend to > bulk extend just after smgrcreate() and then fill s_b u using RBM_ZERO > (or whatever it is called). That bulk smgrextend would later be a good > point to use fallocate so the FS can immediately size the file > correctly, without a lot of pointless writes of zeroes.
Hmm ... makes sense. We'd be using smgrextend to write just the last page of the file, relying on its API spec "Note that we assume writing a block beyond current EOF causes intervening file space to become filled with zeroes". I don't know that we're using that assumption aggressively today, but as long as it doesn't confuse the kernel it'd probably be fine. regards, tom lane