Dave Johnson at ddj@brown.edu asks:

Inodes are typically 4KB and reside ondisk in full blocks in the "inode 0 file". For every inode there is also an entry in the "inode allocation map" which indicates the inode's status (eg free, inuse). To add inodes we have to add data to both. First we determine how many inodes to add (eg always add full blocks of inodes, etc), then how many "passes" will it take to add them (the "passes" are an artifact of the inode map layout). Adding the inodes themselves involves writing blocks of free inodes. This is multi-threaded on a single node. Adding to the inode map, may involve adding more inode map "segments" or just using free space in the current segments. If adding segments these are formatted and written by multiple threads on a single node, Once the on-disk data structures are complete we update the in-memory structures to reflect that all of the new inodes are free and we update the "stripe group descriptor" and broadcast it to all the nodes that have the file system mounted.

In old code - say pre 4.1 or 4.2 -- we went through another step to reread all of the inode allocation map back into memory to recompute the number of free inodes. That would have been in parallel on all the nodes that had the file system mounted. Around 4.2 or so this was changed to simply update the in-memory counters (since we know how many inodes were added, there is no need to recount them).

So, adding 4M inodes involves writing a little more than 16 GB of metadata to the disk, then cycle through the in-memory data structures. Writing 16 GB in 13 seconds works out to a little more than 1 GB/s. Sounds reasonable.

-Wayne