Re: [RFC] Slimming down struct inode

Brian F. G. Bidulock
2006-06-15T00:16:29Z

Theodore,

On Fri, 09 Jun 2006, Theodore Ts'o wrote:
> 1) Move i_blksize (optimal size for I/O, reported by the stat system
> call). Is there any reason why this needs to be per-inode, instead
> of per-filesystem?
>
> 2) Move i_blkbits (blocksize for doing direct I/O in bits) to struct
> super. Again, why is this per-inode?

Have you considered NFS?

> 3) Move i_pipe, i_bdev, and i_cdev into a union. An inode cannot
> simultaneously be a pipe, block device, and character device at the
> same time.

A STREAMS-based FIFO is both a (named) pipe and a character device at the
same time. I would prefer if you did not merge i_pipe with i_cdev for this
reason. In the current GPL'ed out of tree STREAMS implementation, i_pipe
is used to point to the Stream head (as the normal v_str pointer in the UNIX
vnode). STREAMS-based FIFOs are the only instance in STREAMS where it
ventures outside its own filesystem (specfs) and adjusts inodes from other
filesystems. This is also true for Linux native FIFOs (named pipes) that
use the i_pipe pointer in the filesystem in which they are named instead of
creating inodes within the pipefs.

I suppose that the other two permutations are correct:

- a block device inode cannot also be a character device inode
- a block device inode cannot also be a pipe

so at least i_cdev and i_bdev could be merged, however, you will need some
way to determine which actual object was attached to the union to allow the
object reference to be dropped when the inode is cleaned. It might be better
to leave that one alone too, as any flag or mode that might be used could get
munged by a filesystem during the inode lifecycle causing incorrect reference
counts, or worse, an attempt to free the object against the wrong cache.

No comment on the rest.