]> git.proxmox.com Git - mirror_zfs.git/blame - .github/CONTRIBUTING.md
ZTS: Move more tests out of common.run
[mirror_zfs.git] / .github / CONTRIBUTING.md
CommitLineData
d57f03e4
GM
1# Contributing to ZFS on Linux
2<p align="center"><img src="http://zfsonlinux.org/images/zfs-linux.png"/></p>
3
4*First of all, thank you for taking the time to contribute!*
5
6By using the following guidelines, you can help us make ZFS on Linux even
7better.
8
9## Table Of Contents
10[What should I know before I get
11started?](#what-should-i-know-before-i-get-started)
12
13 * [Get ZFS](#get-zfs)
14 * [Debug ZFS](#debug-zfs)
15 * [Where can I ask for help?](#where-can-I-ask-for-help)
16
17[How Can I Contribute?](#how-can-i-contribute)
18
19 * [Reporting Bugs](#reporting-bugs)
20 * [Suggesting Enhancements](#suggesting-enhancements)
21 * [Pull Requests](#pull-requests)
22 * [Testing](#testing)
23
24[Style Guides](#style-guides)
25
26 * [Coding Conventions](#coding-conventions)
cb524aa2
GDN
27 * [Commit Message Formats](#commit-message-formats)
28 * [New Changes](#new-changes)
29 * [OpenZFS Patch Ports](#openzfs-patch-ports)
70c8a794
GDN
30 * [Coverity Defect Fixes](#coverity-defect-fixes)
31 * [Signed Off By](#signed-off-by)
d57f03e4
GM
32
33Helpful resources
34
35 * [ZFS on Linux wiki](https://github.com/zfsonlinux/zfs/wiki)
36 * [OpenZFS Documentation](http://open-zfs.org/wiki/Developer_resources)
0ff15c27 37 * [Git and GitHub for beginners](https://github.com/zfsonlinux/zfs/wiki/Git-and-GitHub-for-beginners)
d57f03e4
GM
38
39## What should I know before I get started?
40
41### Get ZFS
42You can build zfs packages by following [these
43instructions](https://github.com/zfsonlinux/zfs/wiki/Building-ZFS),
44or install stable packages from [your distribution's
45repository](https://github.com/zfsonlinux/zfs/wiki/Getting-Started).
46
47### Debug ZFS
48A variety of methods and tools are available to aid ZFS developers.
49It's strongly recommended that when developing a patch the `--enable-debug`
50configure option should be set. This will enable additional correctness
51checks and all the ASSERTs to help quickly catch potential issues.
52
53In addition, there are numerous utilities and debugging files which
a57c82fc 54provide visibility into the inner workings of ZFS. The most useful
d57f03e4
GM
55of these tools are discussed in detail on the [debugging ZFS wiki
56page](https://github.com/zfsonlinux/zfs/wiki/Debugging).
57
58### Where can I ask for help?
12a935ee
KP
59[The zfs-discuss mailing list or IRC](http://list.zfsonlinux.org)
60are the best places to ask for help. Please do not file support requests
61on the GitHub issue tracker.
d57f03e4
GM
62
63## How Can I Contribute?
64
65### Reporting Bugs
12a935ee
KP
66*Please* contact us via the [zfs-discuss mailing
67list or IRC](http://list.zfsonlinux.org) if you aren't
d57f03e4
GM
68certain that you are experiencing a bug.
69
70If you run into an issue, please search our [issue
71tracker](https://github.com/zfsonlinux/zfs/issues) *first* to ensure the
72issue hasn't been reported before. Open a new issue only if you haven't
73found anything similar to your issue.
74
75You can open a new issue and search existing issues using the public [issue
76tracker](https://github.com/zfsonlinux/zfs/issues).
77
78#### When opening a new issue, please include the following information at the top of the issue:
79* What distribution (with version) you are using.
80* The spl and zfs versions you are using, installation method (repository
81or manual compilation).
82* Describe the issue you are experiencing.
83* Describe how to reproduce the issue.
84* Including any warning/errors/backtraces from the system logs.
85
86When a new issue is opened, it is not uncommon for developers to request
87additional information.
88
89In general, the more detail you share about a problem the quicker a
90developer can resolve it. For example, providing a simple test case is always
91exceptionally helpful.
92
93Be prepared to work with the developers investigating your issue. Your
94assistance is crucial in providing a quick solution. They may ask for
95information like:
96
97* Your pool configuration as reported by `zdb` or `zpool status`.
98* Your hardware configuration, such as
99 * Number of CPUs.
100 * Amount of memory.
101 * Whether your system has ECC memory.
102 * Whether it is running under a VMM/Hypervisor.
103 * Kernel version.
104 * Values of the spl/zfs module parameters.
105* Stack traces which may be logged to `dmesg`.
106
107### Suggesting Enhancements
108ZFS on Linux is a widely deployed production filesystem which is under
109active development. The team's primary focus is on fixing known issues,
110improving performance, and adding compelling new features.
111
112You can view the list of proposed features
113by filtering the issue tracker by the ["Feature"
114label](https://github.com/zfsonlinux/zfs/issues?q=is%3Aopen+is%3Aissue+label%3AFeature).
115If you have an idea for a feature first check this list. If your idea already
116appears then add a +1 to the top most comment, this helps us gauge interest
117in that feature.
118
119Otherwise, open a new issue and describe your proposed feature. Why is this
120feature needed? What problem does it solve?
121
122### Pull Requests
82e996c2
KSL
123
124#### General
125
d57f03e4
GM
126* All pull requests must be based on the current master branch and apply
127without conflicts.
128* Please attempt to limit pull requests to a single commit which resolves
129one specific issue.
cb524aa2
GDN
130* Make sure your commit messages are in the correct format. See the
131[Commit Message Formats](#commit-message-formats) section for more information.
d57f03e4
GM
132* When updating a pull request squash multiple commits by performing a
133[rebase](https://git-scm.com/docs/git-rebase) (squash).
134* For large pull requests consider structuring your changes as a stack of
135logically independent patches which build on each other. This makes large
136changes easier to review and approve which speeds up the merging process.
137* Try to keep pull requests simple. Simple code with comments is much easier
138to review and approve.
82e996c2
KSL
139* All proposed changes must be approved by a ZFS on Linux organization member.
140* If you have an idea you'd like to discuss or which requires additional testing, consider opening it as a draft pull request.
141Once everything is in good shape and the details have been worked out you can remove its draft status.
142Any required reviews can then be finalized and the pull request merged.
143
144#### Tests and Benchmarks
145* Every pull request will by tested by the buildbot on multiple platforms by running the [zfs-tests.sh and zloop.sh](
146https://github.com/zfsonlinux/zfs/wiki/Building-ZFS#running-zloopsh-and-zfs-testssh) test suites.
147* To verify your changes conform to the [style guidelines](
148https://github.com/zfsonlinux/zfs/blob/master/.github/CONTRIBUTING.md#style-guides
149), please run `make checkstyle` and resolve any warnings.
150* Static code analysis of each pull request is performed by the buildbot; run `make lint` to check your changes.
d57f03e4 151* Test cases should be provided when appropriate.
82e996c2 152This includes making sure new features have adequate code coverage.
d57f03e4
GM
153* If your pull request improves performance, please include some benchmarks.
154* The pull request must pass all required [ZFS
155Buildbot](http://build.zfsonlinux.org/) builders before
156being accepted. If you are experiencing intermittent TEST
157builder failures, you may be experiencing a [test suite
158issue](https://github.com/zfsonlinux/zfs/issues?q=is%3Aissue+is%3Aopen+label%3A%22Test+Suite%22).
05a5357a
GDN
159There are also various [buildbot options](https://github.com/zfsonlinux/zfs/wiki/Buildbot-Options)
160to control how changes are tested.
d57f03e4
GM
161
162### Testing
163All help is appreciated! If you're in a position to run the latest code
164consider helping us by reporting any functional problems, performance
165regressions or other suspected issues. By running the latest code to a wide
166range of realistic workloads, configurations and architectures we're better
167able quickly identify and resolve potential issues.
168
169Users can also run the [ZFS Test
170Suite](https://github.com/zfsonlinux/zfs/tree/master/tests) on their systems
171to verify ZFS is behaving as intended.
172
173## Style Guides
174
175### Coding Conventions
176We currently use [C Style and Coding Standards for
177SunOS](http://www.cis.upenn.edu/%7Elee/06cse480/data/cstyle.ms.pdf) as our
178coding convention.
cb524aa2
GDN
179
180### Commit Message Formats
181#### New Changes
182Commit messages for new changes must meet the following guidelines:
4efb48ee 183* In 72 characters or less, provide a summary of the change as the
cb524aa2
GDN
184first line in the commit message.
185* A body which provides a description of the change. If necessary,
186please summarize important information such as why the proposed
187approach was chosen or a brief description of the bug you are resolving.
188Each line of the body must be 72 characters or less.
70c8a794
GDN
189* The last line must be a `Signed-off-by:` tag. See the
190[Signed Off By](#signed-off-by) section for more information.
cb524aa2 191
70c8a794 192An example commit message for new changes is provided below.
cb524aa2
GDN
193
194```
195This line is a brief summary of your change
196
197Please provide at least a couple sentences describing the
198change. If necessary, please summarize decisions such as
199why the proposed approach was chosen or what bug you are
200attempting to solve.
201
202Signed-off-by: Contributor <contributor@email.com>
203```
204
205#### OpenZFS Patch Ports
69b229bd 206If you are porting OpenZFS patches, the commit message must meet
cb524aa2 207the following guidelines:
69b229bd
GDN
208* The first line must be the summary line from the most important OpenZFS commit being ported.
209It must begin with `OpenZFS dddd, dddd - ` where `dddd` are OpenZFS issue numbers.
210* Provides a `Authored by:` line to attribute each patch for each original author.
211* Provides the `Reviewed by:` and `Approved by:` lines from each original
cb524aa2
GDN
212OpenZFS commit.
213* Provides a `Ported-by:` line with the developer's name followed by
69b229bd
GDN
214their email for each OpenZFS commit.
215* Provides a `OpenZFS-issue:` line with link for each original illumos
cb524aa2 216issue.
69b229bd 217* Provides a `OpenZFS-commit:` line with link for each original OpenZFS commit.
cb524aa2 218* If necessary, provide some porting notes to describe any deviations from
69b229bd 219the original OpenZFS commits.
cb524aa2 220
69b229bd
GDN
221An example OpenZFS patch port commit message for a single patch is provided
222below.
cb524aa2
GDN
223```
224OpenZFS 1234 - Summary from the original OpenZFS commit
225
226Authored by: Original Author <original@email.com>
227Reviewed by: Reviewer One <reviewer1@email.com>
228Reviewed by: Reviewer Two <reviewer2@email.com>
229Approved by: Approver One <approver1@email.com>
230Ported-by: ZFS Contributor <contributor@email.com>
231
232Provide some porting notes here if necessary.
233
234OpenZFS-issue: https://www.illumos.org/issues/1234
235OpenZFS-commit: https://github.com/openzfs/openzfs/commit/abcd1234
236```
70c8a794 237
69b229bd
GDN
238If necessary, multiple OpenZFS patches can be combined in a single port.
239This is useful when you are porting a new patch and its subsequent bug
240fixes. An example commit message is provided below.
241```
242OpenZFS 1234, 5678 - Summary of most important OpenZFS commit
243
2441234 Summary from original OpenZFS commit for 1234
245
246Authored by: Original Author <original@email.com>
247Reviewed by: Reviewer Two <reviewer2@email.com>
248Approved by: Approver One <approver1@email.com>
249Ported-by: ZFS Contributor <contributor@email.com>
250
251Provide some porting notes here for 1234 if necessary.
252
253OpenZFS-issue: https://www.illumos.org/issues/1234
254OpenZFS-commit: https://github.com/openzfs/openzfs/commit/abcd1234
255
2565678 Summary from original OpenZFS commit for 5678
257
258Authored by: Original Author2 <original2@email.com>
259Reviewed by: Reviewer One <reviewer1@email.com>
260Approved by: Approver Two <approver2@email.com>
261Ported-by: ZFS Contributor <contributor@email.com>
262
263Provide some porting notes here for 5678 if necessary.
264
265OpenZFS-issue: https://www.illumos.org/issues/5678
266OpenZFS-commit: https://github.com/openzfs/openzfs/commit/efgh5678
267```
268
70c8a794
GDN
269#### Coverity Defect Fixes
270If you are submitting a fix to a
271[Coverity defect](https://scan.coverity.com/projects/zfsonlinux-zfs),
272the commit message should meet the following guidelines:
273* Provides a subject line in the format of
274`Fix coverity defects: CID dddd, dddd...` where `dddd` represents
275each CID fixed by the commit.
276* Provides a body which lists each Coverity defect and how it was corrected.
277* The last line must be a `Signed-off-by:` tag. See the
278[Signed Off By](#signed-off-by) section for more information.
279
280An example Coverity defect fix commit message is provided below.
281```
282Fix coverity defects: CID 12345, 67890
283
284CID 12345: Logically dead code (DEADCODE)
285
286Removed the if(var != 0) block because the condition could never be
287satisfied.
288
289CID 67890: Resource Leak (RESOURCE_LEAK)
290
291Ensure free is called after allocating memory in function().
292
293Signed-off-by: Contributor <contributor@email.com>
294```
295
296#### Signed Off By
297A line tagged as `Signed-off-by:` must contain the developer's
298name followed by their email. This is the developer's certification
299that they have the right to submit the patch for inclusion into
300the code base and indicates agreement to the [Developer's Certificate
301of Origin](https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin).
302Code without a proper signoff cannot be merged.
303
304Git can append the `Signed-off-by` line to your commit messages. Simply
305provide the `-s` or `--signoff` option when performing a `git commit`.
306For more information about writing commit messages, visit [How to Write
307a Git Commit Message](https://chris.beams.io/posts/git-commit/).
82e996c2
KSL
308
309#### Co-authored By
310If someone else had part in your pull request, please add the following to the commit:
311`Co-authored-by: Name <gitregistered@email.address>`
312This is useful if their authorship was lost during squashing, rebasing, etc.,
313but may be used in any situation where there are co-authors.
314
315The email address used here should be the same as on the GitHub profile of said user.
316If said user does not have their email address public, please use the following instead:
317`Co-authored-by: Name <[username]@users.noreply.github.com>`
318