1Submitting patches to bcachefs: 2=============================== 3 4Patches must be tested before being submitted, either with the xfstests suite 5[0], or the full bcachefs test suite in ktest [1], depending on what's being 6touched. Note that ktest wraps xfstests and will be an easier method to running 7it for most users; it includes single-command wrappers for all the mainstream 8in-kernel local filesystems. 9 10Patches will undergo more testing after being merged (including 11lockdep/kasan/preempt/etc. variants), these are not generally required to be 12run by the submitter - but do put some thought into what you're changing and 13which tests might be relevant, e.g. are you dealing with tricky memory layout 14work? kasan, are you doing locking work? then lockdep; and ktest includes 15single-command variants for the debug build types you'll most likely need. 16 17The exception to this rule is incomplete WIP/RFC patches: if you're working on 18something nontrivial, it's encouraged to send out a WIP patch to let people 19know what you're doing and make sure you're on the right track. Just make sure 20it includes a brief note as to what's done and what's incomplete, to avoid 21confusion. 22 23Rigorous checkpatch.pl adherence is not required (many of its warnings are 24considered out of date), but try not to deviate too much without reason. 25 26Focus on writing code that reads well and is organized well; code should be 27aesthetically pleasing. 28 29CI: 30=== 31 32Instead of running your tests locally, when running the full test suite it's 33prefereable to let a server farm do it in parallel, and then have the results 34in a nice test dashboard (which can tell you which failures are new, and 35presents results in a git log view, avoiding the need for most bisecting). 36 37That exists [2], and community members may request an account. If you work for 38a big tech company, you'll need to help out with server costs to get access - 39but the CI is not restricted to running bcachefs tests: it runs any ktest test 40(which generally makes it easy to wrap other tests that can run in qemu). 41 42Other things to think about: 43============================ 44 45- How will we debug this code? Is there sufficient introspection to diagnose 46 when something starts acting wonky on a user machine? 47 48 We don't necessarily need every single field of every data structure visible 49 with introspection, but having the important fields of all the core data 50 types wired up makes debugging drastically easier - a bit of thoughtful 51 foresight greatly reduces the need to have people build custom kernels with 52 debug patches. 53 54 More broadly, think about all the debug tooling that might be needed. 55 56- Does it make the codebase more or less of a mess? Can we also try to do some 57 organizing, too? 58 59- Do new tests need to be written? New assertions? How do we know and verify 60 that the code is correct, and what happens if something goes wrong? 61 62 We don't yet have automated code coverage analysis or easy fault injection - 63 but for now, pretend we did and ask what they might tell us. 64 65 Assertions are hugely important, given that we don't yet have a systems 66 language that can do ergonomic embedded correctness proofs. Hitting an assert 67 in testing is much better than wandering off into undefined behaviour la-la 68 land - use them. Use them judiciously, and not as a replacement for proper 69 error handling, but use them. 70 71- Does it need to be performance tested? Should we add new peformance counters? 72 73 bcachefs has a set of persistent runtime counters which can be viewed with 74 the 'bcachefs fs top' command; this should give users a basic idea of what 75 their filesystem is currently doing. If you're doing a new feature or looking 76 at old code, think if anything should be added. 77 78- If it's a new on disk format feature - have upgrades and downgrades been 79 tested? (Automated tests exists but aren't in the CI, due to the hassle of 80 disk image management; coordinate to have them run.) 81 82Mailing list, IRC: 83================== 84 85Patches should hit the list [3], but much discussion and code review happens on 86IRC as well [4]; many people appreciate the more conversational approach and 87quicker feedback. 88 89Additionally, we have a lively user community doing excellent QA work, which 90exists primarily on IRC. Please make use of that resource; user feedback is 91important for any nontrivial feature, and documenting it in commit messages 92would be a good idea. 93 94[0]: git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git 95[1]: https://evilpiepirate.org/git/ktest.git/ 96[2]: https://evilpiepirate.org/~testdashboard/ci/ 97[3]: [email protected] 98[4]: irc.oftc.net#bcache, #bcachefs-dev 99