On Tuesday, January 9, 2018 8:59:06 AM CET Paul Eggert wrote: > Pavel Raiskup wrote: > > So what about special casing that filesystem, where we can lseek() for > > holes anyway? > > If we can lseek for holes, then why not just do that?
Checking whether lseek() actually works costs some additional syscalls _per sparse_ file; checking for ST_NBLOCKS() is without this penalty. > We shouldn't need special-case code for btrfs per se. Any filesystem > where we can lseek for holes should take advantage of that optimization. It is done so actually, the 'wholesparse' is another optimization on top of that (but usable also in cases where SEEK_HOLE isn't defined at all). Pavel