On Wed, Feb 7, 2024 at 6:57 AM Thomas Bertschinger <tahbertschinger@xxxxxxxxx> wrote: > > This series adds support for Rust code into bcachefs. This only enables > using Rust internally within bcachefs; there are no public Rust APIs > added. Rust support is hidden behind a new config option, > CONFIG_BCACHEFS_RUST. It is optional and bcachefs can still be built > with full functionality without rust. But is it the goal to make it use Rust always? If not, do you mean you are you going to have 2 "modes" in bcachefs? i.e. one with all C, and one with some parts replaced (i.e. duplicated) in Rust? If it is the former (dropping C), then please note that it will limit where bcachefs can be built for, i.e. architectures and configurations (at least for the time being, i.e. we want to relax all that, but it will take time). If it is the latter (duplication), then please note that the kernel has only gone the "duplication" route for "Rust reference drivers" as an exceptional case that we requested to bootstrap their subsystems and give Rust a try. Could you please explain more about what is the intention here? Either way, the approach you are taking in this patch series seems to be about calling C code directly, rather than writing and using abstractions in general. For instance, in one of the patches you mention in a comment "If/when a Rust API is provided" to justify the functions, but it is the other way around, i.e. you need to first write the abstractions for that C code, upstream them through the relevant tree/maintainers, and then you use them from your Rust code. Instead, to bootstrap things, what about writing a bcachefs module in Rust that uses e.g. the VFS abstractions posted by Wedson, and perhaps, to experiment/prototype, fill it with calls to the relevant C parts of bcachefs? That way you can start working on the abstractions and code you will eventually need for a Rust bcachefs module, without limiting what C bcachefs can do/build for. And that way it would also help to justify the upstreaming of the VFS abstractions too, since you would be another expected user of them, and so on. > I wasn't sure if this needed to be an RFC based on the current status > of accepting Rust code outside of the rust/ tree, so I designated it as > such to be safe. However, Kent plans to merge rust+bcachefs code in the > 6.9 merge window, so I hope at least the first 2 patches in this series, > the ones that actually enable Rust for bcachefs, can be accepted. This is worrying -- there has been no discussion about mixing C and Rust like this, but you say it is targeted for 6.9. I feel there is a disconnect somewhere. Perhaps it would be a good idea to have a quick meeting about this. Cheers, Miguel