In Linux, we can call the FIBMAP() ioctl to determine which blocks a file occupies within a file system.
What I am curious about is- how can I determine if any random block is occupied with a file (or any data). Is there an ioctl to do this as well, or do I have to simply lseek
to the block and see if there has been data written to it or not? If there's a simple ioctl call to determine if a block is occupied - that would be ideal.