<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.old.lustre.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rcorreia</id>
	<title>Obsolete Lustre Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.old.lustre.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rcorreia"/>
	<link rel="alternate" type="text/html" href="http://wiki.old.lustre.org/index.php?title=Special:Contributions/Rcorreia"/>
	<updated>2026-05-09T00:04:07Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.7</generator>
	<entry>
		<id>http://wiki.old.lustre.org/index.php?title=ZFS_and_Lustre&amp;diff=8783</id>
		<title>ZFS and Lustre</title>
		<link rel="alternate" type="text/html" href="http://wiki.old.lustre.org/index.php?title=ZFS_and_Lustre&amp;diff=8783"/>
		<updated>2009-12-03T23:01:13Z</updated>

		<summary type="html">&lt;p&gt;Rcorreia: Corrected disk filesystem name&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Lustre&#039;s current node file system &#039;&#039;ldiskfs&#039;&#039; (based on ext3/ext4) is limited to an 8 TB maximum file system size and offers no guarantee of data integrity. To improve the reliability and resilience of the underlying file system on the OSS and MDS components, Lustre will add ZFS support.&lt;br /&gt;
&lt;br /&gt;
Lustre supporting ZFS will offer a number of advantages, such as improved data integrity with transaction-based, copy-on-write operations and an end-to-end checksum on every block.&lt;br /&gt;
&lt;br /&gt;
Copy-on-write means that ZFS never overwrites existing data. Changed information is written to a new block and the block pointer to in-use data is only moved after the write transaction is completed. This mechanism is used all the way up to the file system block structure at the top block.&lt;br /&gt;
&lt;br /&gt;
To avoid data corruption, ZFS performs end-to-end checksumming. The checksum is not stored with the data block, but rather in the pointer to the block. All checksums are done in server memory, so errors not caught by other file systems are detected in ZFS, such as:&lt;br /&gt;
* Phantom writes, where the write is dropped on the floor.&lt;br /&gt;
* Misdirected reads or writes, where the disk accesses the wrong block.&lt;br /&gt;
* DMA parity errors between the array and server memory or from the driver, since the checksum validates data inside the array.&lt;br /&gt;
* Driver errors, where data winds up in the wrong buffer inside the kernel.&lt;br /&gt;
* Accidental overwrites, such as swapping to a live file system.&lt;br /&gt;
&lt;br /&gt;
In Lustre, ZFS checksumming will be done by the Lustre client on the application node. This will detect any data corruption introduced into the network between the application node and the disk drive in the Lustre storage system.&lt;br /&gt;
&lt;br /&gt;
Testing ZFS with Lustre has resulted in the detection of previously unknown problems in network cards. These cards silently introduced data corruption that went undetected without the use of ZFS. It should be noted that the checksum computation does consume some processor cycles, approximately 1 GHz of CPU time to process 500 MB/sec of I/O.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;An implementation note:&#039;&#039; Previously, ZFS support was being developed and tested with a user space implementation of the ZFS DMU. Currently, we are running the DMU in kernel space. Also, the Lustre DMU code is almost entirely common with the Solaris version of ZFS, so Lustre support for ZFS will closely parallel the Solaris release of ZFS.&lt;br /&gt;
&lt;br /&gt;
Lustre support of ZFS will offer several specific advantages:&lt;br /&gt;
* &#039;&#039;Self-healing capability&#039;&#039; - In a mirrored or RAID configuration, ZFS not only detects data corruption, but it automatically corrects the bad data.&lt;br /&gt;
* &#039;&#039;Improved administration&#039;&#039; - Because ZFS detects and reports data corruption on all read and write errors at the block level, it is easier for system administrators to quickly identify which hardware components are corrupting data. ZFS also has very easy-to-use command-line administration utilities.&lt;br /&gt;
* &#039;&#039;SSD support&#039;&#039; - ZFS supports the addition of high-speed I/O devices, such as SSDs, to the storage pool. The Read Cache Pool or L2ARC acts as a cache layer between memory and the disk. This support can substantially improve the performance of random read operations. SSDs can also be used to improve synchronous write performance, by adding them to the pool as log devices. You can add as many SDDs to your storage pool as you need to increase your read cache size and IOPS, your synchronous write IOPS, or both.&lt;br /&gt;
* &#039;&#039;Scalability&#039;&#039; - ZFS is a 128-bit file system. This means that current restrictions on maximum-size file systems for a single MDS or OST, maximum stripe size, and maximum size of a single file will be removed. ZFS support will also remove the current 8 TB limitation on LUNs.&lt;br /&gt;
&lt;br /&gt;
For more general information about ZFS, see [[ZFS Resources]].&lt;/div&gt;</summary>
		<author><name>Rcorreia</name></author>
	</entry>
	<entry>
		<id>http://wiki.old.lustre.org/index.php?title=ZFS_and_Lustre&amp;diff=8776</id>
		<title>ZFS and Lustre</title>
		<link rel="alternate" type="text/html" href="http://wiki.old.lustre.org/index.php?title=ZFS_and_Lustre&amp;diff=8776"/>
		<updated>2009-12-03T14:51:30Z</updated>

		<summary type="html">&lt;p&gt;Rcorreia: Updated text and added comments&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Lustre&#039;s current node file system &#039;&#039;ext3&#039;&#039; is limited to an 8 TB maximum file system size and offers no guarantee of data integrity. To improve the reliability and resilience of the underlying file system on the OSS and MDS components, Lustre will add ZFS support.&lt;br /&gt;
&lt;br /&gt;
Lustre supporting ZFS will offer a number of advantages, such as improved data integrity with transaction-based, copy-on-write operations and an end-to-end checksum on every block.&lt;br /&gt;
&lt;br /&gt;
Copy-on-write means that ZFS never overwrites existing data. Changed information is written to a new block and the block pointer to in-use data is only moved after the write transaction is completed. This mechanism is used all the way up to the file system block structure at the top block.&lt;br /&gt;
&lt;br /&gt;
To avoid data corruption, ZFS performs end-to-end checksumming. The checksum is not stored with the data block, but rather in the pointer to the block. All checksums are done in server memory, so errors not caught by other file systems are detected in ZFS, such as:&lt;br /&gt;
* Phantom writes, where the write is dropped on the floor.&lt;br /&gt;
* Misdirected reads or writes, where the disk accesses the wrong block.&lt;br /&gt;
* DMA parity errors between the array and server memory or from the driver, since the checksum validates data inside the array.&lt;br /&gt;
* Driver errors, where data winds up in the wrong buffer inside the kernel.&lt;br /&gt;
* Accidental overwrites, such as swapping to a live file system, are all detected by ZFS.&lt;br /&gt;
&lt;br /&gt;
In Lustre, ZFS checksumming will be done by the Lustre client on the application node. This will detect any data corruption introduced into the network between the application node and the disk drive in the Lustre storage system.&lt;br /&gt;
&lt;br /&gt;
Testing ZFS with Lustre has resulted in the detection of previously unknown problems in network cards. These cards silently introduced data corruption that went undetected without the use of ZFS. It should be noted that the checksum computation does consume some processor cycles, approximately 1 GHz of CPU time to process 500 MB/sec of I/O.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;An implementation note:&#039;&#039; Previously, ZFS support was being developed and tested with a user space implementation of the ZFS DMU. Currently, we are running the DMU in kernel space. Also, the Lustre DMU code is almost entirely common with the Solaris version of ZFS, so Lustre support for ZFS will closely parallel the Solaris release of ZFS.&lt;br /&gt;
&lt;br /&gt;
Lustre support of ZFS will offer several specific advantages:&lt;br /&gt;
* &#039;&#039;Self-healing capability&#039;&#039; - In a mirrored or RAID configuration, ZFS not only detects data corruption, but it automatically corrects the bad data.&lt;br /&gt;
* &#039;&#039;Improved administration&#039;&#039; - Because ZFS detects and reports data corruption on all read and write errors at the block level, it is easier for system administrators to quickly identify which hardware components are corrupting data. ZFS also has very easy-to-use command-line administration utilities.&lt;br /&gt;
* &#039;&#039;SSD support&#039;&#039; - ZFS supports the addition of high-speed I/O devices, such as SSDs, to the storage pool. The Read Cache Pool or L2ARC acts as a cache layer between memory and the disk. This support can substantially improve the performance of random read operations. SSDs can also be used to improve synchronous write performance, by adding them to the pool as log devices. You can add as many SDDs to your storage pool as you need to increase your read cache size and IOPS, your synchronous write IOPS, or both.&lt;br /&gt;
* &#039;&#039;Scalability&#039;&#039; - ZFS is a 128-bit file system. This means that current restrictions on maximum-size file systems for a single MDS or OST, maximum stripe size, and maximum size of a single file will be removed. ZFS support will also remove the current 8 TB limitation on LUNs.&lt;br /&gt;
&lt;br /&gt;
For more general information about ZFS, see [[ZFS Resources]].&lt;/div&gt;</summary>
		<author><name>Rcorreia</name></author>
	</entry>
	<entry>
		<id>http://wiki.old.lustre.org/index.php?title=Coding_Guidelines&amp;diff=4276</id>
		<title>Coding Guidelines</title>
		<link rel="alternate" type="text/html" href="http://wiki.old.lustre.org/index.php?title=Coding_Guidelines&amp;diff=4276"/>
		<updated>2008-02-25T13:55:57Z</updated>

		<summary type="html">&lt;p&gt;Rcorreia: /* Formatting Guidelines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;All Lustre developers should follow the guidelines in this page very strictly to avoid problems during code merges later on. Please make the required changes to the default formatting rules in the editor you use to comply to the guidelines below.&lt;br /&gt;
&lt;br /&gt;
== Beautiful Code ==&lt;br /&gt;
&lt;br /&gt;
More important than the physical layout of code (which is covered in detail below) is the thought that code is &#039;&#039;beautiful&#039;&#039; to read.  What makes code &amp;quot;beautiful&amp;quot; to me?  Fundamentally, I&#039;m talking about readability and obviousness - the code must not have secrets.&lt;br /&gt;
&lt;br /&gt;
* Separate &amp;quot;ideas&amp;quot; are clearly separated in the program layout -   e.g. blank lines group related statements and separate unrelated statements.&lt;br /&gt;
&lt;br /&gt;
* Declarations are easy to read.  The declarations should always be separated from the functional code.  Declarations should be made as locally as possible to the code they are being used.  I prefer one variable per line, with the names aligned vertically - it makes checking types as you read quicker and IMHO it&#039;s a pleasure to the eye.&lt;br /&gt;
&lt;br /&gt;
* If it&#039;s a choice between breaking the 80-chars-per-line rule and code that doesn&#039;t look good (e.g. breaks indentation rules or doesn&#039;t visually contain procedure call parameters between the brackets or spreads over too many lines), then break the 80-chars-per-line rule.  We _don&#039;t_ want stupidly long lines, but we all have enough screen resolution these days to not have to wrap lines at 80 chars.&lt;br /&gt;
&lt;br /&gt;
* Names are well chosen.  &#039;&#039;&amp;quot;Does exactly what it says on the tin&amp;quot;&#039;&#039; is an English (UK) expression describing something that tells you what it&#039;s going to do and then does _exactly_ that.  For example, when I open a box labelled &amp;quot;soap&amp;quot;, I expect it to help me wash and maybe even smell nice.  I&#039;ll get upset if it&#039;s no good at removing dirt, and really upset if it makes me break out in a rash.  The name of a procedure or variable or structure member should tell you something about the entity, without giving you misleading information - just &amp;quot;what it says on the tin&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Names are well chosen.  This time I mean that you don&#039;t choose names that easily become a different but valid (to the compiler) name if you make a spelling mistake.  &#039;&#039;&#039;i&#039;&#039;&#039; and &#039;&#039;&#039;j&#039;&#039;&#039; aren&#039;t the worst example - &#039;&#039;&#039;req_portal&#039;&#039;&#039; and &#039;&#039;&#039;rep_portal&#039;&#039;&#039; are much worse (and taken from our own code!!!).&lt;br /&gt;
&lt;br /&gt;
* Names are well chosen.  Don&#039;t be scared of long names, but_do_not_go_to_extremes_either - we don&#039;t write COBOL.&lt;br /&gt;
&lt;br /&gt;
* Names are well chosen.  I can&#039;t emphasise this issue enough - I hope you get the point.&lt;br /&gt;
&lt;br /&gt;
* Intelligent use of assertions.  Assertions can be abused.  Obviously, when over-used they hurt performance.  And they can also make you think that the code author didn&#039;t know what she was doing and added them to help her &#039;&#039;learn&#039;&#039; the code.  But when assertions are used properly, they combine the roles of &#039;&#039;active comment&#039;&#039; and &#039;&#039;software fuse&#039;&#039;.  As an &#039;&#039;active comment&#039;&#039; they tell you something about the program which you can trust more than a comment.  As a &#039;&#039;software fuse&#039;&#039;, they provide fault isolation between subsystem by letting you know when and where invariant assumptions are violated.&lt;br /&gt;
&lt;br /&gt;
I could go on, but I hope you get the idea.  Notice that I didn&#039;t mention &#039;&#039;clever&#039;&#039; as a desirable attribute.  It&#039;s only one step from&lt;br /&gt;
&#039;&#039;clever&#039;&#039; to &#039;&#039;tricky&#039;&#039; - consider...&lt;br /&gt;
&lt;br /&gt;
   t = a; a = b; b = t; /* dumb swap */&lt;br /&gt;
&lt;br /&gt;
   a ^= b; b ^= a; a ^= b;  /* clever swap */&lt;br /&gt;
&lt;br /&gt;
...which is a very minor example.  It can almost be excused, because the &amp;quot;cleverness&amp;quot; is confined to a tiny part of the code.  But if the &#039;&#039;clever&#039;&#039; code had sub-structure, that sub-structure would be very hard to work on.  You can&#039;t be sure you&#039;re not screwing something up until you understand completely the environment in which you&#039;re working.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.&#039;&#039; - [http://en.wikipedia.org/wiki/Brian_Kernighan  Brian W. Kernighan]&lt;br /&gt;
&lt;br /&gt;
IMHO, beautiful code helps code quality because it improves communication between the code author and the code reader.  Since code modifiers are also code readers, the quality of communication can lead either to a virtuous circle of improving quality, or a vicious circle of degrading quality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Formatting Guidelines ==&lt;br /&gt;
&lt;br /&gt;
1. There should be no tabs in any Lustre or LNET files.  The exceptions are libsysio (maintained by someone else), ldiskfs and kernel patches (also part of a non-CFS project).&lt;br /&gt;
&lt;br /&gt;
2. Blocks should be indented by 8 spaces.&lt;br /&gt;
&lt;br /&gt;
3. New files should contain the following along with the license boilerplate.  This will cause vim and emacs to use spaces instead of tabs for indenting.  If you use a different editor, it also needs to be set to use spaces for indening Lustre code.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background:lightgrey;&amp;quot;&amp;gt;&lt;br /&gt;
  /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-&lt;br /&gt;
   * vim:expandtab:shiftwidth=8:tabstop=8:&lt;br /&gt;
   */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
4. All lines should wrap at 80 characters. If it&#039;s getting too hard to wrap there, you probably need to break it up into more functions.  In some cases, it is acceptable to remove a few spaces between function arguments to avoid overflowing onto the next line.&lt;br /&gt;
&lt;br /&gt;
5. Don&#039;t have spaces or tabs on blank lines or at the end of lines.  Find these with some regexps in your patch (grep, or in vim) before attaching it to bugzilla:&lt;br /&gt;
&lt;br /&gt;
 /[ \t]$/&lt;br /&gt;
&lt;br /&gt;
Alternatively, if you use vim you can put this line in your vimrc file, which will highlight whitespace at the end of lines and spaces followed by tabs in indentation (only works for C/C++ files):&lt;br /&gt;
&lt;br /&gt;
 let c_space_errors=1&lt;br /&gt;
&lt;br /&gt;
Or you can use this command, which will make tabs and whitespace at the end of lines visible for all files (but a bit more discretely):&lt;br /&gt;
&lt;br /&gt;
 set list listchars=tab:&amp;gt;\ ,trail:$&lt;br /&gt;
&lt;br /&gt;
In emacs, you can use (whitespace-mode) or (whitespace-visual-mode) depending on version. You should also consider using (flyspell-prog-mode).&lt;br /&gt;
&lt;br /&gt;
6. Don&#039;t use &amp;quot;inline&amp;quot; unless you&#039;re doing something so performance critical that the function call overhead will make a difference -- in other words: never.  It makes debugging harder.&lt;br /&gt;
&lt;br /&gt;
All of our wrapping, parenthesis, brace placement, etc. rules are basically Linux kernel rules, which are basically K&amp;amp;R. For those of you in need of a refresher, great detail is provided below.&lt;br /&gt;
&lt;br /&gt;
7. For Autoconf macros, follow the [http://www.gnu.org/software/autoconf/manual/html_node/Coding-Style.html style suggested in the autoconf manual].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     AC_CACHE_CHECK([for EMX OS/2 environment], [ac_cv_emxos2],&lt;br /&gt;
     [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return __EMX__;])],&lt;br /&gt;
                        [ac_cv_emxos2=yes],&lt;br /&gt;
                        [ac_cv_emxos2=no])])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or even&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     AC_CACHE_CHECK([for EMX OS/2 environment],&lt;br /&gt;
                    [ac_cv_emxos2],&lt;br /&gt;
                    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],&lt;br /&gt;
                                                        [return __EMX__;])],&lt;br /&gt;
                                       [ac_cv_emxos2=yes],&lt;br /&gt;
                                       [ac_cv_emxos2=no])])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Great detail ==&lt;br /&gt;
&lt;br /&gt;
a. When you wrap, the next line should start after the parenthesis:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background:lightgrey;&amp;quot;&amp;gt;&lt;br /&gt;
  right:&lt;br /&gt;
 &lt;br /&gt;
  variable = do_something_complicated(long_argument, longer_argument,&lt;br /&gt;
                                      longest_argument(sub_argument,&lt;br /&gt;
                                                       foo_argument),&lt;br /&gt;
                                      last_argument);&lt;br /&gt;
 &lt;br /&gt;
  if (some_long_condition(arg1, arg2, arg3) &amp;lt; some_long_value &amp;amp;&amp;amp;&lt;br /&gt;
      another_long_condition(very_long_argument_name,&lt;br /&gt;
                             another_long_argument_name) &amp;gt;&lt;br /&gt;
      second_long_value) {&lt;br /&gt;
  }&lt;br /&gt;
                             &lt;br /&gt;
 &lt;br /&gt;
  wrong:&lt;br /&gt;
 &lt;br /&gt;
  variable = do_something_complicated(long_argument, longer_argument,&lt;br /&gt;
                    longest_argument(sub_argument, foo_argument),&lt;br /&gt;
                    last_argument);&lt;br /&gt;
 &lt;br /&gt;
  if (some_long_condition(arg1, arg2, arg3) &amp;lt; some_long_value &amp;amp;&amp;amp;&lt;br /&gt;
              another_long_condition(very_long_argument_name,&lt;br /&gt;
                    another_long_argument_name) &amp;gt;&lt;br /&gt;
                    second_long_value) {&lt;br /&gt;
  }&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
b. If you&#039;re wrapping put the operators at the end of the line, and if there are no parentheses indent 8 more:&lt;br /&gt;
 &amp;lt;pre style=&amp;quot;background:lightgrey;&amp;quot;&amp;gt;&lt;br /&gt;
  off = le32_to_cpu(fsd-&amp;gt;fsd_client_start) +&lt;br /&gt;
          cl_idx * le16_to_cpu(fsd-&amp;gt;fsd_client_size);&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
c. Binary and ternary (but not unary) operators should be separated from their arguments by one space.&lt;br /&gt;
 &amp;lt;pre style=&amp;quot;background:lightgrey;&amp;quot;&amp;gt;&lt;br /&gt;
  a++;&lt;br /&gt;
  b |= c;&lt;br /&gt;
  d = f &amp;gt; g ? 0 : 1;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
d. Function calls should be nestled against the parentheses, the parentheses should crowd the arguments, and one space after commas:&lt;br /&gt;
 &amp;lt;pre style=&amp;quot;background:lightgrey;&amp;quot;&amp;gt;&lt;br /&gt;
  right: do_foo(bar, baz);&lt;br /&gt;
  wrong: do_foo ( bar,baz );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
e. All &#039;&#039;if&#039;&#039;, &#039;&#039;for&#039;&#039;, &#039;&#039;while&#039;&#039;, etc. expressions should be separated by a space from the parenthesis, one space after the semicolons:&lt;br /&gt;
 &amp;lt;pre style=&amp;quot;background:lightgrey;&amp;quot;&amp;gt;&lt;br /&gt;
  for (a = 0; a &amp;lt; b; a++)&lt;br /&gt;
  if (a &amp;lt; b || a == c)&lt;br /&gt;
  while (1)&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
f. Opening braces should be on the same line as the line that introduces the block, except for function calls.  Closing braces get their own line, except for &amp;quot;else&amp;quot;.&lt;br /&gt;
 &amp;lt;pre style=&amp;quot;background:lightgrey;&amp;quot;&amp;gt;&lt;br /&gt;
  int foo(void)&lt;br /&gt;
  {&lt;br /&gt;
          if (bar) {&lt;br /&gt;
                  this();&lt;br /&gt;
                  that();&lt;br /&gt;
          } else if (baz) {&lt;br /&gt;
                  ;&lt;br /&gt;
          } else {&lt;br /&gt;
                  ;&lt;br /&gt;
          }&lt;br /&gt;
          do {&lt;br /&gt;
                  cow();&lt;br /&gt;
          } while (0);&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
g. If one part of a compound &#039;&#039;if&#039;&#039; block has braces, all should.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background:lightgrey;&amp;quot;&amp;gt;&lt;br /&gt;
  right:&lt;br /&gt;
 &lt;br /&gt;
  if (foo) {&lt;br /&gt;
          bar();&lt;br /&gt;
          baz();&lt;br /&gt;
  } else {&lt;br /&gt;
          salmon();&lt;br /&gt;
  }&lt;br /&gt;
 &lt;br /&gt;
  wrong:&lt;br /&gt;
 &lt;br /&gt;
  if (foo) {&lt;br /&gt;
          bar();&lt;br /&gt;
          baz();&lt;br /&gt;
  } else&lt;br /&gt;
          moose();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
h. When you make a macro, protect those who might call it by using do/while and parentheses; line up your backslashes:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background:lightgrey;&amp;quot;&amp;gt;&lt;br /&gt;
  right:&lt;br /&gt;
 &lt;br /&gt;
  #define DO_STUFF(a)                              \&lt;br /&gt;
  do {                                             \&lt;br /&gt;
          int b = (a) + MAGIC;                     \&lt;br /&gt;
          do_other_stuff(b);                       \&lt;br /&gt;
  } while (0)&lt;br /&gt;
 &lt;br /&gt;
  wrong:&lt;br /&gt;
 &lt;br /&gt;
  #define DO_STUFF(a) \&lt;br /&gt;
  { \&lt;br /&gt;
          int b = a + MAGIC; \&lt;br /&gt;
          do_other_stuff(b); \&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
i. If you nest preprocessor commands, use spaces to visually delineate:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background:lightgrey;&amp;quot;&amp;gt;&lt;br /&gt;
  #ifdef __KERNEL__&lt;br /&gt;
  # include &amp;lt;goose&amp;gt;&lt;br /&gt;
  # define MOOSE steak&lt;br /&gt;
  #else&lt;br /&gt;
  # include &amp;lt;mutton&amp;gt;&lt;br /&gt;
  # define MOOSE prancing&lt;br /&gt;
  #endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
j.  For very long #ifdefs include the conditional with each #endif to make it readable:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background:lightgrey;&amp;quot;&amp;gt;&lt;br /&gt;
  #ifdef __KERNEL__&lt;br /&gt;
  # if LINUX_VERSION_CODE &amp;gt;= KERNEL_VERSION(2,5,0)&lt;br /&gt;
  /* lots&lt;br /&gt;
     of&lt;br /&gt;
     stuff */&lt;br /&gt;
  # endif /* KERNEL_VERSION(2,5,0) */&lt;br /&gt;
  #else /* !__KERNEL__ */&lt;br /&gt;
  # if HAVE_FEATURE&lt;br /&gt;
  /* more&lt;br /&gt;
   * stuff */&lt;br /&gt;
  # endif&lt;br /&gt;
  #endif /* __KERNEL__ */ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
k. Comments should have the leading &#039;&#039;&#039;/*&#039;&#039;&#039; on the same line as the comment, and the trailing &#039;&#039;&#039;*/&#039;&#039;&#039; at the end of the last comment line.  Intermediate lines should start with a &#039;&#039;&#039;*&#039;&#039;&#039; aligned with the first line&#039;s &#039;&#039;&#039;*&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background:lightgrey;&amp;quot;&amp;gt; &lt;br /&gt;
 /* This is a short comment */&lt;br /&gt;
 &lt;br /&gt;
  /* This is a multi-line comment.  I wish the line would wrap already,&lt;br /&gt;
   * as I don&#039;t have much to write about. */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
l. Function declarations absolutely should NOT go into .c files, unless they are forward declarations for static functions that can&#039;t otherwise be moved before the caller.  Instead, the declaration should go into the most &amp;quot;local&amp;quot; header available (preferrably *_internal.h for a given piece of code).&lt;br /&gt;
&lt;br /&gt;
m. Structure and constant declarations should not be declared in multiple places.  Put the struct into the most &amp;quot;local&amp;quot; header possible.  If it is something that is passed over the wire it needs to go into lustre_idl.h, and needs to be correctly swabbed when the RPC message is unpacked.&lt;br /&gt;
&lt;br /&gt;
n. The types and printf/printk formats used by Lustre code are:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background:lightgrey;&amp;quot;&amp;gt;&lt;br /&gt;
   __u64                 LPU64/LPX64/LPD64 (unsigned, hex, signed)&lt;br /&gt;
   size_t                LPSZ (or cast to int and use %u / %d)&lt;br /&gt;
   __u32/int             %u/%x/%d (unsigned, hex, signed)&lt;br /&gt;
   (unsigned) long long  %llu/%llx/%lld&lt;br /&gt;
   loff_t                %lld after a cast to long long (unfortunately)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
*&#039;&#039;&#039;[http://wiki.lustre.org/index.php?title=Front_Page FrontPage]&#039;&#039;&#039;&lt;br /&gt;
&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Rcorreia</name></author>
	</entry>
</feed>