At the meeting last week we were discussing inodes and metadata, and where metadata is actually stored.
I double-checked what I was saying, just to make sure, and it turns out I was correct: many modern fs's (like ext4) store some metadata in the inode. This is because ext4 has a 256 byte inode by default but only needs about half of that to store "normal" inode data. Thus, "the remaining space after the ext4_inode structure is normally used to hold extended attributes".
That would include capabilities (along with selinux stuff, etc), I would assume. Of course, if your metadata is over about 100 bytes then the fs will need to allocate other blocks for the metadata. I'm sure there's a way to test all this with just ls, df and setcap or selinux.
Further, looks like there's a patch called "Inline data" (doesn't seem to be in my kernel, perhaps not mature yet) that allows *data* to be put in the empty space. That would allow tiny (100 byte) files (or even directories with few files?) to use no blocks at all! They'd also load super fast. I swear that I've seen that behavior on my systems, but I'm not sure which, perhaps my XFS fs.
Perhaps if your fs is full of tons of tiny files you could gain huge advantage by setting your inode size even higher (at fs creation time only)!
source: https://lwn.net/Articles/469805/
Well, I stand corrected... at least as far as ext4 is concerned. (I have to admit that I've read very little about ext4.) I believe that with ext3, extended metadata is stored in separate data blocks from the file's actual data and separate from the inode. (Fortunately, for SELinux context data, there is de-dup-like sharing, so you're not allocating a metadata block per file or directory.)
The "inline data" patches for ext4 sound interesting. You used to have to go with something like ReiserFS under Linux if you wanted the equivalent to that, i.e. good performance for very small files.
BTW, here's a good high-level overview of various FS choices for Linux...
http://www.howtogeek.com/howto/33552/htg-explains-which-linux-file-system-sh...
Gilbert
On 16/11/2015 12:17 AM, Trevor Cordes wrote:
At the meeting last week we were discussing inodes and metadata, and where metadata is actually stored.
I double-checked what I was saying, just to make sure, and it turns out I was correct: many modern fs's (like ext4) store some metadata in the inode. This is because ext4 has a 256 byte inode by default but only needs about half of that to store "normal" inode data. Thus, "the remaining space after the ext4_inode structure is normally used to hold extended attributes".
That would include capabilities (along with selinux stuff, etc), I would assume. Of course, if your metadata is over about 100 bytes then the fs will need to allocate other blocks for the metadata. I'm sure there's a way to test all this with just ls, df and setcap or selinux.
Further, looks like there's a patch called "Inline data" (doesn't seem to be in my kernel, perhaps not mature yet) that allows *data* to be put in the empty space. That would allow tiny (100 byte) files (or even directories with few files?) to use no blocks at all! They'd also load super fast. I swear that I've seen that behavior on my systems, but I'm not sure which, perhaps my XFS fs.
Perhaps if your fs is full of tons of tiny files you could gain huge advantage by setting your inode size even higher (at fs creation time only)!
source: https://lwn.net/Articles/469805/