For example, I'm using FUSE to construct my own userspace filesystem, in which small files stored on SSD and big files stored on HDD. I want the metadata(inodes and dirents, etc) of the files on HDD to be stored on SSD. What should I do? I'm new to this field. Need help! Thanks!
One thing you could do is a mirrored system where all the directory structure exist on both disks. All fuse functions do the same thing in both disks (mkdir, open, unlink, etc).
The only difference would be that I/O will be done only on the slow disk. Meaning read(), write(), truncate() etc.
Since you want fast attribute read, meaning fast fuse getattr() and fuse readdir(), you would want to refrain from going to the slow disk to get the file sizes. You could, at end of each write()+close() and truncate(), set an extended attribute on the matching SSD file with the file size as it is in the HDD file, to be used in getattr() and readdir().
PS:
For a fake file size in SSD, a more elegant solution would be to fallocate() it in a sparse way to the same size as on the hard disk. That way the file size would appear correct although the number of disk blocks would remain zero.