a:3:{s:7:"#markup";O:25:"Drupal\Core\Render\Markup":1:{s:9:"*string";s:9971:"<span property="schema:name">Yaffs 2 Specification</span>

            <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item">
<h2>Summary</h2>
<p>The original motivation for Yaffs 2 was to add support for the new NAND with 2kB pages instead of 512-byte pages and strictly sequential page writing order.</p>
<p>To achieve this, a new design is used which also realises the following benefits:</p>
<ul>
<li>
<p>Zero page rewrites means faster operation. (Yaffs1 uses a single rewrite in the spare area to delete a page).</p>
 </li>
<li>
<p>Ability to exploit simultaneous page programming on some chips.</p>
 </li>
<li>
<p>Improves performance relative to Yaffs1 speed(write:1.5x to 5x, delete: 4x, garbage collection: 2x)</p>
 </li>
<li>
<p>Lower RAM footprint (approx. 25% to 50% of Yaffs1).</p>
 </li>
<li>
<p>Can support Toshiba/Sandisk MLC parts.</p>
 </li>
</ul>
<p>Most of Yaffs1 and Yaffs2 code is common, therefore the code will likely be kept common with Yaffs1 vs Yaffs2 being run-time selected.</p>
<h4>Method</h4>
<p>The main philosophical difference between Yaffs&nbsp;and Yaffs2 is how discarded status is tracked. Since we can't do any re-writing, we can't use the "discarded" flags in Yaffs2.</p>
<p>Instead Yaffs2 uses two mechanisms to resolve data state.</p>
<ul>
<li>
<p>Yaffs2 chunks have more tag information, including a block sequence Id. From that we can determine the chunk sequence Id since the chunks are allocated sequentially in a block. Thus we always know the patch order for all chunks in the system.</p>
 </li>
<li>
<p>The above helps us track stale -vs- fresh data, but does not help determine when a file/object is deleted. Deletion is achieved by moving the object to the "unlinked" directory. We also keep track of the number of chunks (both stale and current) in the system for each object. While this number indicates that there are still chunks associated with this object we keep the deletion record. When the last trace of the object has been really erased from NAND, we can forget about the deletion record too.</p>
 </li>
<li>
<p>Since there is no deletion, a resize (shrinking) of a file will still have valid data chunks past the end of file on the NAND. However, we write a new ObjectHeader at the time of the resize, therefore this shows the shrunken file size.</p>
 </li>
</ul>
<p>This changes erasure slightly:</p>
<ul>
<li>
<p>During garbage collection we can't just look at chunk state flags, instead we must read the tags of each chunk to determine which object's chunk count we must decrement. This step must also be performed when a block is erased (as part of deletion).</p>
 </li>
</ul>
<p>This makes erasure &amp; garbage collection more expensive (by adding reads), but remember that ion Yaffs2 we don't need to do page deletions which are much more expensive operations. Thus, all-up Yaffs2 wins.</p>
<h4>Tag structure</h4>
<p>Each chunk in Yaffs2 has the following information:</p>
<p>Field</p>
<p>Comment</p>
<p>Size for 1kb chunks</p>
<p>Size for 2kB chunks</p>
<table>
<tbody>
 <tr>
 </tr>
 <tr>
  <td>
  <p>blockState</p>
   </td>
  <td>
  <p>Block state. non-0xFF for bad block</p>
   </td>
  <td>
  <p>1 byte</p>
   </td>
  <td>
  <p>1 byte</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>chunkId</p>
   </td>
  <td>
  <p>32-bit chunk Id</p>
   </td>
  <td>
  <p>4 bytes</p>
   </td>
  <td>
  <p>4 bytes</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>objectId</p>
   </td>
  <td>
  <p>32-bit object Id</p>
   </td>
  <td>
  <p>4 bytes</p>
   </td>
  <td>
  <p>4 bytes</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>nBytes</p>
   </td>
  <td>
  <p>Number of data bytes in this chunk</p>
   </td>
  <td>
  <p>2 bytes</p>
   </td>
  <td>
  <p>2 bytes</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>blockSequence</p>
   </td>
  <td>
  <p>sequence number for this block</p>
   </td>
  <td>
  <p>4 bytes</p>
   </td>
  <td>
  <p>4 bytes</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>tagsEcc</p>
   </td>
  <td>
  <p>ECC on tags area</p>
   </td>
  <td>
  <p>3 bytes</p>
   </td>
  <td>
  <p>3 bytes</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>ecc</p>
   </td>
  <td>
  <p>ECC, 3 bytes/256 bytes of data</p>
   </td>
  <td>
  <p>12 bytes</p>
   </td>
  <td>
  <p>24 bytes</p>
   </td>
 </tr>
 <tr>
  <td>
  <p><strong>Total</strong></p>
   </td>
  <td>
  <p>&nbsp;</p>
   </td>
  <td>
  <p><strong>30 bytes</strong></p>
   </td>
  <td>
  <p><strong>42 bytes</strong></p>
   </td>
 </tr>
</tbody>
</table>
<p><br />
&nbsp;</p>
<p>To get enough spare bytes for this tagging structure requires a chunk-size of at least 1kB.</p>
<p>The blockSequence increments each time a block is allocated. (ie. the first block allocated is block 1, and so on).</p>
<h4>Scanning</h4>
<p>The only reason we need to keep track of data status on NAND is to be able to recreate the file system state during scanning. Since we no longer have chunk deletion status flags we use a slightly different process for scanning a Yaffs2 system.</p>
<p>In effect, Yaffs2 recreates its state by "replaying the tape". ie. it scans the chunks in their allocation order (block sequence Id order) rather than in their order on the media. This implies that at start up, the blocks must be read and their block sequence determined.</p>
<h4>Performance</h4>
<p>Times for 2kB read(units of 1uS).</p>
<p>Operation</p>
<p>Yaffs1</p>
<p>Yaffs2 (512b pages)</p>
<p>Yaffs2 (2kB pages)</p>
<p>Yaffs2(2kB pages, x16)</p>
<table>
<tbody>
 <tr>
 </tr>
 <tr>
  <td>
  <p>Seek</p>
   </td>
  <td>
  <p>40</p>
   </td>
  <td>
  <p>40</p>
   </td>
  <td>
  <p>10</p>
   </td>
  <td>
  <p>10</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>Read</p>
   </td>
  <td>
  <p>220</p>
   </td>
  <td>
  <p>220</p>
   </td>
  <td>
  <p>220</p>
   </td>
  <td>
  <p>110</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>Total</p>
   </td>
  <td>
  <p>260</p>
   </td>
  <td>
  <p>260</p>
   </td>
  <td>
  <p>230</p>
   </td>
  <td>
  <p>120</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>MB/s</p>
   </td>
  <td>
  <p>7.6</p>
   </td>
  <td>
  <p>7.6</p>
   </td>
  <td>
  <p>8.7</p>
   </td>
  <td>
  <p>16.7</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>Relative speed</p>
   </td>
  <td>
  <p>1</p>
   </td>
  <td>
  <p>1</p>
   </td>
  <td>
  <p>1.1</p>
   </td>
  <td>
  <p>2.2</p>
   </td>
 </tr>
</tbody>
</table>
<p><br />
&nbsp;</p>
<p>Times for 2kB writes(units of 1uS).</p>
<p>Operation</p>
<p>Yaffs1</p>
<p>Yaffs2 (512b pages)</p>
<p>Yaffs2 (2kB pages)</p>
<p>Yaffs2(2kB pages, x16)</p>
<table>
<tbody>
 <tr>
 </tr>
 <tr>
  <td>
  <p>Seek</p>
   </td>
  <td>
  <p>40</p>
   </td>
  <td>
  <p>40</p>
   </td>
  <td>
  <p>10</p>
   </td>
  <td>
  <p>10</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>Program</p>
   </td>
  <td>
  <p>800</p>
   </td>
  <td>
  <p>800</p>
   </td>
  <td>
  <p>200</p>
   </td>
  <td>
  <p>200</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>Seek</p>
   </td>
  <td>
  <p>40</p>
   </td>
  <td>
  <p>40</p>
   </td>
  <td>
  <p>10</p>
   </td>
  <td>
  <p>10</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>Read</p>
   </td>
  <td>
  <p>220</p>
   </td>
  <td>
  <p>220</p>
   </td>
  <td>
  <p>220</p>
   </td>
  <td>
  <p>110</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>Total</p>
   </td>
  <td>
  <p>1320</p>
   </td>
  <td>
  <p>1320</p>
   </td>
  <td>
  <p>660</p>
   </td>
  <td>
  <p>440</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>MB/s</p>
   </td>
  <td>
  <p>1.5</p>
   </td>
  <td>
  <p>1.5</p>
   </td>
  <td>
  <p>3</p>
   </td>
  <td>
  <p>4.5</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>Relative speed</p>
   </td>
  <td>
  <p>1</p>
   </td>
  <td>
  <p>1</p>
   </td>
  <td>
  <p>2</p>
   </td>
  <td>
  <p>3</p>
   </td>
 </tr>
</tbody>
</table>
<p><br />
&nbsp;</p>
<p>Times for 1MB delete (units of 1uS).</p>
<p>Operation</p>
<p>Yaffs1</p>
<p>Yaffs2 (512b pages)</p>
<p>Yaffs2 (2kB pages)</p>
<p>Yaffs2(2kB pages, x16)</p>
<table>
<tbody>
 <tr>
 </tr>
 <tr>
  <td>
  <p>Seek</p>
   </td>
  <td>
  <p>20480</p>
   </td>
  <td>
  <p>0</p>
   </td>
  <td>
  <p>0</p>
   </td>
  <td>
  <p>0</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>Program</p>
   </td>
  <td>
  <p>409600</p>
   </td>
  <td>
  <p>0</p>
   </td>
  <td>
  <p>0</p>
   </td>
  <td>
  <p>0</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>Erase</p>
   </td>
  <td>
  <p>128000</p>
   </td>
  <td>
  <p>128000</p>
   </td>
  <td>
  <p>16000</p>
   </td>
  <td>
  <p>16000</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>Total</p>
   </td>
  <td>
  <p>558080</p>
   </td>
  <td>
  <p>128000</p>
   </td>
  <td>
  <p>16000</p>
   </td>
  <td>
  <p>16000</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>MB/s</p>
   </td>
  <td>
  <p>1.8</p>
   </td>
  <td>
  <p>7.8</p>
   </td>
  <td>
  <p>62.5</p>
   </td>
  <td>
  <p>62.5</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>Relative speed</p>
   </td>
  <td>
  <p>1</p>
   </td>
  <td>
  <p>4</p>
   </td>
  <td>
  <p>34</p>
   </td>
  <td>
  <p>34</p>
   </td>
 </tr>
</tbody>
</table>
<p><br />
&nbsp;</p>
<p>Times for 1MB of garbage collection at 50% dirty (units of 1uS).</p>
<p>Operation</p>
<p>Yaffs1</p>
<p>Yaffs2 (512b pages)</p>
<p>Yaffs2 (2kB pages)</p>
<p>Yaffs2(2kB pages, x16)</p>
<table>
<tbody>
 <tr>
 </tr>
 <tr>
  <td>
  <p>Delete 1MB</p>
   </td>
  <td>
  <p>558080</p>
   </td>
  <td>
  <p>128000</p>
   </td>
  <td>
  <p>16000</p>
   </td>
  <td>
  <p>16000</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>Write 0.5MB</p>
   </td>
  <td>
  <p>337920</p>
   </td>
  <td>
  <p>337920</p>
   </td>
  <td>
  <p>168960</p>
   </td>
  <td>
  <p>112640</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>Total</p>
   </td>
  <td>
  <p>896000</p>
   </td>
  <td>
  <p>465920</p>
   </td>
  <td>
  <p>184960</p>
   </td>
  <td>
  <p>128640</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>MB/s</p>
   </td>
  <td>
  <p>1.1</p>
   </td>
  <td>
  <p>2.1</p>
   </td>
  <td>
  <p>5.4</p>
   </td>
  <td>
  <p>7.7</p>
   </td>
 </tr>
 <tr>
  <td>
  <p>Relative speed</p>
   </td>
  <td>
  <p>1</p>
   </td>
  <td>
  <p>1.9</p>
   </td>
  <td>
  <p>4.9</p>
   </td>
  <td>
  <p>7</p>
   </td>
 </tr>
</tbody>
</table>
<p><br />
&nbsp;</p>
</div>
      ";}s:9:"#attached";a:0:{}s:6:"#cache";a:3:{s:8:"contexts";a:4:{i:0;s:28:"languages:language_interface";i:1;s:5:"theme";i:2;s:17:"url.path.is_front";i:3;s:16:"user.permissions";}s:4:"tags";a:3:{i:0;s:30:"config:filter.format.full_html";i:1;s:7:"node:38";i:2;s:9:"node_view";}s:7:"max-age";i:-1;}}