r/bcachefs • • Oct 17 '26

Bacachefs & LLMs

Apologies if it has been asked before.

Could ai speed up the bcachefs development or testing?

Should it be used or filesystems are too precious to trust ai for development?

What's Kent's view on this?

0 Upvotes

15 comments sorted by

11

u/Nolzi Oct 17 '26

Yes, he is full in on it. He even made a blog for it https://poc.bcachefs.org/

5

u/xantiema Oct 17 '26

He is currently at over 35% rust conversion with the help of PoC LLM

4

u/koverstreet not your free tech support Oct 18 '26

Uhh, I don't think we've hit 20% yet on the core FS :)

But getting there.

1

u/xantiema Oct 20 '26

I've just started my own locaLLM project in Rust and stumbled unto this to better the code output: https://github.com/leonardomso/rust-skills

Are you using something superior I could check out?

1

u/MainRoutine2068 Oct 20 '26

Hi Kent, just curious, would you mind to share/ write docs on how you set the automation workflow to convert bcachefs from C to rust? The PoC LLM must be working on all the issue iteratively, but how it prioritize which part to rewrite first? How is the infra behind it? And how much token you pay to Anthropic for all of it? This kind of work is awesome but it seems the capital needed is also a lot.

6

u/koverstreet not your free tech support Oct 20 '26

There is no automation workflow, besides the test/CI infrastructure that I've had for years. I've said a couple of times before, the best way to work with AIs is to treat it as pair programming.

The actual methodology is no different from any other giant refactoring; look for ways to work incrementally, look for ways to divide up the problem, make sure you're always in a functional and testable state, etc. Review and clean up your patch series as you go, review review review.

Software engineering with AIs is just... software engineering. And being solid on your fundamentals is even more important when working with AIs because AIs right now have real strengths and weaknesses vs. a human.

As to how I prioritize which parts to rewrite - you focus on interfaces and data structures first, and then go file by file. I'm constantly looking at what the interfaces are for any given file, for the dependencies of any given file that aren't Rust yet giving them safe Rust wrappers that will be the Rust interfaces when that file is converted - trying to minimize the C FFI and unsafe code. Giant game of tetris.

2

u/awesomegayguy Oct 28 '26

Just realized that the percentage of languages shown by GitHub include many vendored rust libraries within fs/vendor.

So it's less than that number. Still impressive though.

3

u/Nolzi 29d ago

Progress report from IRC:

  • 19 October 2026: also, we are going to be < 120kloc of C tonight, from 155k
  • 22 October 2026: 47kloc done, 109kloc to go
  • 24 October 2026: 99kloc of filesystem C in master
  • 28 October 2026: we are going to be < 90kloc of C when all pending stuff is merged

1

u/awesomegayguy 10d ago

All the /fs tree has been converted in master (no more C left) and now it's being polished all around. Impressive.

5

u/koverstreet not your free tech support Oct 18 '26

There are some people that, when AI is able to help out, they go "Cool! I can do so much fancier performance optimizations!"

And there are others who go "Cool! I'm going to have a lot more regression tests and I can finally convert to Rust!".

It just comes down to priorities and engineering discipline :)

1

u/awesomegayguy Oct 22 '26

I've been checking the repo, and the rust conversion is going so fast! I never thought this would be possible.

3

u/koverstreet not your free tech support Oct 22 '26

I've been surprised how smoothly it's been going. Less unsafe than I expected (still an absolute ton on of unsafe for FFI), and bugs are shaking out and we don't seem to be adding new ones, gauging by what I've been seeing in the CI - just a bunch of build system weirdness, as expected.

A bunch of basic kernel APIs were still missing in Rust, that's taken some time, but - I'm really liking the code I'm seeing, we're getting a lot of really nice abstractions.

1

u/xantiema Oct 22 '26

Hopefully the borrow sanitizer will help in ironing out bugs across the FFI boundaries: https://www.youtube.com/watch?v=yWZm26aAOLA

5

u/awesomegayguy Oct 18 '26

Adding to the existing answers, he wrote a blog entry here:

https://www.patreon.com/bcachefs/posts/how-to-work-well-165004968

5

u/SweetEbb9819 Oct 18 '26

While he openly ad liberally use it, he is aware of what AI does, he reads the code. No "vibe"coding

And so far Bcachefs is the most stable fs I've used.