Skip to content

RFC Inode diet v2

Theodore Tso lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest8 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8inode_diet: Replace inode.u.generic_ip with inode.i_privatearch/powerpc/platforms/cell/spufs/inode.c arch/s390/kernel/debug.c block/blktrace.c +32 more+97 -993 replies
2/8inode-diet: Move i_pipe into a unioninclude/linux/fs.h+3 -20 replies
3/8inode-diet: Move i_bdev into a unionfs/block_dev.c fs/inode.c include/linux/fs.h+3 -30 replies
4/8inode-diet: Move i_cdev into a unionfs/file_table.c fs/inode.c include/linux/fs.h+3 -30 replies
5/8inode-diet: Eliminate i_blksize and use a per-superblock defaultarch/powerpc/platforms/cell/spufs/inode.c drivers/block/loop.c drivers/infiniband/hw/ipath/ipath_fs.c +77 more+21 -1190 replies
6/8inode-diet: Move i_cindex from struct inode to struct filedrivers/ieee1394/ieee1394_core.h fs/char_dev.c include/linux/fs.h+3 -30 replies
7/8inode-diet: Use a union for i_blocks and i_size, i_rdev and i_devicesfs/stat.c include/linux/fs.h+13 -70 replies
8/8inode-diet: Fix size of i_blkbits, i_version, and i_dnotify_maskinclude/linux/fs.h+3 -31 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC] [PATCH 0/8] Inode diet v2

This is the second versoin of patches to reduce the size of struct inode. I've taken into account comments to remove super.st_blksize, and simply requiring filesystems to override getattr if they care to use something other than the stock PAGE_CACHE_SIZE for st_blksize (which should be correct given that most filesystems are using generic_file_read/write).

Unfortunately, since these structures are used by a large amount of kernel code, some of the patches are quite involved, and/or will require a lot of auditing and code review, for "only" 4 or 8 bytes at a time (maybe more on 64-bit platforms). However, since there are many, many copies of struct inode all over the kernel, even a small reduction in size can have a large beneficial result, and as the old Chinese saying goes, a journey of thousand miles begins with a single step....

What else remains to be done? There are a large number of fields in struct inode which are never populated unless the inode is open, and those should get moved into another structure which is populated only when needed. There are a large number of inodes which are read into memory only because stat(2) was called on them (thanks to things like color ls, et. al).

Linus has suggested moving the i_data structure out to a separate structure, again because there are many inodes which do not have any pages cached in the page cache. The challenge with this a huge number of codepaths assume that i_mapping is always non-NULL. But, i_data is *huge* so the benefits of not having it taking up memory would make this a high-return activity.

Another possibility is moving i_size into the file-specific area of the union, which would save 8 bytes. However there are a largish number block device drivers that seem to have hijacked i_size to store the blocksize(!?!) of the device, and that should really be done in a bdev-specific structure. Untangling this will be somewhat challenging, but should be doable.

--