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