cxl-micron-reskit / famfs

This is the user space repo for famfs, the fabric-attached memory file system
Apache License 2.0
30 stars 9 forks source link

Discuss related commands about famfs directory supporting native file system operations #78

Open leeq2016 opened 1 month ago

leeq2016 commented 1 month ago

Hi, @jagalactic

Now, file directory creation, file creation, file copy and other related operations in the famfs file system directory need to be completed with the famfs command. The reason is that when this command takes effect, a famfs log entry needs to be generated and placed in the log memory area.

Have you ever considered adding a new famfs daemon process and using ebpf to use native commands without any sense, such as: mkdir, cp, touch, etc.

Do you think this is possible? @jagalactic

jagalactic commented 1 month ago

There are some hard problems in there, but I think it may be possible. One of the best simplifications in famfs, which is quite important for large shared-memory data sets, is that famfs currently never does allocate-on-write. Adding allocate-on-write (which I think would be required for cp) would likely lead to fragmented files, or increase the file creation bottleneck, or both. It would be useful if you could share some info about your use case (either here or in a private message) so I can better understand your requirements.

But there is some work that must happen first.

If you saw my talk at LSFMM (https://www.youtube.com/watch?v=nMaZhXJJgmU&list=PLbzoR-pLrL6oj1rVTXLnV7cOuetvjKn9q&index=66), you know that the maintainer of fuse is interested in merging the famfs functionality into fuse. I have been working through the implications and I think it's feasible.

The main requirement is that memory mapped files handle mapping faults as fast as anonymous mmap, which means that fuse will need to cache file-to-memory extent lists in the kernel for famfs files - the same way famfs does it now. So I'm working on hacking that functionality from famfs into fuse.

Once the initial work is done (hopefully by late August), famfs will have a fuse daemon. In the initial implementation, the famfs cli will still be required to create files, but it would become possible to support file creation via the fuse daemon. I don't have a design for that yet, and getting use case / requirements info would be helpful there.

I think we will be able to achieve excellent performance for mmap and read/write with the fuse implementation; file creation (specifically allocation and log append) require strict serialization, so there is a risk that a performant solution would add significant complexity.

Regards, John

leeq2016 commented 1 month ago

Thank you for your answer.

About my use case, I tried to use famfs to share a docker image filesystem between diffrent vm, image files in famfs is used as lower dir in OVERLAYFS(this is read-only).

Due to the huge number of image files, I made some adjustments to famfs, including FAMFS_ALLOC_UNIT size, log memory area size, adding soft link support, etc., and also fixed some performance issues. I have successfully run the container through the image file system shared by famfs now. The feasibility of this idea was verified.👍

Regards, Leeq