I'm trying to create a graph of the distribution of file sizes on my ext4 system. I'm trying to write a script to scrape this information from my computer somehow. I don't care where the files are stored in the directory structure, only how much space each takes up. I know file sizes are stored in the inode metadata, and it seems like it might be pretty fast to read through the inode table, if such a thing exists. Does anyone know of a C API for accessing the size of files, or reading directly from the inode table? Does anyone know where the inode table is stored?
Fastest way to get list of all file sizes
files;ext4;recursive;size
If you want a C API, you're going to end up with GNU nftw, the GNU file tree walk.  DON'T fool yourself into using plain old ftw, you will get inaccurate data. You'll  need to write a per file function that uses the struct stat that nftw passes into the per file function. You can have the per file function put file sizes in buckets, or just print out the file size, and then put the numbers in buckets some other way.