For a very large file with delayed-allocation, some sectors may have been allocated and some may not. Delayed allocation is supported by ext4/xfs/etc..
For example, create an empty file and set to very large size using fallocate(). Now the file's size could be GBs, but using du
you will get a zero disk usage.
After some random writes, I want to get whether a specific sector/page of this file has been allocated.
Some related system calls such as mincore/fincore work on vm status of page cache. However they don't serve on-disk allocation information. I wonder is there any method to do that. Thanks.