On Wed, 2021-11-17 at 14:34 -0600, Justin Pryzby wrote: > On Wed, Nov 17, 2021 at 02:44:52PM -0500, Jaime Casanova wrote: > > > > - why we read()/write() at all? is not a faster way of copying the file? > > i'm asking that because i don't actually know. > > No portable way. Linux has this: > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fman7.org%2Flinux%2Fman-pages%2Fman2%2Fcopy_file_range.2.html&data=04%7C01%7Cpchampion%40vmware.com%7C35fb5d59bd2745636fd408d9aa09a245%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637727780625465398%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=PS6OCE55n12KBOjh5qZ2uGzDR9U687nzNIV5AM9Zke4%3D&reserved=0 > > But I just read: > > > First support for cross-filesystem copies was introduced in Linux > > 5.3. Older kernels will return -EXDEV when cross-filesystem > > copies are attempted. > > To me that sounds like it may not be worth it, at least not quite yet. > But it would be good to test. I think a downside of copy_file_range() is that filesystems might perform a reflink under us, and to me that seems like something that needs to be opted into via clone mode. (https://lwn.net/Articles/846403/ is also good reading on some sharp edges, though I doubt many of them apply to our use case.) --Jacob
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных