1 # Contributing to OpenZFS
3 <img alt="OpenZFS Logo"
4 src="https://openzfs.github.io/openzfs-docs/_static/img/logo/480px-Open-ZFS-Secondary-Logo-Colour-halfsize.png"/>
7 *First of all, thank you for taking the time to contribute!*
9 By using the following guidelines, you can help us make OpenZFS even better.
12 [What should I know before I get
13 started?](#what-should-i-know-before-i-get-started)
16 * [Debug ZFS](#debug-zfs)
17 * [Where can I ask for help?](#where-can-I-ask-for-help)
19 [How Can I Contribute?](#how-can-i-contribute)
21 * [Reporting Bugs](#reporting-bugs)
22 * [Suggesting Enhancements](#suggesting-enhancements)
23 * [Pull Requests](#pull-requests)
26 [Style Guides](#style-guides)
28 * [Coding Conventions](#coding-conventions)
29 * [Commit Message Formats](#commit-message-formats)
30 * [New Changes](#new-changes)
31 * [OpenZFS Patch Ports](#openzfs-patch-ports)
32 * [Coverity Defect Fixes](#coverity-defect-fixes)
33 * [Signed Off By](#signed-off-by)
37 * [OpenZFS Documentation](https://openzfs.github.io/openzfs-docs/)
38 * [OpenZFS Developer Resources](http://open-zfs.org/wiki/Developer_resources)
39 * [Git and GitHub for beginners](https://openzfs.github.io/openzfs-docs/Developer%20Resources/Git%20and%20GitHub%20for%20beginners.html)
41 ## What should I know before I get started?
44 You can build zfs packages by following [these
45 instructions](https://openzfs.github.io/openzfs-docs/Developer%20Resources/Building%20ZFS.html),
46 or install stable packages from [your distribution's
47 repository](https://openzfs.github.io/openzfs-docs/Getting%20Started/index.html).
50 A variety of methods and tools are available to aid ZFS developers.
51 It's strongly recommended that when developing a patch the `--enable-debug`
52 configure option should be set. This will enable additional correctness
53 checks and all the ASSERTs to help quickly catch potential issues.
55 In addition, there are numerous utilities and debugging files which
56 provide visibility into the inner workings of ZFS. The most useful
57 of these tools are discussed in detail on the [Troubleshooting
58 page](https://openzfs.github.io/openzfs-docs/Basic%20Concepts/Troubleshooting.html).
60 ### Where can I ask for help?
61 The [zfs-discuss mailing
62 list](https://openzfs.github.io/openzfs-docs/Project%20and%20Community/Mailing%20Lists.html)
63 or IRC are the best places to ask for help. Please do not file
64 support requests on the GitHub issue tracker.
66 ## How Can I Contribute?
69 *Please* contact us via the [zfs-discuss mailing
70 list](https://openzfs.github.io/openzfs-docs/Project%20and%20Community/Mailing%20Lists.html)
71 or IRC if you aren't certain that you are experiencing a bug.
73 If you run into an issue, please search our [issue
74 tracker](https://github.com/openzfs/zfs/issues) *first* to ensure the
75 issue hasn't been reported before. Open a new issue only if you haven't
76 found anything similar to your issue.
78 You can open a new issue and search existing issues using the public [issue
79 tracker](https://github.com/openzfs/zfs/issues).
81 #### When opening a new issue, please include the following information at the top of the issue:
82 * What distribution (with version) you are using.
83 * The spl and zfs versions you are using, installation method (repository
84 or manual compilation).
85 * Describe the issue you are experiencing.
86 * Describe how to reproduce the issue.
87 * Including any warning/errors/backtraces from the system logs.
89 When a new issue is opened, it is not uncommon for developers to request
90 additional information.
92 In general, the more detail you share about a problem the quicker a
93 developer can resolve it. For example, providing a simple test case is always
94 exceptionally helpful.
96 Be prepared to work with the developers investigating your issue. Your
97 assistance is crucial in providing a quick solution. They may ask for
100 * Your pool configuration as reported by `zdb` or `zpool status`.
101 * Your hardware configuration, such as
104 * Whether your system has ECC memory.
105 * Whether it is running under a VMM/Hypervisor.
107 * Values of the spl/zfs module parameters.
108 * Stack traces which may be logged to `dmesg`.
110 ### Suggesting Enhancements
111 OpenZFS is a widely deployed production filesystem which is under active
112 development. The team's primary focus is on fixing known issues, improving
113 performance, and adding compelling new features.
115 You can view the list of proposed features
116 by filtering the issue tracker by the ["Type: Feature"
117 label](https://github.com/openzfs/zfs/issues?q=is%3Aopen+is%3Aissue+label%3A%22Type%3A+Feature%22).
118 If you have an idea for a feature first check this list. If your idea already
119 appears then add a +1 to the top most comment, this helps us gauge interest
122 Otherwise, open a new issue and describe your proposed feature. Why is this
123 feature needed? What problem does it solve?
129 * All pull requests, except backports and releases, must be based on the current master branch
130 and should apply without conflicts.
131 * Please attempt to limit pull requests to a single commit which resolves
133 * Make sure your commit messages are in the correct format. See the
134 [Commit Message Formats](#commit-message-formats) section for more information.
135 * When updating a pull request squash multiple commits by performing a
136 [rebase](https://git-scm.com/docs/git-rebase) (squash).
137 * For large pull requests consider structuring your changes as a stack of
138 logically independent patches which build on each other. This makes large
139 changes easier to review and approve which speeds up the merging process.
140 * Try to keep pull requests simple. Simple code with comments is much easier
141 to review and approve.
142 * All proposed changes must be approved by an OpenZFS organization member.
143 * If you have an idea you'd like to discuss or which requires additional testing, consider opening it as a draft pull request.
144 Once everything is in good shape and the details have been worked out you can remove its draft status.
145 Any required reviews can then be finalized and the pull request merged.
147 #### Tests and Benchmarks
148 * Every pull request is tested using a GitHub Actions workflow on multiple platforms by running the [zfs-tests.sh and zloop.sh](
149 https://openzfs.github.io/openzfs-docs/Developer%20Resources/Building%20ZFS.html#running-zloop-sh-and-zfs-tests-sh) test suites.
150 `.github/workflows/scripts/generate-ci-type.py` is used to determine whether the pull request is nonbehavior, i.e., not introducing behavior changes of any code, configuration or tests. If so, the CI will run on fewer platforms and only essential sanity tests will run. You can always override this by adding `ZFS-CI-Type` line to your commit message:
151 * If your last commit (or `HEAD` in git terms) contains a line `ZFS-CI-Type: quick`, quick mode is forced regardless of what files are changed.
152 * Otherwise, if any commit in a PR contains a line `ZFS-CI-Type: full`, full mode is forced.
153 * To verify your changes conform to the [style guidelines](
154 https://github.com/openzfs/zfs/blob/master/.github/CONTRIBUTING.md#style-guides
155 ), please run `make checkstyle` and resolve any warnings.
156 * Code analysis is performed by [CodeQL](https://codeql.github.com/) for each pull request.
157 * Test cases should be provided when appropriate. This includes making sure new features have adequate code coverage.
158 * If your pull request improves performance, please include some benchmarks.
159 * The pull request must pass all CI checks before being accepted.
162 All help is appreciated! If you're in a position to run the latest code
163 consider helping us by reporting any functional problems, performance
164 regressions or other suspected issues. By running the latest code to a wide
165 range of realistic workloads, configurations and architectures we're better
166 able quickly identify and resolve potential issues.
168 Users can also run the [ZFS Test
169 Suite](https://github.com/openzfs/zfs/tree/master/tests) on their systems
170 to verify ZFS is behaving as intended.
174 ### Repository Structure
176 OpenZFS uses a standardised branching structure.
177 - The "development and main branch", is the branch all development should be based on.
178 - "Release branches" contain the latest released code for said version.
179 - "Staging branches" contain selected commits prior to being released.
182 - Development and Main branch: `master`
183 - Release branches: `zfs-$VERSION-release`
184 - Staging branches: `zfs-$VERSION-staging`
186 `$VERSION` should be replaced with the `major.minor` version number.
187 _(This is the version number without the `.patch` version at the end)_
189 ### Coding Conventions
190 We currently use [C Style and Coding Standards for
191 SunOS](http://www.cis.upenn.edu/%7Elee/06cse480/data/cstyle.ms.pdf) as our
194 This repository has an `.editorconfig` file. If your editor [supports
195 editorconfig](https://editorconfig.org/#download), it will
196 automatically respect most of this project's whitespace preferences.
198 Additionally, Git can help warn on whitespace problems as well:
201 git config --local core.whitespace trailing-space,space-before-tab,indent-with-non-tab,-tab-in-indent
204 ### Commit Message Formats
206 Commit messages for new changes must meet the following guidelines:
207 * In 72 characters or less, provide a summary of the change as the
208 first line in the commit message.
209 * A body which provides a description of the change. If necessary,
210 please summarize important information such as why the proposed
211 approach was chosen or a brief description of the bug you are resolving.
212 Each line of the body must be 72 characters or less.
213 * The last line must be a `Signed-off-by:` tag. See the
214 [Signed Off By](#signed-off-by) section for more information.
216 An example commit message for new changes is provided below.
219 This line is a brief summary of your change
221 Please provide at least a couple sentences describing the
222 change. If necessary, please summarize decisions such as
223 why the proposed approach was chosen or what bug you are
226 Signed-off-by: Contributor <contributor@email.com>
229 #### Coverity Defect Fixes
230 If you are submitting a fix to a
231 [Coverity defect](https://scan.coverity.com/projects/zfsonlinux-zfs),
232 the commit message should meet the following guidelines:
233 * Provides a subject line in the format of
234 `Fix coverity defects: CID dddd, dddd...` where `dddd` represents
235 each CID fixed by the commit.
236 * Provides a body which lists each Coverity defect and how it was corrected.
237 * The last line must be a `Signed-off-by:` tag. See the
238 [Signed Off By](#signed-off-by) section for more information.
240 An example Coverity defect fix commit message is provided below.
242 Fix coverity defects: CID 12345, 67890
244 CID 12345: Logically dead code (DEADCODE)
246 Removed the if(var != 0) block because the condition could never be
249 CID 67890: Resource Leak (RESOURCE_LEAK)
251 Ensure free is called after allocating memory in function().
253 Signed-off-by: Contributor <contributor@email.com>
257 A line tagged as `Signed-off-by:` must contain the developer's
258 name followed by their email. This is the developer's certification
259 that they have the right to submit the patch for inclusion into
260 the code base and indicates agreement to the [Developer's Certificate
261 of Origin](https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin).
262 Code without a proper signoff cannot be merged.
264 Git can append the `Signed-off-by` line to your commit messages. Simply
265 provide the `-s` or `--signoff` option when performing a `git commit`.
266 For more information about writing commit messages, visit [How to Write
267 a Git Commit Message](https://chris.beams.io/posts/git-commit/).
270 If someone else had part in your pull request, please add the following to the commit:
271 `Co-authored-by: Name <gitregistered@email.address>`
272 This is useful if their authorship was lost during squashing, rebasing, etc.,
273 but may be used in any situation where there are co-authors.
275 The email address used here should be the same as on the GitHub profile of said user.
276 If said user does not have their email address public, please use the following instead:
277 `Co-authored-by: Name <[username]@users.noreply.github.com>`