('entity_view:node:37:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b018DCui2JOvzO-vVcmbFbSbtoR2WAcfA4lQtWBMJxuSH0','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:33144:\"<article role=\"article\" about=\"/archives/yaffs-original-specification\" typeof=\"schema:WebPage\" class=\"page is-sticky full clearfix\">\n\n  \n      <span property=\"schema:name\" content=\"Yaffs Original Specification\" class=\"hidden\"></span>\n\n\n  \n  <div class=\"content\">\n    \n            <div property=\"schema:text\" class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p>YAFFS (Yet Another Flash File System)</p>\n\n<h4>Version 0.3</h4>\n\n<h4>Charles Manning (and Wookey), December 2001</h4>\n\n<p><br />\n </p>\n\n<h2>Revision History</h2>\n\n<p>V0.0 20/12/01 First Draft</p>\n\n<table><tr><td>\n			<p>V0.1</p>\n			</td>\n			<td>\n			<p>11/01/02</p>\n			</td>\n			<td>\n			<p>Minor corrections &amp; cosmetics.<br />\n			Change use of data status byte.</p>\n			</td>\n		</tr><tr><td>\n			<p>V0.2</p>\n			</td>\n			<td>\n			<p>28/01/02</p>\n			</td>\n			<td>\n			<p>Added observations about inodes, file headers and hard links.</p>\n			</td>\n		</tr><tr><td>\n			<p>V0.3</p>\n			</td>\n			<td>\n			<p>26/02/02</p>\n			</td>\n			<td>\n			<p>W:Added some general observations on compatibility, partitions and bootloading.</p>\n			</td>\n		</tr></table><p><br />\n </p>\n\n<h2>Scope</h2>\n\n<p>The purpose of this document is to outline a potential NAND-friendly file system for Linux.</p>\n\n<h2>Background</h2>\n\n<p>There are already various flash-file systems (FFSs) or block drivers for flash (on top of which a regular FS runs). There are pros and cons with all of these.</p>\n\n<p>Flash memory has quite a few constraints which will not be addressed here. Various approaches are available to work around these constraints to provide a file system. It is important to recognise that \"flash\" includes both NOR and NAND flash which have different sets of constraints. It is easy to be mislead by the generic term \"flash\" into thinking that approaches appropriate for NOR flash are immediately suitable for NAND flash.</p>\n\n<p>The NAND block drivers (eg. SmartMedia [currently not available for Linux] and DiskOnChip NFTL) typically use FAT16 as the file system. This isn\'t too robust and nor is it that flash-friendly. These block drivers provide a logical to physical mapping layer to emulate rewritable blocks that look like disk sectors. When used with FAT16, these file systems work reasonably well. They have a low memory footprint and scale well. Like all FAT based systems they are prone to corruption (\"lost clusters etc\").</p>\n\n<p>The other approach is to design an entire file system which does not work through a block driver layer and is flash-friendly. This allows more scope to work around issues.</p>\n\n<p>Currently, two Linux file systems that support NOR flash very well are JFFS and its derivative JFFS2. Both of these are based on the principles of journaling (hence the leading J) which significantly increases robustness - a particularly important feature in embedded systems. Unfortunately neither of these file systems scale particularly well in both boot time and RAM usage. Scaling is particularly relevant when one considers that a 16MB NOR array would be considered large while a 128MB NAND is available as a single chip.</p>\n\n<p>JFFS requires a RAM-based jffs_node structure for each journalling node in the flash. Each of these nodes is 48 bytes. JFFS2 makes a significant improvement here by reducing the equivalent structure (jffs2_raw_node_ref) to 16 bytes. Still, at say an average node-size of 512 bytes, a 128MB NAND might need 250000 of these ... 4MB!</p>\n\n<p>Both JFFS and JFFS2 require scanning the flash array at boot time to find the journaling nodes and determine the file structures. Since NAND is large, slow, serially accessed and needs ECC this does not scale well and will take an unacceptably long boot time for the target systems. As a thumb-suck, the scanning of a 128MB NAND array might take approx 25 seconds.</p>\n\n<p>The intentions of the design sketched here are:</p>\n\n<ul><li>\n	<p>Be NAND-flash friendly.</p>\n	</li>\n	<li>\n	<p>Robustness through journaling strategies.</p>\n	</li>\n	<li>\n	<p>Significantly reduce the RAM overheads and boot times associated with JFFSx.</p>\n	</li>\n</ul><p>This FS is intended primarily for internal NAND rather than removable NAND (SM cards). On removable SM cards Smartmedia compatibility is likely to be important so SM/FAT will normally be used, although of course YAFFS makes a lot of sense if reliability is more important than compatibility.</p>\n\n<h2>Overview</h2>\n\n<p>Here follows a simplified overview of YAFFS.</p>\n\n<p>YAFFS uses a physical flash format similar to SmartMedia. This is done for various reasons:</p>\n\n<ul><li>\n	<p>Some of the formatting, eg placement of bad block markers is determined by the NAND manufacturers and can\'t be changed.</p>\n	</li>\n	<li>\n	<p>Potential to reuse code.</p>\n	</li>\n	<li>\n	<p>If it ain\'t broke don\'t fix.</p>\n	</li>\n</ul><p>Some of the fields are obviously different to reflect the different usage. Despite the similarities YAFFS is not actually compatible with SM/FAT. SM cards need to be reformatted to switch from using SM/FAT to YAFFS or vice versa.</p>\n\n<p>File data is stored in fixed size \"chunks\" consistent with the size of a page (ie. 512 bytes). Each page is marked with a file id and chunk number. These tags are stored in the \"spare data\" region of the flash. The chunk number is determined by dividing the file position by the chunk size.</p>\n\n<p>When data in a file is overwritten, the relevant chunks are replaced by writing new pages to flash containing the new data but the same tags. The overwritten data is marked as \"discarded\".</p>\n\n<p>File \"headers\" are stored as a single page, marked so as to be differentiated from data pages.</p>\n\n<p>Pages are also marked with a short (2 bit) serial number that increments each time the page at this position is incremented. The reason for this is that if power loss/crash/other act of demonic forces happens before the replaced page is marked as discarded, it is possible to have two pages with the same tags. The serial number is used to arbitrate.</p>\n\n<p>A block containing only discarded pages (termed a <em>dirty block</em>) is an obvious candidate for garbage collection. Otherwise valid pages can be copied off a block thus rendering the whole block discarded and ready for garbage collection.</p>\n\n<p>In theory you don\'t need to hold the file structure in RAM... you could just scan the whole flash looking for pages when you need them. In practice though you\'d want better file access times than that! The mechanism proposed here is to have a list of __u16 page addresses associated with each file. Since there are 218 pages in a 128MB NAND, a __u16 is insufficient to uniquely identify a page but is does identify a group of 4 pages - a small enough region to search exhaustively. This mechanism is clearly expandable to larger NAND devices - within reason. The RAM overhead with this approach is approx 2 bytes per page - 512kB of RAM for a whole 128MB NAND.</p>\n\n<p>Boot-time scanning to build the file structure lists should require just one pass reading NAND. Since only the the spare data needs to be read, this should be relatively fast ( approx 3 seconds for 128MB). Improvements can be achieved by partitioning the NAND. ie. mount the critical partition first then mount the data partition afterwards.</p>\n\n<p>Various runtime improvements can be achieved by changing the \"chunk size\" to 1024 bytes or more. However this would likely reduce flash efficiency. As always, life is a compromise....</p>\n\n<p><br />\n </p>\n\n<h3>Spare area details</h3>\n\n<p>The following table summarizes the layout of the spare area of each page.</p>\n\n<p>Byte #SmartMedia usageYAFFS usage</p>\n\n<table><tr><td>\n			<p>0..511</p>\n			</td>\n			<td>\n			<p>Data</p>\n			</td>\n			<td>\n			<p>Data. either file data or file header depending on tags</p>\n			</td>\n		</tr><tr><td>\n			<p>512..515</p>\n			</td>\n			<td>\n			<p>Reserved</p>\n			</td>\n			<td>\n			<p>Tags</p>\n			</td>\n		</tr><tr><td>\n			<p>516</p>\n			</td>\n			<td>\n			<p>Data status byte. Not used in SM code from Samsung</p>\n			</td>\n			<td>\n			<p>Data status byte. If more than 4 bits are zero, then this page is discarded.</p>\n			</td>\n		</tr><tr><td>\n			<p>517</p>\n			</td>\n			<td>\n			<p>Block status byte</p>\n			</td>\n			<td>\n			<p>Block status byte</p>\n			</td>\n		</tr><tr><td>\n			<p>518..519</p>\n			</td>\n			<td>\n			<p>Block address</p>\n			</td>\n			<td>\n			<p>Tags</p>\n			</td>\n		</tr><tr><td>\n			<p>520..522</p>\n			</td>\n			<td>\n			<p>ECC on second 256 bytes part of data</p>\n			</td>\n			<td>\n			<p>ECC on second 256 bytes of data</p>\n			</td>\n		</tr><tr><td>\n			<p>523..524</p>\n			</td>\n			<td>\n			<p>Block address</p>\n			</td>\n			<td>\n			<p>Tags</p>\n			</td>\n		</tr><tr><td>\n			<p>525..527</p>\n			</td>\n			<td>\n			<p>ECC on first 256 bytes part of data</p>\n			</td>\n			<td>\n			<p>ECC on first 256 bytes part of data</p>\n			</td>\n		</tr></table><p><br />\n </p>\n\n<p>The block status is a reserved value that shows whether the block is damaged.</p>\n\n<p>The data status tracks whether the page is valid. If less than 4 bits are zero, then the page is valid otherwise it is discarded.</p>\n\n<p>There are 8 bytes (64 bits) for use by YAFFS tags. This is partitioned as follows:</p>\n\n<p>Number of bitsUsage</p>\n\n<table><tr><td>\n			<p>18</p>\n			</td>\n			<td>\n			<p>18-bit file id. ie. Limit of 218 (over 260000) files. File id 0 is not valid and indicates a deleted page. File Id 0x3FFFF i is also not valid.</p>\n			</td>\n		</tr><tr><td>\n			<p>2</p>\n			</td>\n			<td>\n			<p>2-bit serial number.</p>\n			</td>\n		</tr><tr><td>\n			<p>20</p>\n			</td>\n			<td>\n			<p>20-bit page id within file. Limit of 220 pages per file. ie. over 500MB file max size. Page id 0 means the file header for this file.</p>\n			</td>\n		</tr><tr><td>\n			<p>10</p>\n			</td>\n			<td>\n			<p>10-bit counter of the number of bytes used in the page.</p>\n			</td>\n		</tr><tr><td>\n			<p>12</p>\n			</td>\n			<td>\n			<p>12-bit ECC on tags.</p>\n			</td>\n		</tr><tr><td>\n			<p>2</p>\n			</td>\n			<td>\n			<p>Unused. Keep as 1.</p>\n			</td>\n		</tr><tr><td>\n			<p><strong>64</strong></p>\n			</td>\n			<td>\n			<p><strong>Total</strong></p>\n			</td>\n		</tr></table><p><br />\n </p>\n\n<p>A bit of explanation on the usage of some of these fields:</p>\n\n<p>file Id is synonymous with inode.</p>\n\n<p>The serial number is incremented each time a page with the same file_id:page_id is rewritten (because of data changes or copy during garbage collection). When a page is replaced, there is a brief period during which there are two pages with the same id. The serial number resolves this. Since there should never be a difference of less than more than one, a two-bit counter is sufficient to determine which is the current page.</p>\n\n<p>When the page is rewritten, the file id, these data status byte and the 12-bit ECC are all written to zero.</p>\n\n<p>The byte counter indicates how many bytes are valid in this page. Since the page would not exist if it contains zero bytes, this field should thus hold 512 for all pages except the last page in the file. The use of counters means that the file length integrity is preserved while the file is open without having to constantly update the file length in the file header. The file header only needs to be refreshed when the file is closed (rather than whenever it is appended to). This field is wide enough to allow expansion to 1024-byte \"chunks\".</p>\n\n<p>File \"headers\" come in two flavours:</p>\n\n<ul><li>\n	<p>file info ( the mode, ower id, group id, length,...)</p>\n	</li>\n	<li>\n	<p>the hard link(s) that refers to the file.</p>\n	</li>\n</ul><p>A directory also appears as a file (ie. has an inode and hard link(s)) but has no data.</p>\n\n<p>The 12-bit ECC applies to only the tag data uses a similar algorithm to the 22-bit ECCs used for file system data. They are kept independent.</p>\n\n<h3>RAM data details</h3>\n\n<p>Block management details are reasonably obvious and, I feel, don\'t need to be addressed here apart from stating that there will be a structure to track block status (eg. number of pages in use, failed blocks, and which are candidates for garbage collection etc).</p>\n\n<p>The files need an indexing structure of sorts to locate and track the pages in the file. Some sort of tree structure should work rather well. The look-up needs to be quite efficient in both CPU time and space.</p>\n\n<h3>Page allocation and garbage collection</h3>\n\n<p>Pages are allocated sequentially from the currently selected block. When all the pages in the block are filled, another clean block is selected for allocation. At least two or three clean blocks are reserved for garbage collection purposes. If there are insufficient clean blocks available, then a dirty block ( ie one containing only discarded pages) is erased to free it up as a clean block. If no dirty blocks are available, then the dirtiest block is selected for garbage collection.</p>\n\n<p>Garbage collection is performed by copying the valid data pages into new data pages thus rendering all the pages in this block dirty and freeing it up for erasure. I also like the idea of selecting a block at random some small percentage of the time - thus reducing the chance of wear differences.</p>\n\n<p>Relative to NOR, NAND writes and erases very fast. Therefore garbage collection might be performed on-demand (eg. during a write) without significant degradation in performance. Alternatively garbage collection might be delegated to a kernel tasklet.</p>\n\n<p>Relative to JFFSx, the garbage collection presented here is incredibly simple - thanks mainly to the use of fixed-size pages instead of journaling nodes.</p>\n\n<h3>Flash writing</h3>\n\n<p>As presented here, YAFFS only writes to the page\'s data area once and to the spare area twice (once when new page is written and once when it gets stomped on) before an erasure. This is within the limits of the most restrictive NAND flashes.</p>\n\n<h3>Wear levelling</h3>\n\n<p>No wear levelling is explicitly used here. Instead we rely on two \"strategies\":</p>\n\n<ul><li>\n	<p>Reserving some blocks to cater for failure. You need to do this anyway with NAND. The main purpose behind wear levelling is to prevent some blocks getting more wear and failing. Since we expect, and handle, failure this is no longer as important.</p>\n	</li>\n	<li>\n	<p>The infrequent random block selection should prevent low-wear blocks getting \"stuck\".</p>\n	</li>\n</ul><h3>Partitioning</h3>\n\n<p>Partitioning is not included in this spec, but could be added if required.</p>\n\n<h3>Bootloading</h3>\n\n<p>Bootloaders cannot just read files direct from NAND due to the high probability of bad blocks. Because YAFFS is quite simple it will be relatively straightforward for bootloaders to read from it (eg reading a kernel).</p>\n\n<h3>Conclusion</h3>\n\n<p>YAFFS is very simple. It is also NAND-friendly, is relatively frugal with resources (especially RAM) and boots quickly. Like JFFSx it has journaling which makes it far more robust than FAT.</p>\n\n<p>While it might seem high-risk to develop YAFFS, it is probably about the same amount of effort as implementing changes to JFFS to get it to work effectively within the constraints of NAND. A resulting JFFSx system would still require significant amounts of RAM and have long boot times.</p>\n\n<p>While YAFFS is indeed a new file system internally, much of the file system glue code (including inode management, link management etc) can likely be stolen from JFFSx.</p>\n\n<p> </p>\n\n<p>YAFFS Development Notes</p>\n\n<h3>Build options</h3>\n\n<p>Yaffs can be built as either a kernel module (ie. a Linux file system) or as an application.</p>\n\n<p>Of course the goal is to build yaffs as a file system running on top of real NAND flash, but yaffs can be built to run on a RAM emulation layer for in-kernel testing without NAND flash in the system.</p>\n\n<p>Building as an application allows the yaffs_guts algorithms to be tested/debugged in a more friendly debugging environment. The test harness is in yaffsdev.c</p>\n\n<h3>Trying it out</h3>\n\n<p>YAFFS can be built to run with either mtd or RAM emulation, or both. The file system that interfaces to mtd is called <strong>yaffs</strong>, the file system that uses internal ram is called <strong>yaffsram</strong>. YAFFS simultaneously supports both if they are enabled.</p>\n\n<ol><li>\n	<p>Hack the Makefile and change the KERNELDIR define to your kernel directory.</p>\n	</li>\n	<li>\n	<p>If you don\'t have mtd support in your kernel, then you might need to turn off USE_MTD otherwise the yaffs module might not load.</p>\n	</li>\n	<li>\n	<p>Type <strong>make clean; make</strong> to build yaffs</p>\n	</li>\n	<li>\n	<p>Load yaffs as a module by typing <strong>/sbin/insmod yaffs.o</strong> (ya gotta be root!).</p>\n	</li>\n	<li>\n	<p>Create a mount point eg. <strong>mkdir /mnt/y</strong></p>\n	</li>\n	<li>\n	<p>To mount the RAM emulation version of yaffs, <strong>mount -t yaffsram none /mnt/y</strong></p>\n	</li>\n	<li>\n	<p>Alternatively, to mount the mtd version of yaffs,<strong> mount -t yaffs /dev/mtd0 /mnt/y</strong></p>\n	</li>\n</ol><p><br />\n </p>\n\n<h3>YAFFS Data structures</h3>\n\n<p>All data types are defined in yaffs_guts.h</p>\n\n<p>Yaffs uses the following major objects:</p>\n\n<ul><li>\n	<p>yaffs_Object: A yaffs_Object can be a file, directory, symlink or hardlink. The yaffs_Objects \"know\" about their corresponding yaffs_ObjectHeader in NAND and the data for that object. yaffs_Objects also bind together the directory structure as follows:</p>\n	</li>\n	<li>\n	<p>parent: pointer to the yaffs_Object that is a parent of this yaffs_Object in the directory structure.</p>\n	</li>\n	<li>\n	<p>siblings: this field is used to link together a list of all the yaffs_Objects in the same directory.</p>\n	</li>\n	<li>\n	<p>children: if the object is a directory, then children holds the head of the list of objects in the directory.</p>\n	</li>\n	<li>\n	<p>yaffs_Tnode: yaffs_Tnodes form a tree structure that speeds up the search for data chunks in a file. As the file grows in size, the levels increase. The Tnodes are a constant size (32 bytes). Level 0 (ie the lowest level) comprise 16 2-byte entries giving an index used to search for the chunkId. Tnodes at other levels comprise 8 4-byte pointer entries to other tnodes lower in the tree.</p>\n	</li>\n	<li>\n	<p>yaffs_Device: this holds the device context and is in some ways analogous to the VFS superblock. It stores the data used to access the mtd as well as function pointers to access the NAND data.</p>\n	</li>\n</ul><p>The Tnodes and Objects are allocated in groups to reduce memory allocation/freeing overheads. Freed up tnodes and objects are kept in a free list and re-used.</p>\n\n<h3>yaffs_Object</h3>\n\n<p><br />\n </p>\n\n<p>struct yaffs_ObjectStruct</p>\n\n<p>{</p>\n\n<p>__u8 fake:1; // A fake object has no presence on NAND.</p>\n\n<p>__u8 renameAllowed:1; // Are we allowed to rename it?</p>\n\n<p>__u8 unlinkAllowed:1; // Are we allowed to unlink it?</p>\n\n<p>__u8 dirty:1; // the object needs to be written to flash</p>\n\n<p>__u8 valid:1; // When the file system is being loaded up, this</p>\n\n<p>// object might be created before the data</p>\n\n<p>// is available (ie. file data records appear before the header).</p>\n\n<p>__u8 serial; // serial number of chunk in NAND. Store here so we don\'t have to</p>\n\n<p>// read back the old one to update.</p>\n\n<p>__u16 sum; // sum of the name to speed searching</p>\n\n<p> </p>\n\n<p>struct yaffs_DeviceStruct *myDev; // The device I\'m on</p>\n\n<p> </p>\n\n<p> </p>\n\n<p>struct list_head hashLink; // list of objects in this hash bucket</p>\n\n<p> </p>\n\n<p> </p>\n\n<p>struct list_head hardLinks; // all the equivalent hard linked objects</p>\n\n<p>// live on this list</p>\n\n<p>// directory structure stuff</p>\n\n<p>struct yaffs_ObjectStruct *parent; //my parent directory</p>\n\n<p>struct list_head siblings; // siblings in a directory</p>\n\n<p>// also used for linking up the free list</p>\n\n<p> </p>\n\n<p>// Where\'s my data in NAND?</p>\n\n<p>int chunkId; // where it lives</p>\n\n<p> </p>\n\n<p>__u32 objectId; // the object id value</p>\n\n<p> </p>\n\n<p> </p>\n\n<p>__u32 st_mode; // protection</p>\n\n<p>__u32 st_uid; // user ID of owner</p>\n\n<p>__u32 st_gid; // group ID of owner</p>\n\n<p>__u32 st_atime; // time of last access</p>\n\n<p>__u32 st_mtime; // time of last modification</p>\n\n<p>__u32 st_ctime; // time of last change</p>\n\n<p> </p>\n\n<p> </p>\n\n<p>yaffs_ObjectType variantType;</p>\n\n<p> </p>\n\n<p>yaffs_ObjectVariant variant;</p>\n\n<p> </p>\n\n<p>};</p>\n\n<p><br />\n </p>\n\n<p>Obvious stuff skipped....</p>\n\n<p>fake, renameAllowed, unlinkAllowed are special flags for handling \"fake\" objects which live in the file system but do not live on NAND. Currently there are only two such objects: the root object and the lost+found directory. None of these may be renamed or unlinked.</p>\n\n<p>serial, sum: see yaffs_ObjectHeader.</p>\n\n<p>dirty indicates that the object\'s contents has changed and a new yaffs_ObjectHeader must be written to flash.</p>\n\n<p>valid indicates that the object has been loaded up. This is only used during scanning (yaffs_Scan()) since we can know of an object\'s existance - and thus need to create the object header - before we encounter the associated yaffs_ObjectHeader.</p>\n\n<p>hashlink is a list of Objects in the same hash bucket.</p>\n\n<p>The four variants hold extra info:</p>\n\n<p>Files hold the file size and the top level and pointer to the tnode tree for the file.</p>\n\n<p>Directories hold a list of children objects.</p>\n\n<p>Symlinks hold a pointer to the alias string. This is probably inefficient, but that probably does not matter since we don\'t expect to see many of these.</p>\n\n<p>Hardlinks hold information to identify the equivalent object.</p>\n\n<p><br />\n </p>\n\n<p><br />\n </p>\n\n<h3>File structure (tnodes)</h3>\n\n<p>File structures are done with a tiered indexing structure</p>\n\n<p><br />\n </p>\n\n<p><img alt=\"\" height=\"294\" src=\"yaffs/sv9349341.gif\" width=\"491\" /><br /><br />\n </p>\n\n<p>The file structure is maintained by a tree structure. Depending where it is in the tree, each tree node (<strong><em>tnode</em></strong>) (the blue/things) holds either:</p>\n\n<ul><li>\n	<p>.... if it is at the lowest level, then 16 __u16s which identify the page.</p>\n	</li>\n	<li>\n	<p>.... if it is at a higher level (ie an internal tnode), then 8 pointers to lowest-level tnodes.</p>\n	</li>\n</ul><p>When the file starts out, it is assigned only one low-level tnode. When the file expands past what a single tnode can hold, then it is assigned a second tnode and an internal node is added to point to the two tnodes. As the file grows, more low-level tnodes and high level tnodes are added.</p>\n\n<p>Traversing the tnode tree to find a particular page in a file is quite simple: each internal tnode is selected from by using 3 bits of the page offset in the file. The level 0 page resolves 4 bits.</p>\n\n<p>For example, finding page 0x235 (ie. the one starting at file position 0x46800 would proceed as follows:</p>\n\n<p>0x235 is 0000001000110101, partitioned as follows. 000.000.100.011.0101</p>\n\n<p>LevelBitsSelected value</p>\n\n<table><tr><td>\n			<p>3 or more if they exist</p>\n			</td>\n			<td>\n			<p>&gt;= 10</p>\n			</td>\n			<td>\n			<p>Zero</p>\n			</td>\n		</tr><tr><td>\n			<p>2</p>\n			</td>\n			<td>\n			<p>9 to 7</p>\n			</td>\n			<td>\n			<p>100 binary = 4</p>\n			</td>\n		</tr><tr><td>\n			<p>1</p>\n			</td>\n			<td>\n			<p>6 to 4</p>\n			</td>\n			<td>\n			<p>011 binary = 3</p>\n			</td>\n		</tr><tr><td>\n			<p>0</p>\n			</td>\n			<td>\n			<p>3 to 0</p>\n			</td>\n			<td>\n			<p>0101 binary = 5</p>\n			</td>\n		</tr></table><p><br />\n </p>\n\n<p>Free tnodes are stored in a list. When the list is exhausted, more are allocated.</p>\n\n<p>Each tnode takes 32 bytes. Each file needs at least one level 0 tnode. How many do we need? A full 16MB file system needs at least 16MB/512/16 = 2000 level zero tnodes. More for internal tnodes. More for files smaller than optimal.</p>\n\n<p>The tree grows as required. When the file is resized to a smaller size then it is pruned.</p>\n\n<p><br />\n </p>\n\n<h3>NAND data</h3>\n\n<p>Data is stored on NAND in \"chunks\". Currently each chunk is the same size as a NAND flash page (ie. 512 bytes + 16 byte spare). In the future we might decide to allow for different chunk sizes. Chunks can hold either:</p>\n\n<ul><li>\n	<p>A yaffs_ObjectHeader. This is the way a yaffs_Object gets stored on NAND.</p>\n	</li>\n	<li>\n	<p>A chunk of file data.</p>\n	</li>\n</ul><p>The 16 byte spare area contains:</p>\n\n<ul><li>\n	<p>8 bytes of tags,</p>\n	</li>\n	<li>\n	<p>6 bytes of ECC data</p>\n	</li>\n	<li>\n	<p>1 byte block status (used to identify damaged blocks)</p>\n	</li>\n	<li>\n	<p>1 byte data status (currently unused).</p>\n	</li>\n</ul><p>The tags are made up as follows:</p>\n\n<p>typedef struct</p>\n\n<p>{</p>\n\n<p>unsigned chunkId:20; //chunk number in file</p>\n\n<p>unsigned serialNumber:2; //serial number for chunk</p>\n\n<p>unsigned byteCount:10; //number of bytes of data used in this chunk</p>\n\n<p>unsigned objectId:18; //the object id that this chunk belongs to.</p>\n\n<p>unsigned ecc:12; //ECC on tags</p>\n\n<p>unsigned unusedStuff:2; //unused</p>\n\n<p>} yaffs_Tags;</p>\n\n<p> </p>\n\n<p>A chunkId of zero indicates that this chunk holds a yaffs_ObjectHeader. A non zero value indicates that this is a data chunk and the position of the chunk in the file (ie. the first chunk - at offset 0 - has chunkId 1). See yaffs_guts.c:yaffs_Scan () to see how this is done.</p>\n\n<p>When a chunk is replaced (eg. file details changed or a part of a file was overwritten), the new chunk is written before the old chunk is deleted. This means that we don\'t lose data if there is a power loss after the new chunk is created but before the old one is discarded, but it does mean that we can encounter the situation where we find both the old and the new chunks in flash. The serialNumber is incremented each time the chunk is written. 2 bits is sufficient to resolve any ambiguity.</p>\n\n<p>bytecount applies only to data chunks and tells how many of the data bytes are valid.</p>\n\n<p>objectId says which object this chunk belongs to.</p>\n\n<p>ecc is used to perform error correction on the tags. Another ecc field is used to error correct the data.</p>\n\n<p><br />\n </p>\n\n<h3>yaffs_ObjectHeader</h3>\n\n<p>typedef struct</p>\n\n<p>{</p>\n\n<p>yaffs_ObjectType type;</p>\n\n<p> </p>\n\n<p>// Apply to everything</p>\n\n<p>int parentObjectId;</p>\n\n<p>__u16 sum; // checksum of name</p>\n\n<p>char name[YAFFS_MAX_NAME_LENGTH + 1];</p>\n\n<p> </p>\n\n<p>// Thes following apply to directories, files, symlinks - not hard links</p>\n\n<p>__u32 st_mode; // protection</p>\n\n<p>__u32 st_uid; // user ID of owner</p>\n\n<p>__u32 st_gid; // group ID of owner</p>\n\n<p>__u32 st_atime; // time of last access</p>\n\n<p>__u32 st_mtime; // time of last modification</p>\n\n<p>__u32 st_ctime; // time of last change</p>\n\n<p> </p>\n\n<p>// File size applies to files only</p>\n\n<p>int fileSize;</p>\n\n<p> </p>\n\n<p>// Equivalent object id applies to hard links only.</p>\n\n<p>int equivalentObjectId;</p>\n\n<p>// alias only applies to symlinks</p>\n\n<p>char alias[YAFFS_MAX_ALIAS_LENGTH + 1];</p>\n\n<p> </p>\n\n<p> </p>\n\n<p>} yaffs_ObjectHeader;</p>\n\n<p> </p>\n\n<p>A yaffs_ObjectHeader is stored in NAND for every yaffs_Object.</p>\n\n<p>type holds the type of yaffs_Object (file,directory,hardlink or symlink).</p>\n\n<p>parentObject is the objectId of this object\'s parent. name holds the object\'s name. Together these form the directory structure of the file system. Also worth mention is sum. This is a \"checksum\" on the name which speeds directory searching (ie. when searching the directory we only compare the name for those entries where sum matches).</p>\n\n<p>Obvious stuff skipped....</p>\n\n<p>equivalentObjectId is used by hardlinks. A hardlink to an object uses this field to specify the object that this links to. This way of doing things is a bit different than the normal Linux way of doing things (ie. keeping the links distinct from the inode) but is simpler and uses less space except for a few corner cases with hardlinks.</p>\n\n<p>alias is used by symlinks to hold the symlink alias string. This limits the size of the symlink alias. In future we should expand YAFFS to use data chunks to store aliases too long to fit into the yaffs_ObjectHeader.</p>\n\n<p><br />\n </p>\n\n<h3>NAND Interface</h3>\n\n<p>All NAND access is performed via four functions pointed to by yaffs_Device. At the moment a chunk is a page.</p>\n\n<ul><li>\n	<p>int WriteChunkToNAND(struct yaffs_DeviceStruct *dev,int chunkInNAND, const __u8 *data, yaffs_Spare *spare)</p>\n	</li>\n	<li>\n	<p>int ReadChunkFromNAND(struct yaffs_DeviceStruct *dev,int chunkInNAND, __u8 *data, yaffs_Spare *spare);</p>\n	</li>\n	<li>\n	<p>int EraseBlockInNAND(struct yaffs_DeviceStruct *dev,int blockInNAND);</p>\n	</li>\n	<li>\n	<p>int InitialiseNAND(struct yaffs_DeviceStruct *dev);</p>\n	</li>\n</ul><p>In the Readxxx and Writexxx functions, the data and/or spare pointers may be NULL in which case these data transfers are ignored.</p>\n\n<p>A quick note about NAND:</p>\n\n<ul><li>\n	<p>NAND is not random access, but page oriented. Thus, we do all reads &amp; writes in pages.</p>\n	</li>\n	<li>\n	<p>Each NAND page holds 512 bytes of data and 16 \"spare\" bytes. Yaffs structures the spare area with tags used to identify what is stored in the data area. There are 32 such pages to a block.</p>\n	</li>\n	<li>\n	<p>NAND writes will only change 1 bits to 0. eg. if a byte holds 10110011 and you write 11011010 to it you will get the logical and of the two values: 10010010. The only way to get 1s again is to erase the entire block.</p>\n	</li>\n	<li>\n	<p>You may only write to a page a few times before erasing the entire block. Yaffs lives within these limitations. Each page only gets written to twice (once when written and once when discarded).</p>\n	</li>\n	<li>\n	<p>ECC is normally used with NAND to correct for single bit errors. YAFFS applies the ECC itself, so the MTD should not do this.</p>\n	</li>\n	<li>\n	<p>The current mtd interfaces are not particularly well suited to YAFFS and we will address the issue with the mtd group. (The mtd interface does not support page-oriented read/write which YAFFS would prefer).</p>\n	</li>\n</ul><p><br />\n </p>\n\n<h3>mkyaffs</h3>\n\n<p>mkyaffs is the tool to format a NAND mtd to be used for YAFFS. This is quite simple, just erase all the undamaged blocks. YAFFS treats erased blocks as free (empty) space.</p>\n\n<p><br />\n </p>\n\n<h2>Expected performance</h2>\n\n<p>The following numbers should give an indication of the performance we should expect from YAFFS.</p>\n\n<p>As an example, I\'ll use the following numbers. Since the hardware is capable of 50ns read/write, these numbers allow for some other ovberheads. Clearly though, the performance can be degraded in various ways.</p>\n\n<p>Seek10uS/page</p>\n\n<table><tr><td>\n			<p>Read</p>\n			</td>\n			<td>\n			<p>100nS/byte</p>\n			</td>\n		</tr><tr><td>\n			<p>Write</p>\n			</td>\n			<td>\n			<p>100nS/byte</p>\n			</td>\n		</tr><tr><td>\n			<p>Program</p>\n			</td>\n			<td>\n			<p>200uS/page</p>\n			</td>\n		</tr><tr><td>\n			<p>Erase</p>\n			</td>\n			<td>\n			<p>2mS/block</p>\n			</td>\n		</tr></table><p><br />\n </p>\n\n<p>From this we can derive some higher-level numbers:</p>\n\n<p>OperationTimeCalculation</p>\n\n<table><tr><td>\n			<p>Read spare</p>\n			</td>\n			<td>\n			<p>12uS</p>\n			</td>\n			<td>\n			<p>seek + 16 * read</p>\n			</td>\n		</tr><tr><td>\n			<p>Read page</p>\n			</td>\n			<td>\n			<p>63 uS</p>\n			</td>\n			<td>\n			<p>seek + 528 * read</p>\n			</td>\n		</tr><tr><td>\n			<p>Write page</p>\n			</td>\n			<td>\n			<p>326 uS</p>\n			</td>\n			<td>\n			<p>seek + 528 * write + program + read page (for verification)</p>\n			</td>\n		</tr><tr><td>\n			<p>Discard page</p>\n			</td>\n			<td>\n			<p>212 uS</p>\n			</td>\n			<td>\n			<p>seek + 16 * write + program</p>\n			</td>\n		</tr><tr><td>\n			<p>Overwrite page</p>\n			</td>\n			<td>\n			<p>538 uS</p>\n			</td>\n			<td>\n			<p>write page + discard page</p>\n			</td>\n		</tr><tr><td>\n			<p>Erase overhead per page</p>\n			</td>\n			<td>\n			<p>63uS</p>\n			</td>\n			<td>\n			<p>erase/32</p>\n			</td>\n		</tr></table><p><br />\n </p>\n\n<p>From this we can infer the following flash access times:</p>\n\n<p>OperationTimeCalculation</p>\n\n<table><tr><td>\n			<p>Read 1MB file</p>\n			</td>\n			<td>\n			<p>0.13s (about 7.5 MB/s)</p>\n			</td>\n			<td>\n			<p>2000 * read page</p>\n			</td>\n		</tr><tr><td>\n			<p>Write 1MB (clean system)</p>\n			</td>\n			<td>\n			<p>0.53s (about 1.8 MB/s)</p>\n			</td>\n			<td>\n			<p>2000 * write page</p>\n			</td>\n		</tr><tr><td>\n			<p>Overwrite 1MB file (no gc)</p>\n			</td>\n			<td>\n			<p>1.08s (about 0.9MB/s)</p>\n			</td>\n			<td>\n			<p>2000 * overwrite page</p>\n			</td>\n		</tr><tr><td>\n			<p>Overwrite 1MB with 50% gc</p>\n			</td>\n			<td>\n			<p>2.4s (about 0.4 MB/s)</p>\n			</td>\n			<td>\n			<p>2000 * overwrite page + 2000 * page copy (== overwrite page) + 4000 * erase overhead</p>\n			</td>\n		</tr><tr><td>\n			<p>Delete 1MB file</p>\n			</td>\n			<td>\n			<p>0.43s (about 2.2 MB/s)</p>\n			</td>\n			<td>\n			<p>2000 * discard page</p>\n			</td>\n		</tr><tr><td>\n			<p>Delete 1MB file with 50% gc</p>\n			</td>\n			<td>\n			<p>0.49s (about 2.0MB/s)</p>\n			</td>\n			<td>\n			<p>2000 * discard page + 1000 * erase overhead</p>\n			</td>\n		</tr></table><p> </p></div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:38:\"/archives/yaffs-original-specification\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:8:\"/node/37\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:38:\"/archives/yaffs-original-specification\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:7:\"node:37\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:65:\"<span property=\"schema:name\">Yaffs Original Specification</span>\n\";}}',-1,1510655169.915,1,'config:filter.format.basic_html config:system.site node:37 node_view rendered user:1','278'),('entity_view:node:37:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:2:\"37\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:7:\"node:37\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1510655169.895,1,'config:filter.format.basic_html config:system.site node:37 node_view rendered user:1','278');
INSERT INTO `cache_render` VALUES ('entity_view:node:37:search_result:[languages:language_interface]=en:[theme]=yaffs:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:32920:\"<span property=\"schema:name\">Yaffs Original Specification</span>\n\n            <div property=\"schema:text\" class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p>YAFFS (Yet Another Flash File System)</p>\n\n<h4>Version 0.3</h4>\n\n<h4>Charles Manning (and Wookey), December 2001</h4>\n\n<p><br />\n </p>\n\n<h2>Revision History</h2>\n\n<p>V0.0 20/12/01 First Draft</p>\n\n<table><tr><td>\n			<p>V0.1</p>\n			</td>\n			<td>\n			<p>11/01/02</p>\n			</td>\n			<td>\n			<p>Minor corrections &amp; cosmetics.<br />\n			Change use of data status byte.</p>\n			</td>\n		</tr><tr><td>\n			<p>V0.2</p>\n			</td>\n			<td>\n			<p>28/01/02</p>\n			</td>\n			<td>\n			<p>Added observations about inodes, file headers and hard links.</p>\n			</td>\n		</tr><tr><td>\n			<p>V0.3</p>\n			</td>\n			<td>\n			<p>26/02/02</p>\n			</td>\n			<td>\n			<p>W:Added some general observations on compatibility, partitions and bootloading.</p>\n			</td>\n		</tr></table><p><br />\n </p>\n\n<h2>Scope</h2>\n\n<p>The purpose of this document is to outline a potential NAND-friendly file system for Linux.</p>\n\n<h2>Background</h2>\n\n<p>There are already various flash-file systems (FFSs) or block drivers for flash (on top of which a regular FS runs). There are pros and cons with all of these.</p>\n\n<p>Flash memory has quite a few constraints which will not be addressed here. Various approaches are available to work around these constraints to provide a file system. It is important to recognise that \"flash\" includes both NOR and NAND flash which have different sets of constraints. It is easy to be mislead by the generic term \"flash\" into thinking that approaches appropriate for NOR flash are immediately suitable for NAND flash.</p>\n\n<p>The NAND block drivers (eg. SmartMedia [currently not available for Linux] and DiskOnChip NFTL) typically use FAT16 as the file system. This isn\'t too robust and nor is it that flash-friendly. These block drivers provide a logical to physical mapping layer to emulate rewritable blocks that look like disk sectors. When used with FAT16, these file systems work reasonably well. They have a low memory footprint and scale well. Like all FAT based systems they are prone to corruption (\"lost clusters etc\").</p>\n\n<p>The other approach is to design an entire file system which does not work through a block driver layer and is flash-friendly. This allows more scope to work around issues.</p>\n\n<p>Currently, two Linux file systems that support NOR flash very well are JFFS and its derivative JFFS2. Both of these are based on the principles of journaling (hence the leading J) which significantly increases robustness - a particularly important feature in embedded systems. Unfortunately neither of these file systems scale particularly well in both boot time and RAM usage. Scaling is particularly relevant when one considers that a 16MB NOR array would be considered large while a 128MB NAND is available as a single chip.</p>\n\n<p>JFFS requires a RAM-based jffs_node structure for each journalling node in the flash. Each of these nodes is 48 bytes. JFFS2 makes a significant improvement here by reducing the equivalent structure (jffs2_raw_node_ref) to 16 bytes. Still, at say an average node-size of 512 bytes, a 128MB NAND might need 250000 of these ... 4MB!</p>\n\n<p>Both JFFS and JFFS2 require scanning the flash array at boot time to find the journaling nodes and determine the file structures. Since NAND is large, slow, serially accessed and needs ECC this does not scale well and will take an unacceptably long boot time for the target systems. As a thumb-suck, the scanning of a 128MB NAND array might take approx 25 seconds.</p>\n\n<p>The intentions of the design sketched here are:</p>\n\n<ul><li>\n	<p>Be NAND-flash friendly.</p>\n	</li>\n	<li>\n	<p>Robustness through journaling strategies.</p>\n	</li>\n	<li>\n	<p>Significantly reduce the RAM overheads and boot times associated with JFFSx.</p>\n	</li>\n</ul><p>This FS is intended primarily for internal NAND rather than removable NAND (SM cards). On removable SM cards Smartmedia compatibility is likely to be important so SM/FAT will normally be used, although of course YAFFS makes a lot of sense if reliability is more important than compatibility.</p>\n\n<h2>Overview</h2>\n\n<p>Here follows a simplified overview of YAFFS.</p>\n\n<p>YAFFS uses a physical flash format similar to SmartMedia. This is done for various reasons:</p>\n\n<ul><li>\n	<p>Some of the formatting, eg placement of bad block markers is determined by the NAND manufacturers and can\'t be changed.</p>\n	</li>\n	<li>\n	<p>Potential to reuse code.</p>\n	</li>\n	<li>\n	<p>If it ain\'t broke don\'t fix.</p>\n	</li>\n</ul><p>Some of the fields are obviously different to reflect the different usage. Despite the similarities YAFFS is not actually compatible with SM/FAT. SM cards need to be reformatted to switch from using SM/FAT to YAFFS or vice versa.</p>\n\n<p>File data is stored in fixed size \"chunks\" consistent with the size of a page (ie. 512 bytes). Each page is marked with a file id and chunk number. These tags are stored in the \"spare data\" region of the flash. The chunk number is determined by dividing the file position by the chunk size.</p>\n\n<p>When data in a file is overwritten, the relevant chunks are replaced by writing new pages to flash containing the new data but the same tags. The overwritten data is marked as \"discarded\".</p>\n\n<p>File \"headers\" are stored as a single page, marked so as to be differentiated from data pages.</p>\n\n<p>Pages are also marked with a short (2 bit) serial number that increments each time the page at this position is incremented. The reason for this is that if power loss/crash/other act of demonic forces happens before the replaced page is marked as discarded, it is possible to have two pages with the same tags. The serial number is used to arbitrate.</p>\n\n<p>A block containing only discarded pages (termed a <em>dirty block</em>) is an obvious candidate for garbage collection. Otherwise valid pages can be copied off a block thus rendering the whole block discarded and ready for garbage collection.</p>\n\n<p>In theory you don\'t need to hold the file structure in RAM... you could just scan the whole flash looking for pages when you need them. In practice though you\'d want better file access times than that! The mechanism proposed here is to have a list of __u16 page addresses associated with each file. Since there are 218 pages in a 128MB NAND, a __u16 is insufficient to uniquely identify a page but is does identify a group of 4 pages - a small enough region to search exhaustively. This mechanism is clearly expandable to larger NAND devices - within reason. The RAM overhead with this approach is approx 2 bytes per page - 512kB of RAM for a whole 128MB NAND.</p>\n\n<p>Boot-time scanning to build the file structure lists should require just one pass reading NAND. Since only the the spare data needs to be read, this should be relatively fast ( approx 3 seconds for 128MB). Improvements can be achieved by partitioning the NAND. ie. mount the critical partition first then mount the data partition afterwards.</p>\n\n<p>Various runtime improvements can be achieved by changing the \"chunk size\" to 1024 bytes or more. However this would likely reduce flash efficiency. As always, life is a compromise....</p>\n\n<p><br />\n </p>\n\n<h3>Spare area details</h3>\n\n<p>The following table summarizes the layout of the spare area of each page.</p>\n\n<p>Byte #SmartMedia usageYAFFS usage</p>\n\n<table><tr><td>\n			<p>0..511</p>\n			</td>\n			<td>\n			<p>Data</p>\n			</td>\n			<td>\n			<p>Data. either file data or file header depending on tags</p>\n			</td>\n		</tr><tr><td>\n			<p>512..515</p>\n			</td>\n			<td>\n			<p>Reserved</p>\n			</td>\n			<td>\n			<p>Tags</p>\n			</td>\n		</tr><tr><td>\n			<p>516</p>\n			</td>\n			<td>\n			<p>Data status byte. Not used in SM code from Samsung</p>\n			</td>\n			<td>\n			<p>Data status byte. If more than 4 bits are zero, then this page is discarded.</p>\n			</td>\n		</tr><tr><td>\n			<p>517</p>\n			</td>\n			<td>\n			<p>Block status byte</p>\n			</td>\n			<td>\n			<p>Block status byte</p>\n			</td>\n		</tr><tr><td>\n			<p>518..519</p>\n			</td>\n			<td>\n			<p>Block address</p>\n			</td>\n			<td>\n			<p>Tags</p>\n			</td>\n		</tr><tr><td>\n			<p>520..522</p>\n			</td>\n			<td>\n			<p>ECC on second 256 bytes part of data</p>\n			</td>\n			<td>\n			<p>ECC on second 256 bytes of data</p>\n			</td>\n		</tr><tr><td>\n			<p>523..524</p>\n			</td>\n			<td>\n			<p>Block address</p>\n			</td>\n			<td>\n			<p>Tags</p>\n			</td>\n		</tr><tr><td>\n			<p>525..527</p>\n			</td>\n			<td>\n			<p>ECC on first 256 bytes part of data</p>\n			</td>\n			<td>\n			<p>ECC on first 256 bytes part of data</p>\n			</td>\n		</tr></table><p><br />\n </p>\n\n<p>The block status is a reserved value that shows whether the block is damaged.</p>\n\n<p>The data status tracks whether the page is valid. If less than 4 bits are zero, then the page is valid otherwise it is discarded.</p>\n\n<p>There are 8 bytes (64 bits) for use by YAFFS tags. This is partitioned as follows:</p>\n\n<p>Number of bitsUsage</p>\n\n<table><tr><td>\n			<p>18</p>\n			</td>\n			<td>\n			<p>18-bit file id. ie. Limit of 218 (over 260000) files. File id 0 is not valid and indicates a deleted page. File Id 0x3FFFF i is also not valid.</p>\n			</td>\n		</tr><tr><td>\n			<p>2</p>\n			</td>\n			<td>\n			<p>2-bit serial number.</p>\n			</td>\n		</tr><tr><td>\n			<p>20</p>\n			</td>\n			<td>\n			<p>20-bit page id within file. Limit of 220 pages per file. ie. over 500MB file max size. Page id 0 means the file header for this file.</p>\n			</td>\n		</tr><tr><td>\n			<p>10</p>\n			</td>\n			<td>\n			<p>10-bit counter of the number of bytes used in the page.</p>\n			</td>\n		</tr><tr><td>\n			<p>12</p>\n			</td>\n			<td>\n			<p>12-bit ECC on tags.</p>\n			</td>\n		</tr><tr><td>\n			<p>2</p>\n			</td>\n			<td>\n			<p>Unused. Keep as 1.</p>\n			</td>\n		</tr><tr><td>\n			<p><strong>64</strong></p>\n			</td>\n			<td>\n			<p><strong>Total</strong></p>\n			</td>\n		</tr></table><p><br />\n </p>\n\n<p>A bit of explanation on the usage of some of these fields:</p>\n\n<p>file Id is synonymous with inode.</p>\n\n<p>The serial number is incremented each time a page with the same file_id:page_id is rewritten (because of data changes or copy during garbage collection). When a page is replaced, there is a brief period during which there are two pages with the same id. The serial number resolves this. Since there should never be a difference of less than more than one, a two-bit counter is sufficient to determine which is the current page.</p>\n\n<p>When the page is rewritten, the file id, these data status byte and the 12-bit ECC are all written to zero.</p>\n\n<p>The byte counter indicates how many bytes are valid in this page. Since the page would not exist if it contains zero bytes, this field should thus hold 512 for all pages except the last page in the file. The use of counters means that the file length integrity is preserved while the file is open without having to constantly update the file length in the file header. The file header only needs to be refreshed when the file is closed (rather than whenever it is appended to). This field is wide enough to allow expansion to 1024-byte \"chunks\".</p>\n\n<p>File \"headers\" come in two flavours:</p>\n\n<ul><li>\n	<p>file info ( the mode, ower id, group id, length,...)</p>\n	</li>\n	<li>\n	<p>the hard link(s) that refers to the file.</p>\n	</li>\n</ul><p>A directory also appears as a file (ie. has an inode and hard link(s)) but has no data.</p>\n\n<p>The 12-bit ECC applies to only the tag data uses a similar algorithm to the 22-bit ECCs used for file system data. They are kept independent.</p>\n\n<h3>RAM data details</h3>\n\n<p>Block management details are reasonably obvious and, I feel, don\'t need to be addressed here apart from stating that there will be a structure to track block status (eg. number of pages in use, failed blocks, and which are candidates for garbage collection etc).</p>\n\n<p>The files need an indexing structure of sorts to locate and track the pages in the file. Some sort of tree structure should work rather well. The look-up needs to be quite efficient in both CPU time and space.</p>\n\n<h3>Page allocation and garbage collection</h3>\n\n<p>Pages are allocated sequentially from the currently selected block. When all the pages in the block are filled, another clean block is selected for allocation. At least two or three clean blocks are reserved for garbage collection purposes. If there are insufficient clean blocks available, then a dirty block ( ie one containing only discarded pages) is erased to free it up as a clean block. If no dirty blocks are available, then the dirtiest block is selected for garbage collection.</p>\n\n<p>Garbage collection is performed by copying the valid data pages into new data pages thus rendering all the pages in this block dirty and freeing it up for erasure. I also like the idea of selecting a block at random some small percentage of the time - thus reducing the chance of wear differences.</p>\n\n<p>Relative to NOR, NAND writes and erases very fast. Therefore garbage collection might be performed on-demand (eg. during a write) without significant degradation in performance. Alternatively garbage collection might be delegated to a kernel tasklet.</p>\n\n<p>Relative to JFFSx, the garbage collection presented here is incredibly simple - thanks mainly to the use of fixed-size pages instead of journaling nodes.</p>\n\n<h3>Flash writing</h3>\n\n<p>As presented here, YAFFS only writes to the page\'s data area once and to the spare area twice (once when new page is written and once when it gets stomped on) before an erasure. This is within the limits of the most restrictive NAND flashes.</p>\n\n<h3>Wear levelling</h3>\n\n<p>No wear levelling is explicitly used here. Instead we rely on two \"strategies\":</p>\n\n<ul><li>\n	<p>Reserving some blocks to cater for failure. You need to do this anyway with NAND. The main purpose behind wear levelling is to prevent some blocks getting more wear and failing. Since we expect, and handle, failure this is no longer as important.</p>\n	</li>\n	<li>\n	<p>The infrequent random block selection should prevent low-wear blocks getting \"stuck\".</p>\n	</li>\n</ul><h3>Partitioning</h3>\n\n<p>Partitioning is not included in this spec, but could be added if required.</p>\n\n<h3>Bootloading</h3>\n\n<p>Bootloaders cannot just read files direct from NAND due to the high probability of bad blocks. Because YAFFS is quite simple it will be relatively straightforward for bootloaders to read from it (eg reading a kernel).</p>\n\n<h3>Conclusion</h3>\n\n<p>YAFFS is very simple. It is also NAND-friendly, is relatively frugal with resources (especially RAM) and boots quickly. Like JFFSx it has journaling which makes it far more robust than FAT.</p>\n\n<p>While it might seem high-risk to develop YAFFS, it is probably about the same amount of effort as implementing changes to JFFS to get it to work effectively within the constraints of NAND. A resulting JFFSx system would still require significant amounts of RAM and have long boot times.</p>\n\n<p>While YAFFS is indeed a new file system internally, much of the file system glue code (including inode management, link management etc) can likely be stolen from JFFSx.</p>\n\n<p> </p>\n\n<p>YAFFS Development Notes</p>\n\n<h3>Build options</h3>\n\n<p>Yaffs can be built as either a kernel module (ie. a Linux file system) or as an application.</p>\n\n<p>Of course the goal is to build yaffs as a file system running on top of real NAND flash, but yaffs can be built to run on a RAM emulation layer for in-kernel testing without NAND flash in the system.</p>\n\n<p>Building as an application allows the yaffs_guts algorithms to be tested/debugged in a more friendly debugging environment. The test harness is in yaffsdev.c</p>\n\n<h3>Trying it out</h3>\n\n<p>YAFFS can be built to run with either mtd or RAM emulation, or both. The file system that interfaces to mtd is called <strong>yaffs</strong>, the file system that uses internal ram is called <strong>yaffsram</strong>. YAFFS simultaneously supports both if they are enabled.</p>\n\n<ol><li>\n	<p>Hack the Makefile and change the KERNELDIR define to your kernel directory.</p>\n	</li>\n	<li>\n	<p>If you don\'t have mtd support in your kernel, then you might need to turn off USE_MTD otherwise the yaffs module might not load.</p>\n	</li>\n	<li>\n	<p>Type <strong>make clean; make</strong> to build yaffs</p>\n	</li>\n	<li>\n	<p>Load yaffs as a module by typing <strong>/sbin/insmod yaffs.o</strong> (ya gotta be root!).</p>\n	</li>\n	<li>\n	<p>Create a mount point eg. <strong>mkdir /mnt/y</strong></p>\n	</li>\n	<li>\n	<p>To mount the RAM emulation version of yaffs, <strong>mount -t yaffsram none /mnt/y</strong></p>\n	</li>\n	<li>\n	<p>Alternatively, to mount the mtd version of yaffs,<strong> mount -t yaffs /dev/mtd0 /mnt/y</strong></p>\n	</li>\n</ol><p><br />\n </p>\n\n<h3>YAFFS Data structures</h3>\n\n<p>All data types are defined in yaffs_guts.h</p>\n\n<p>Yaffs uses the following major objects:</p>\n\n<ul><li>\n	<p>yaffs_Object: A yaffs_Object can be a file, directory, symlink or hardlink. The yaffs_Objects \"know\" about their corresponding yaffs_ObjectHeader in NAND and the data for that object. yaffs_Objects also bind together the directory structure as follows:</p>\n	</li>\n	<li>\n	<p>parent: pointer to the yaffs_Object that is a parent of this yaffs_Object in the directory structure.</p>\n	</li>\n	<li>\n	<p>siblings: this field is used to link together a list of all the yaffs_Objects in the same directory.</p>\n	</li>\n	<li>\n	<p>children: if the object is a directory, then children holds the head of the list of objects in the directory.</p>\n	</li>\n	<li>\n	<p>yaffs_Tnode: yaffs_Tnodes form a tree structure that speeds up the search for data chunks in a file. As the file grows in size, the levels increase. The Tnodes are a constant size (32 bytes). Level 0 (ie the lowest level) comprise 16 2-byte entries giving an index used to search for the chunkId. Tnodes at other levels comprise 8 4-byte pointer entries to other tnodes lower in the tree.</p>\n	</li>\n	<li>\n	<p>yaffs_Device: this holds the device context and is in some ways analogous to the VFS superblock. It stores the data used to access the mtd as well as function pointers to access the NAND data.</p>\n	</li>\n</ul><p>The Tnodes and Objects are allocated in groups to reduce memory allocation/freeing overheads. Freed up tnodes and objects are kept in a free list and re-used.</p>\n\n<h3>yaffs_Object</h3>\n\n<p><br />\n </p>\n\n<p>struct yaffs_ObjectStruct</p>\n\n<p>{</p>\n\n<p>__u8 fake:1; // A fake object has no presence on NAND.</p>\n\n<p>__u8 renameAllowed:1; // Are we allowed to rename it?</p>\n\n<p>__u8 unlinkAllowed:1; // Are we allowed to unlink it?</p>\n\n<p>__u8 dirty:1; // the object needs to be written to flash</p>\n\n<p>__u8 valid:1; // When the file system is being loaded up, this</p>\n\n<p>// object might be created before the data</p>\n\n<p>// is available (ie. file data records appear before the header).</p>\n\n<p>__u8 serial; // serial number of chunk in NAND. Store here so we don\'t have to</p>\n\n<p>// read back the old one to update.</p>\n\n<p>__u16 sum; // sum of the name to speed searching</p>\n\n<p> </p>\n\n<p>struct yaffs_DeviceStruct *myDev; // The device I\'m on</p>\n\n<p> </p>\n\n<p> </p>\n\n<p>struct list_head hashLink; // list of objects in this hash bucket</p>\n\n<p> </p>\n\n<p> </p>\n\n<p>struct list_head hardLinks; // all the equivalent hard linked objects</p>\n\n<p>// live on this list</p>\n\n<p>// directory structure stuff</p>\n\n<p>struct yaffs_ObjectStruct *parent; //my parent directory</p>\n\n<p>struct list_head siblings; // siblings in a directory</p>\n\n<p>// also used for linking up the free list</p>\n\n<p> </p>\n\n<p>// Where\'s my data in NAND?</p>\n\n<p>int chunkId; // where it lives</p>\n\n<p> </p>\n\n<p>__u32 objectId; // the object id value</p>\n\n<p> </p>\n\n<p> </p>\n\n<p>__u32 st_mode; // protection</p>\n\n<p>__u32 st_uid; // user ID of owner</p>\n\n<p>__u32 st_gid; // group ID of owner</p>\n\n<p>__u32 st_atime; // time of last access</p>\n\n<p>__u32 st_mtime; // time of last modification</p>\n\n<p>__u32 st_ctime; // time of last change</p>\n\n<p> </p>\n\n<p> </p>\n\n<p>yaffs_ObjectType variantType;</p>\n\n<p> </p>\n\n<p>yaffs_ObjectVariant variant;</p>\n\n<p> </p>\n\n<p>};</p>\n\n<p><br />\n </p>\n\n<p>Obvious stuff skipped....</p>\n\n<p>fake, renameAllowed, unlinkAllowed are special flags for handling \"fake\" objects which live in the file system but do not live on NAND. Currently there are only two such objects: the root object and the lost+found directory. None of these may be renamed or unlinked.</p>\n\n<p>serial, sum: see yaffs_ObjectHeader.</p>\n\n<p>dirty indicates that the object\'s contents has changed and a new yaffs_ObjectHeader must be written to flash.</p>\n\n<p>valid indicates that the object has been loaded up. This is only used during scanning (yaffs_Scan()) since we can know of an object\'s existance - and thus need to create the object header - before we encounter the associated yaffs_ObjectHeader.</p>\n\n<p>hashlink is a list of Objects in the same hash bucket.</p>\n\n<p>The four variants hold extra info:</p>\n\n<p>Files hold the file size and the top level and pointer to the tnode tree for the file.</p>\n\n<p>Directories hold a list of children objects.</p>\n\n<p>Symlinks hold a pointer to the alias string. This is probably inefficient, but that probably does not matter since we don\'t expect to see many of these.</p>\n\n<p>Hardlinks hold information to identify the equivalent object.</p>\n\n<p><br />\n </p>\n\n<p><br />\n </p>\n\n<h3>File structure (tnodes)</h3>\n\n<p>File structures are done with a tiered indexing structure</p>\n\n<p><br />\n </p>\n\n<p><img alt=\"\" height=\"294\" src=\"yaffs/sv9349341.gif\" width=\"491\" /><br /><br />\n </p>\n\n<p>The file structure is maintained by a tree structure. Depending where it is in the tree, each tree node (<strong><em>tnode</em></strong>) (the blue/things) holds either:</p>\n\n<ul><li>\n	<p>.... if it is at the lowest level, then 16 __u16s which identify the page.</p>\n	</li>\n	<li>\n	<p>.... if it is at a higher level (ie an internal tnode), then 8 pointers to lowest-level tnodes.</p>\n	</li>\n</ul><p>When the file starts out, it is assigned only one low-level tnode. When the file expands past what a single tnode can hold, then it is assigned a second tnode and an internal node is added to point to the two tnodes. As the file grows, more low-level tnodes and high level tnodes are added.</p>\n\n<p>Traversing the tnode tree to find a particular page in a file is quite simple: each internal tnode is selected from by using 3 bits of the page offset in the file. The level 0 page resolves 4 bits.</p>\n\n<p>For example, finding page 0x235 (ie. the one starting at file position 0x46800 would proceed as follows:</p>\n\n<p>0x235 is 0000001000110101, partitioned as follows. 000.000.100.011.0101</p>\n\n<p>LevelBitsSelected value</p>\n\n<table><tr><td>\n			<p>3 or more if they exist</p>\n			</td>\n			<td>\n			<p>&gt;= 10</p>\n			</td>\n			<td>\n			<p>Zero</p>\n			</td>\n		</tr><tr><td>\n			<p>2</p>\n			</td>\n			<td>\n			<p>9 to 7</p>\n			</td>\n			<td>\n			<p>100 binary = 4</p>\n			</td>\n		</tr><tr><td>\n			<p>1</p>\n			</td>\n			<td>\n			<p>6 to 4</p>\n			</td>\n			<td>\n			<p>011 binary = 3</p>\n			</td>\n		</tr><tr><td>\n			<p>0</p>\n			</td>\n			<td>\n			<p>3 to 0</p>\n			</td>\n			<td>\n			<p>0101 binary = 5</p>\n			</td>\n		</tr></table><p><br />\n </p>\n\n<p>Free tnodes are stored in a list. When the list is exhausted, more are allocated.</p>\n\n<p>Each tnode takes 32 bytes. Each file needs at least one level 0 tnode. How many do we need? A full 16MB file system needs at least 16MB/512/16 = 2000 level zero tnodes. More for internal tnodes. More for files smaller than optimal.</p>\n\n<p>The tree grows as required. When the file is resized to a smaller size then it is pruned.</p>\n\n<p><br />\n </p>\n\n<h3>NAND data</h3>\n\n<p>Data is stored on NAND in \"chunks\". Currently each chunk is the same size as a NAND flash page (ie. 512 bytes + 16 byte spare). In the future we might decide to allow for different chunk sizes. Chunks can hold either:</p>\n\n<ul><li>\n	<p>A yaffs_ObjectHeader. This is the way a yaffs_Object gets stored on NAND.</p>\n	</li>\n	<li>\n	<p>A chunk of file data.</p>\n	</li>\n</ul><p>The 16 byte spare area contains:</p>\n\n<ul><li>\n	<p>8 bytes of tags,</p>\n	</li>\n	<li>\n	<p>6 bytes of ECC data</p>\n	</li>\n	<li>\n	<p>1 byte block status (used to identify damaged blocks)</p>\n	</li>\n	<li>\n	<p>1 byte data status (currently unused).</p>\n	</li>\n</ul><p>The tags are made up as follows:</p>\n\n<p>typedef struct</p>\n\n<p>{</p>\n\n<p>unsigned chunkId:20; //chunk number in file</p>\n\n<p>unsigned serialNumber:2; //serial number for chunk</p>\n\n<p>unsigned byteCount:10; //number of bytes of data used in this chunk</p>\n\n<p>unsigned objectId:18; //the object id that this chunk belongs to.</p>\n\n<p>unsigned ecc:12; //ECC on tags</p>\n\n<p>unsigned unusedStuff:2; //unused</p>\n\n<p>} yaffs_Tags;</p>\n\n<p> </p>\n\n<p>A chunkId of zero indicates that this chunk holds a yaffs_ObjectHeader. A non zero value indicates that this is a data chunk and the position of the chunk in the file (ie. the first chunk - at offset 0 - has chunkId 1). See yaffs_guts.c:yaffs_Scan () to see how this is done.</p>\n\n<p>When a chunk is replaced (eg. file details changed or a part of a file was overwritten), the new chunk is written before the old chunk is deleted. This means that we don\'t lose data if there is a power loss after the new chunk is created but before the old one is discarded, but it does mean that we can encounter the situation where we find both the old and the new chunks in flash. The serialNumber is incremented each time the chunk is written. 2 bits is sufficient to resolve any ambiguity.</p>\n\n<p>bytecount applies only to data chunks and tells how many of the data bytes are valid.</p>\n\n<p>objectId says which object this chunk belongs to.</p>\n\n<p>ecc is used to perform error correction on the tags. Another ecc field is used to error correct the data.</p>\n\n<p><br />\n </p>\n\n<h3>yaffs_ObjectHeader</h3>\n\n<p>typedef struct</p>\n\n<p>{</p>\n\n<p>yaffs_ObjectType type;</p>\n\n<p> </p>\n\n<p>// Apply to everything</p>\n\n<p>int parentObjectId;</p>\n\n<p>__u16 sum; // checksum of name</p>\n\n<p>char name[YAFFS_MAX_NAME_LENGTH + 1];</p>\n\n<p> </p>\n\n<p>// Thes following apply to directories, files, symlinks - not hard links</p>\n\n<p>__u32 st_mode; // protection</p>\n\n<p>__u32 st_uid; // user ID of owner</p>\n\n<p>__u32 st_gid; // group ID of owner</p>\n\n<p>__u32 st_atime; // time of last access</p>\n\n<p>__u32 st_mtime; // time of last modification</p>\n\n<p>__u32 st_ctime; // time of last change</p>\n\n<p> </p>\n\n<p>// File size applies to files only</p>\n\n<p>int fileSize;</p>\n\n<p> </p>\n\n<p>// Equivalent object id applies to hard links only.</p>\n\n<p>int equivalentObjectId;</p>\n\n<p>// alias only applies to symlinks</p>\n\n<p>char alias[YAFFS_MAX_ALIAS_LENGTH + 1];</p>\n\n<p> </p>\n\n<p> </p>\n\n<p>} yaffs_ObjectHeader;</p>\n\n<p> </p>\n\n<p>A yaffs_ObjectHeader is stored in NAND for every yaffs_Object.</p>\n\n<p>type holds the type of yaffs_Object (file,directory,hardlink or symlink).</p>\n\n<p>parentObject is the objectId of this object\'s parent. name holds the object\'s name. Together these form the directory structure of the file system. Also worth mention is sum. This is a \"checksum\" on the name which speeds directory searching (ie. when searching the directory we only compare the name for those entries where sum matches).</p>\n\n<p>Obvious stuff skipped....</p>\n\n<p>equivalentObjectId is used by hardlinks. A hardlink to an object uses this field to specify the object that this links to. This way of doing things is a bit different than the normal Linux way of doing things (ie. keeping the links distinct from the inode) but is simpler and uses less space except for a few corner cases with hardlinks.</p>\n\n<p>alias is used by symlinks to hold the symlink alias string. This limits the size of the symlink alias. In future we should expand YAFFS to use data chunks to store aliases too long to fit into the yaffs_ObjectHeader.</p>\n\n<p><br />\n </p>\n\n<h3>NAND Interface</h3>\n\n<p>All NAND access is performed via four functions pointed to by yaffs_Device. At the moment a chunk is a page.</p>\n\n<ul><li>\n	<p>int WriteChunkToNAND(struct yaffs_DeviceStruct *dev,int chunkInNAND, const __u8 *data, yaffs_Spare *spare)</p>\n	</li>\n	<li>\n	<p>int ReadChunkFromNAND(struct yaffs_DeviceStruct *dev,int chunkInNAND, __u8 *data, yaffs_Spare *spare);</p>\n	</li>\n	<li>\n	<p>int EraseBlockInNAND(struct yaffs_DeviceStruct *dev,int blockInNAND);</p>\n	</li>\n	<li>\n	<p>int InitialiseNAND(struct yaffs_DeviceStruct *dev);</p>\n	</li>\n</ul><p>In the Readxxx and Writexxx functions, the data and/or spare pointers may be NULL in which case these data transfers are ignored.</p>\n\n<p>A quick note about NAND:</p>\n\n<ul><li>\n	<p>NAND is not random access, but page oriented. Thus, we do all reads &amp; writes in pages.</p>\n	</li>\n	<li>\n	<p>Each NAND page holds 512 bytes of data and 16 \"spare\" bytes. Yaffs structures the spare area with tags used to identify what is stored in the data area. There are 32 such pages to a block.</p>\n	</li>\n	<li>\n	<p>NAND writes will only change 1 bits to 0. eg. if a byte holds 10110011 and you write 11011010 to it you will get the logical and of the two values: 10010010. The only way to get 1s again is to erase the entire block.</p>\n	</li>\n	<li>\n	<p>You may only write to a page a few times before erasing the entire block. Yaffs lives within these limitations. Each page only gets written to twice (once when written and once when discarded).</p>\n	</li>\n	<li>\n	<p>ECC is normally used with NAND to correct for single bit errors. YAFFS applies the ECC itself, so the MTD should not do this.</p>\n	</li>\n	<li>\n	<p>The current mtd interfaces are not particularly well suited to YAFFS and we will address the issue with the mtd group. (The mtd interface does not support page-oriented read/write which YAFFS would prefer).</p>\n	</li>\n</ul><p><br />\n </p>\n\n<h3>mkyaffs</h3>\n\n<p>mkyaffs is the tool to format a NAND mtd to be used for YAFFS. This is quite simple, just erase all the undamaged blocks. YAFFS treats erased blocks as free (empty) space.</p>\n\n<p><br />\n </p>\n\n<h2>Expected performance</h2>\n\n<p>The following numbers should give an indication of the performance we should expect from YAFFS.</p>\n\n<p>As an example, I\'ll use the following numbers. Since the hardware is capable of 50ns read/write, these numbers allow for some other ovberheads. Clearly though, the performance can be degraded in various ways.</p>\n\n<p>Seek10uS/page</p>\n\n<table><tr><td>\n			<p>Read</p>\n			</td>\n			<td>\n			<p>100nS/byte</p>\n			</td>\n		</tr><tr><td>\n			<p>Write</p>\n			</td>\n			<td>\n			<p>100nS/byte</p>\n			</td>\n		</tr><tr><td>\n			<p>Program</p>\n			</td>\n			<td>\n			<p>200uS/page</p>\n			</td>\n		</tr><tr><td>\n			<p>Erase</p>\n			</td>\n			<td>\n			<p>2mS/block</p>\n			</td>\n		</tr></table><p><br />\n </p>\n\n<p>From this we can derive some higher-level numbers:</p>\n\n<p>OperationTimeCalculation</p>\n\n<table><tr><td>\n			<p>Read spare</p>\n			</td>\n			<td>\n			<p>12uS</p>\n			</td>\n			<td>\n			<p>seek + 16 * read</p>\n			</td>\n		</tr><tr><td>\n			<p>Read page</p>\n			</td>\n			<td>\n			<p>63 uS</p>\n			</td>\n			<td>\n			<p>seek + 528 * read</p>\n			</td>\n		</tr><tr><td>\n			<p>Write page</p>\n			</td>\n			<td>\n			<p>326 uS</p>\n			</td>\n			<td>\n			<p>seek + 528 * write + program + read page (for verification)</p>\n			</td>\n		</tr><tr><td>\n			<p>Discard page</p>\n			</td>\n			<td>\n			<p>212 uS</p>\n			</td>\n			<td>\n			<p>seek + 16 * write + program</p>\n			</td>\n		</tr><tr><td>\n			<p>Overwrite page</p>\n			</td>\n			<td>\n			<p>538 uS</p>\n			</td>\n			<td>\n			<p>write page + discard page</p>\n			</td>\n		</tr><tr><td>\n			<p>Erase overhead per page</p>\n			</td>\n			<td>\n			<p>63uS</p>\n			</td>\n			<td>\n			<p>erase/32</p>\n			</td>\n		</tr></table><p><br />\n </p>\n\n<p>From this we can infer the following flash access times:</p>\n\n<p>OperationTimeCalculation</p>\n\n<table><tr><td>\n			<p>Read 1MB file</p>\n			</td>\n			<td>\n			<p>0.13s (about 7.5 MB/s)</p>\n			</td>\n			<td>\n			<p>2000 * read page</p>\n			</td>\n		</tr><tr><td>\n			<p>Write 1MB (clean system)</p>\n			</td>\n			<td>\n			<p>0.53s (about 1.8 MB/s)</p>\n			</td>\n			<td>\n			<p>2000 * write page</p>\n			</td>\n		</tr><tr><td>\n			<p>Overwrite 1MB file (no gc)</p>\n			</td>\n			<td>\n			<p>1.08s (about 0.9MB/s)</p>\n			</td>\n			<td>\n			<p>2000 * overwrite page</p>\n			</td>\n		</tr><tr><td>\n			<p>Overwrite 1MB with 50% gc</p>\n			</td>\n			<td>\n			<p>2.4s (about 0.4 MB/s)</p>\n			</td>\n			<td>\n			<p>2000 * overwrite page + 2000 * page copy (== overwrite page) + 4000 * erase overhead</p>\n			</td>\n		</tr><tr><td>\n			<p>Delete 1MB file</p>\n			</td>\n			<td>\n			<p>0.43s (about 2.2 MB/s)</p>\n			</td>\n			<td>\n			<p>2000 * discard page</p>\n			</td>\n		</tr><tr><td>\n			<p>Delete 1MB file with 50% gc</p>\n			</td>\n			<td>\n			<p>0.49s (about 2.0MB/s)</p>\n			</td>\n			<td>\n			<p>2000 * discard page + 1000 * erase overhead</p>\n			</td>\n		</tr></table><p> </p></div>\n      \";}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:31:\"config:filter.format.basic_html\";i:1;s:7:\"node:37\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;}}',-1,1510773547.556,1,'config:filter.format.basic_html node:37 node_view rendered','265'),('entity_view:node:37:search_result:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:2:\"37\";i:3;s:13:\"search_result\";}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:31:\"config:filter.format.basic_html\";i:1;s:7:\"node:37\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1510773547.554,1,'config:filter.format.basic_html node:37 node_view rendered','265'),('entity_view:node:380:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=306382ab744615fb554ac82b8f9e8907adc4fe4a2b05c5249851e41934fa227w_sveLbSRdoYPeYPVxMXDN8J2VTefekHxi6Q_I7xLhc','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:1369:\"<article data-quickedit-entity-id=\"node/380\" role=\"article\" class=\"contextual-region page full clearfix\" about=\"/support\" typeof=\"schema:WebPage\">\n\n  \n    <div data-contextual-id=\"node:node=380:changed=1441709157&amp;langcode=en\"></div>  <span property=\"schema:name\" content=\"Support\" class=\"hidden\"></span>\n\n\n  \n  <div class=\"content\">\n    \n            <div property=\"schema:text\" data-quickedit-field-id=\"node/380/body/und/full\" class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\">\n<p>We offer support for Yaffs through the <a href=\"http://stoneboat.aleph1.co.uk/mailman/listinfo/yaffs\">Yaffs mailing list</a>. It\'s best to start by searching the <a href=\"http://www.aleph1.co.uk/lurker/list/yaffs.html\">list archive</a> to see if someone has already asked the same question.</p>\n<p>If you feel uncomfortable asking your question on an open mailing list you can try mailing us, but we (or you) may say \'You should be paying for this\', and if that is agreed, then we can accept payments via PayPal or other means.</p>\n<p>Serious long-term work is best done as a negotiated contract; for instance we have built special features for clients with very particular needs. If you think you may want this sort of help then <a href=\"/contact\">contact us</a>, telling us a bit about your problem.</p>\n</div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:3:{s:14:\"html_head_link\";a:12:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:8:\"/support\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:9:\"/node/380\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:11:\"delete-form\";s:4:\"href\";s:16:\"/node/380/delete\";}i:1;b:1;}i:3;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"edit-form\";s:4:\"href\";s:14:\"/node/380/edit\";}i:1;b:1;}i:4;a:2:{i:0;a:2:{s:3:\"rel\";s:15:\"version-history\";s:4:\"href\";s:19:\"/node/380/revisions\";}i:1;b:1;}i:5;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:8:\"/support\";}i:1;b:1;}i:6;a:2:{i:0;a:2:{s:3:\"rel\";s:17:\"book-outline-form\";s:4:\"href\";s:17:\"/node/380/outline\";}i:1;b:1;}i:7;a:2:{i:0;a:2:{s:3:\"rel\";s:16:\"book-remove-form\";s:4:\"href\";s:24:\"/node/380/outline/remove\";}i:1;b:1;}i:8;a:2:{i:0;a:2:{s:3:\"rel\";s:10:\"devel-load\";s:4:\"href\";s:15:\"/devel/node/380\";}i:1;b:1;}i:9;a:2:{i:0;a:2:{s:3:\"rel\";s:12:\"devel-render\";s:4:\"href\";s:22:\"/devel/node/380/render\";}i:1;b:1;}i:10;a:2:{i:0;a:2:{s:3:\"rel\";s:16:\"devel-definition\";s:4:\"href\";s:26:\"/devel/node/380/definition\";}i:1;b:1;}i:11;a:2:{i:0;a:2:{s:3:\"rel\";s:11:\"token-devel\";s:4:\"href\";s:21:\"/node/380/devel/token\";}i:1;b:1;}}s:7:\"library\";a:1:{i:0;s:20:\"history/mark-as-read\";}s:14:\"drupalSettings\";a:1:{s:7:\"history\";a:1:{s:17:\"nodesToMarkAsRead\";a:1:{i:380;b:1;}}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:30:\"config:filter.format.full_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:380\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:94:\"<span property=\"schema:name\" data-quickedit-field-id=\"node/380/title/und/full\">Support</span>\n\";}}',-1,1516804949.923,1,'config:filter.format.full_html config:system.site node:380 node_view rendered user:1','307'),('entity_view:node:380:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b0LyFRe20qwftKh_lq7NEMaWRH_kUSfAp_OauAneQ4YA4','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:1185:\"<article role=\"article\" about=\"/support\" typeof=\"schema:WebPage\" class=\"page full clearfix\">\n\n  \n      <span property=\"schema:name\" content=\"Support\" class=\"hidden\"></span>\n\n\n  \n  <div class=\"content\">\n    \n            <div property=\"schema:text\" class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\">\n<p>We offer support for Yaffs through the <a href=\"http://stoneboat.aleph1.co.uk/mailman/listinfo/yaffs\">Yaffs mailing list</a>. It\'s best to start by searching the <a href=\"http://www.aleph1.co.uk/lurker/list/yaffs.html\">list archive</a> to see if someone has already asked the same question.</p>\n<p>If you feel uncomfortable asking your question on an open mailing list you can try mailing us, but we (or you) may say \'You should be paying for this\', and if that is agreed, then we can accept payments via PayPal or other means.</p>\n<p>Serious long-term work is best done as a negotiated contract; for instance we have built special features for clients with very particular needs. If you think you may want this sort of help then <a href=\"/contact\">contact us</a>, telling us a bit about your problem.</p>\n</div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:8:\"/support\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:9:\"/node/380\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:8:\"/support\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:30:\"config:filter.format.full_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:380\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:44:\"<span property=\"schema:name\">Support</span>\n\";}}',-1,1510656787.103,1,'config:filter.format.full_html config:system.site node:380 node_view rendered user:1','307'),('entity_view:node:380:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=306382ab744615fb554ac82b8f9e8907adc4fe4a2b05c5249851e41934fa227b:[user.roles:anonymous]=1','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"380\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:30:\"config:filter.format.full_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:380\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1516804949.920,1,'config:filter.format.full_html config:system.site node:380 node_view rendered user:1','307'),('entity_view:node:380:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"380\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:30:\"config:filter.format.full_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:380\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1510656787.093,1,'config:filter.format.full_html config:system.site node:380 node_view rendered user:1','307'),('entity_view:node:380:search_result:[languages:language_interface]=en:[theme]=yaffs:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:1001:\"<span property=\"schema:name\">Support</span>\n\n            <div property=\"schema:text\" class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\">\n<p>We offer support for Yaffs through the <a href=\"http://stoneboat.aleph1.co.uk/mailman/listinfo/yaffs\">Yaffs mailing list</a>. It\'s best to start by searching the <a href=\"http://www.aleph1.co.uk/lurker/list/yaffs.html\">list archive</a> to see if someone has already asked the same question.</p>\n<p>If you feel uncomfortable asking your question on an open mailing list you can try mailing us, but we (or you) may say \'You should be paying for this\', and if that is agreed, then we can accept payments via PayPal or other means.</p>\n<p>Serious long-term work is best done as a negotiated contract; for instance we have built special features for clients with very particular needs. If you think you may want this sort of help then <a href=\"/contact\">contact us</a>, telling us a bit about your problem.</p>\n</div>\n      \";}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:8:\"node:380\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;}}',-1,1512113382.158,1,'config:filter.format.full_html node:380 node_view rendered','294'),('entity_view:node:380:search_result:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"380\";i:3;s:13:\"search_result\";}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:8:\"node:380\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1512113382.156,1,'config:filter.format.full_html node:380 node_view rendered','294'),('entity_view:node:382:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=306382ab744615fb554ac82b8f9e8907adc4fe4a2b05c5249851e41934fa227xuFKueVhoYqUIudolkq4ipS-DOMwHrl3Fdmu-erGiVA','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:2821:\"<article data-quickedit-entity-id=\"node/382\" role=\"article\" class=\"contextual-region page full clearfix\" about=\"/get-yaffs\" typeof=\"schema:WebPage\">\n\n  \n    <div data-contextual-id=\"node:node=382:changed=1502716247&amp;langcode=en\"></div>  <span property=\"schema:name\" content=\"Get Yaffs\" class=\"hidden\"></span>\n\n\n  \n  <div class=\"content\">\n    \n            <div property=\"schema:text\" data-quickedit-field-id=\"node/382/body/und/full\" class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\">\n<h2>Licences</h2>\n<p>Yaffs belongs to Aleph One Limited. It&nbsp;is available under two licences:</p>\n<ul>\n<li>The <a href=\"https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html\">GPL Version 2</a> (GNU Public Licence, Version 2). You can try it for free under this licence, and you can use Yaffs&nbsp;in GPL licensed software.&nbsp;</li>\n<li>A proprietary, <a href=\"commercial-licences\">commercial licence</a> from Aleph One Limited, for use with proprietary, or closed-source software.&nbsp;These licences are non-exclusive, perpetual, world-wide, royalty-free and paid for with a single fee for one product.</li>\n</ul>\n<p>Yaffs functionality is the same under both licences, and both licences are royalty-free, but the terms of the GPL place significant obligations on<strong>&nbsp;all who&nbsp;use Yaffs under GPL</strong>. Please be certain to <a href=\"/yaffs-gpl\">understand these legal obligations</a> before distributing any software together with Yaffs.</p>\n<h2>Download options</h2>\n<p>We use <a href=\"https://git-scm.com/\">Git</a> to manage our software development.</p>\n<ul>\n<li>To browse or download code,&nbsp;<strong><a href=\"http://www.aleph1.co.uk/gitweb?p=yaffs2.git;a=summary\" target=\"_self\">access our Git repository over the web</a></strong>. This is also the best option if you are behind a firewall that does not allow direct Git&nbsp;access.</li>\n<li>To get a tarball of the top of the tree, just click \'snapshot\' for the release that you want, or to quickly obtain a snapshot of the top of the tree you can <a href=\"http://aleph1.co.uk/gitweb?p=yaffs2.git;a=snapshot;h=HEAD;\" target=\"_self\">use this URL</a>.</li>\n<li>Clone Yaffs using:</li>\n</ul>\n<pre>\ngit clone git://www.aleph1.co.uk/yaffs2\n</pre>\n<ul>\n<li>If you are a registered developer with a server account you can get read/write access using:</li>\n</ul>\n<pre>\ngit clone ssh://www.aleph1.co.uk/home/aleph1/git/yaffs2</pre>\n<p>&nbsp;&nbsp;</p>\n<p>If you have any questions, or would like to buy a commercial licence, please contact us either at&nbsp;+44 (0)1223 811679 or email&nbsp; <a href=\"denied:mailto:sales@aleph1.co.uk\">sales@aleph1.co.uk</a>&nbsp; or see our Contacts page:-&nbsp; <a href=\"http://www.aleph1.co.uk/contact\">http://www.aleph1.co.uk/contact</a></p>\n</div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:3:{s:14:\"html_head_link\";a:12:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:10:\"/get-yaffs\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:9:\"/node/382\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:11:\"delete-form\";s:4:\"href\";s:16:\"/node/382/delete\";}i:1;b:1;}i:3;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"edit-form\";s:4:\"href\";s:14:\"/node/382/edit\";}i:1;b:1;}i:4;a:2:{i:0;a:2:{s:3:\"rel\";s:15:\"version-history\";s:4:\"href\";s:19:\"/node/382/revisions\";}i:1;b:1;}i:5;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:10:\"/get-yaffs\";}i:1;b:1;}i:6;a:2:{i:0;a:2:{s:3:\"rel\";s:17:\"book-outline-form\";s:4:\"href\";s:17:\"/node/382/outline\";}i:1;b:1;}i:7;a:2:{i:0;a:2:{s:3:\"rel\";s:16:\"book-remove-form\";s:4:\"href\";s:24:\"/node/382/outline/remove\";}i:1;b:1;}i:8;a:2:{i:0;a:2:{s:3:\"rel\";s:10:\"devel-load\";s:4:\"href\";s:15:\"/devel/node/382\";}i:1;b:1;}i:9;a:2:{i:0;a:2:{s:3:\"rel\";s:12:\"devel-render\";s:4:\"href\";s:22:\"/devel/node/382/render\";}i:1;b:1;}i:10;a:2:{i:0;a:2:{s:3:\"rel\";s:16:\"devel-definition\";s:4:\"href\";s:26:\"/devel/node/382/definition\";}i:1;b:1;}i:11;a:2:{i:0;a:2:{s:3:\"rel\";s:11:\"token-devel\";s:4:\"href\";s:21:\"/node/382/devel/token\";}i:1;b:1;}}s:7:\"library\";a:1:{i:0;s:20:\"history/mark-as-read\";}s:14:\"drupalSettings\";a:1:{s:7:\"history\";a:1:{s:17:\"nodesToMarkAsRead\";a:1:{i:382;b:1;}}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:30:\"config:filter.format.full_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:382\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:96:\"<span property=\"schema:name\" data-quickedit-field-id=\"node/382/title/und/full\">Get Yaffs</span>\n\";}}',-1,1515517514.562,1,'config:filter.format.full_html config:system.site node:382 node_view rendered user:1','313'),('entity_view:node:382:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b0LnFj55D7sTyFxWVEYt2PXcC7uR3fK7Qi60hMtrtYzCw','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:2637:\"<article role=\"article\" about=\"/get-yaffs\" typeof=\"schema:WebPage\" class=\"page full clearfix\">\n\n  \n      <span property=\"schema:name\" content=\"Get Yaffs\" class=\"hidden\"></span>\n\n\n  \n  <div class=\"content\">\n    \n            <div property=\"schema:text\" class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\">\n<h2>Licences</h2>\n<p>Yaffs belongs to Aleph One Limited. It&nbsp;is available under two licences:</p>\n<ul>\n<li>The <a href=\"https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html\">GPL Version 2</a> (GNU Public Licence, Version 2). You can try it for free under this licence, and you can use Yaffs&nbsp;in GPL licensed software.&nbsp;</li>\n<li>A proprietary, <a href=\"commercial-licences\">commercial licence</a> from Aleph One Limited, for use with proprietary, or closed-source software.&nbsp;These licences are non-exclusive, perpetual, world-wide, royalty-free and paid for with a single fee for one product.</li>\n</ul>\n<p>Yaffs functionality is the same under both licences, and both licences are royalty-free, but the terms of the GPL place significant obligations on<strong>&nbsp;all who&nbsp;use Yaffs under GPL</strong>. Please be certain to <a href=\"/yaffs-gpl\">understand these legal obligations</a> before distributing any software together with Yaffs.</p>\n<h2>Download options</h2>\n<p>We use <a href=\"https://git-scm.com/\">Git</a> to manage our software development.</p>\n<ul>\n<li>To browse or download code,&nbsp;<strong><a href=\"http://www.aleph1.co.uk/gitweb?p=yaffs2.git;a=summary\" target=\"_self\">access our Git repository over the web</a></strong>. This is also the best option if you are behind a firewall that does not allow direct Git&nbsp;access.</li>\n<li>To get a tarball of the top of the tree, just click \'snapshot\' for the release that you want, or to quickly obtain a snapshot of the top of the tree you can <a href=\"http://aleph1.co.uk/gitweb?p=yaffs2.git;a=snapshot;h=HEAD;\" target=\"_self\">use this URL</a>.</li>\n<li>Clone Yaffs using:</li>\n</ul>\n<pre>\ngit clone git://www.aleph1.co.uk/yaffs2\n</pre>\n<ul>\n<li>If you are a registered developer with a server account you can get read/write access using:</li>\n</ul>\n<pre>\ngit clone ssh://www.aleph1.co.uk/home/aleph1/git/yaffs2</pre>\n<p>&nbsp;&nbsp;</p>\n<p>If you have any questions, or would like to buy a commercial licence, please contact us either at&nbsp;+44 (0)1223 811679 or email&nbsp; <a href=\"denied:mailto:sales@aleph1.co.uk\">sales@aleph1.co.uk</a>&nbsp; or see our Contacts page:-&nbsp; <a href=\"http://www.aleph1.co.uk/contact\">http://www.aleph1.co.uk/contact</a></p>\n</div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:10:\"/get-yaffs\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:9:\"/node/382\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:10:\"/get-yaffs\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:30:\"config:filter.format.full_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:382\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:46:\"<span property=\"schema:name\">Get Yaffs</span>\n\";}}',-1,1510656948.254,1,'config:filter.format.full_html config:system.site node:382 node_view rendered user:1','313'),('entity_view:node:382:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=306382ab744615fb554ac82b8f9e8907adc4fe4a2b05c5249851e41934fa227b:[user.roles:anonymous]=1','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"382\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:30:\"config:filter.format.full_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:382\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1515517514.560,1,'config:filter.format.full_html config:system.site node:382 node_view rendered user:1','313'),('entity_view:node:382:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"382\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:30:\"config:filter.format.full_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:382\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1510656948.239,1,'config:filter.format.full_html config:system.site node:382 node_view rendered user:1','313'),('entity_view:node:382:search_result:[languages:language_interface]=en:[theme]=yaffs:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:2451:\"<span property=\"schema:name\">Get Yaffs</span>\n\n            <div property=\"schema:text\" class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\">\n<h2>Licences</h2>\n<p>Yaffs belongs to Aleph One Limited. It&nbsp;is available under two licences:</p>\n<ul>\n<li>The <a href=\"https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html\">GPL Version 2</a> (GNU Public Licence, Version 2). You can try it for free under this licence, and you can use Yaffs&nbsp;in GPL licensed software.&nbsp;</li>\n<li>A proprietary, <a href=\"commercial-licences\">commercial licence</a> from Aleph One Limited, for use with proprietary, or closed-source software.&nbsp;These licences are non-exclusive, perpetual, world-wide, royalty-free and paid for with a single fee for one product.</li>\n</ul>\n<p>Yaffs functionality is the same under both licences, and both licences are royalty-free, but the terms of the GPL place significant obligations on<strong>&nbsp;all who&nbsp;use Yaffs under GPL</strong>. Please be certain to <a href=\"/yaffs-gpl\">understand these legal obligations</a> before distributing any software together with Yaffs.</p>\n<h2>Download options</h2>\n<p>We use <a href=\"https://git-scm.com/\">Git</a> to manage our software development.</p>\n<ul>\n<li>To browse or download code,&nbsp;<strong><a href=\"http://www.aleph1.co.uk/gitweb?p=yaffs2.git;a=summary\" target=\"_self\">access our Git repository over the web</a></strong>. This is also the best option if you are behind a firewall that does not allow direct Git&nbsp;access.</li>\n<li>To get a tarball of the top of the tree, just click \'snapshot\' for the release that you want, or to quickly obtain a snapshot of the top of the tree you can <a href=\"http://aleph1.co.uk/gitweb?p=yaffs2.git;a=snapshot;h=HEAD;\" target=\"_self\">use this URL</a>.</li>\n<li>Clone Yaffs using:</li>\n</ul>\n<pre>\ngit clone git://www.aleph1.co.uk/yaffs2\n</pre>\n<ul>\n<li>If you are a registered developer with a server account you can get read/write access using:</li>\n</ul>\n<pre>\ngit clone ssh://www.aleph1.co.uk/home/aleph1/git/yaffs2</pre>\n<p>&nbsp;&nbsp;</p>\n<p>If you have any questions, or would like to buy a commercial licence, please contact us either at&nbsp;+44 (0)1223 811679 or email&nbsp; <a href=\"denied:mailto:sales@aleph1.co.uk\">sales@aleph1.co.uk</a>&nbsp; or see our Contacts page:-&nbsp; <a href=\"http://www.aleph1.co.uk/contact\">http://www.aleph1.co.uk/contact</a></p>\n</div>\n      \";}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:8:\"node:382\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;}}',-1,1511851263.425,1,'config:filter.format.full_html node:382 node_view rendered','300'),('entity_view:node:382:search_result:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"382\";i:3;s:13:\"search_result\";}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:8:\"node:382\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1511851263.423,1,'config:filter.format.full_html node:382 node_view rendered','300'),('entity_view:node:384:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b0uN-ARabSB00JcvuxlwvzBghUbgT0T8wa7iVnEgZhWhU','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:853:\"<article role=\"article\" about=\"/features/royalty-free\" class=\"what-is-special-about-yaffs is-promoted full clearfix\">\n\n  \n    \n\n  \n  <div class=\"content\">\n    \n  <div class=\"field field--name-field-icon-text field--type-string field--label-above\">\n    <div class=\"field--label\">Icon - text</div>\n              <div class=\"field--item\">fa-thumbs-up</div>\n          </div>\n\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p><strong>100% ROYALTY FREE</strong></p>\n\n<p>Of course there\'s no royalty when you use Yaffs under the GPL; it\'s the GPL!</p>\n\n<p>Our commercial licences are paid for once at the time of buying the Licence, and so they are also royalty free. No accounting and no need to worry about increasing costs as you make or sell more units.</p></div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:22:\"/features/royalty-free\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:9:\"/node/384\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:22:\"/features/royalty-free\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:384\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:30:\"<span>Royalty Free... </span>\n\";}}',-1,1511676239.886,1,'config:filter.format.basic_html config:system.site node:384 node_view rendered user:1','278'),('entity_view:node:384:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"384\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:384\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1511676239.884,1,'config:filter.format.basic_html config:system.site node:384 node_view rendered user:1','278'),('entity_view:node:384:search_result:[languages:language_interface]=en:[theme]=yaffs:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:702:\"<span>Royalty Free... </span>\n\n  <div class=\"field field--name-field-icon-text field--type-string field--label-above\">\n    <div class=\"field--label\">Icon - text</div>\n              <div class=\"field--item\">fa-thumbs-up</div>\n          </div>\n\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p><strong>100% ROYALTY FREE</strong></p>\n\n<p>Of course there\'s no royalty when you use Yaffs under the GPL; it\'s the GPL!</p>\n\n<p>Our commercial licences are paid for once at the time of buying the Licence, and so they are also royalty free. No accounting and no need to worry about increasing costs as you make or sell more units.</p></div>\n      \";}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:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:384\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;}}',-1,1511851263.395,1,'config:filter.format.basic_html node:384 node_view rendered','265'),('entity_view:node:384:search_result:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"384\";i:3;s:13:\"search_result\";}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:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:384\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1511851263.393,1,'config:filter.format.basic_html node:384 node_view rendered','265'),('entity_view:node:384:teaser:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:823:\"<article role=\"article\" about=\"/features/royalty-free\" class=\"what-is-special-about-yaffs is-promoted teaser clearfix\">\n\n  \n      <h2>\n      <a href=\"/features/royalty-free\" rel=\"bookmark\"><span>Royalty Free... </span>\n</a>\n    </h2>\n    \n\n  \n  <div class=\"content\">\n    <ul class=\"links inline list-inline\"><li class=\"node-readmore\"><a href=\"/features/royalty-free\" rel=\"tag\" title=\"Royalty Free... \" hreflang=\"und\">Read more<span class=\"visually-hidden\"> about Royalty Free... </span></a></li></ul>\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\">Whether you use Yaffs under the GNU General Public Licence or under a commercial licence, Yaffs is free of any royalty. No need to worry about rising costs for your hit product!</div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:0:{}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:5:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";}s:4:\"tags\";a:4:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:384\";i:2;s:9:\"node_view\";i:3;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}}',-1,1510950428.214,1,'config:filter.format.basic_html node:384 node_view rendered user:1','272'),('entity_view:node:384:teaser:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"384\";i:3;s:6:\"teaser\";}s:8:\"contexts\";a:5:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";}s:4:\"tags\";a:4:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:384\";i:2;s:9:\"node_view\";i:3;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1510950428.212,1,'config:filter.format.basic_html node:384 node_view rendered user:1','272'),('entity_view:node:385:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b0tiH6t21ew1Df-kuN6um3YhfoiMqxHz6X3zh-1mCr0xc','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:924:\"<article role=\"article\" about=\"/features/robust-flash-file-system\" class=\"what-is-special-about-yaffs is-promoted full clearfix\">\n\n  \n    \n\n  \n  <div class=\"content\">\n    \n  <div class=\"field field--name-field-icon-text field--type-string field--label-above\">\n    <div class=\"field--label\">Icon - text</div>\n              <div class=\"field--item\">fa-shield</div>\n          </div>\n\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p>As part of our regular testing, we run power-fail tests. Whether it\'s during a read or a write, Yaffs is designed to preserve your existing data during a device power failure. And because Yaffs is open source, you can download the tests and run them yourself in the most severe conditions you expect the product to encounter. See:- http://www.yaffs.net/documents/yaffs-robustness-and-testing</p></div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:34:\"/features/robust-flash-file-system\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:9:\"/node/385\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:34:\"/features/robust-flash-file-system\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:385\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:43:\"<span>A robust flash file system...</span>\n\";}}',-1,1511331019.997,1,'config:filter.format.basic_html config:system.site node:385 node_view rendered user:1','278'),('entity_view:node:385:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"385\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:385\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1511331019.995,1,'config:filter.format.basic_html config:system.site node:385 node_view rendered user:1','278'),('entity_view:node:385:search_result:[languages:language_interface]=en:[theme]=yaffs:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:774:\"<span>A robust flash file system...</span>\n\n  <div class=\"field field--name-field-icon-text field--type-string field--label-above\">\n    <div class=\"field--label\">Icon - text</div>\n              <div class=\"field--item\">fa-shield</div>\n          </div>\n\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p>As part of our regular testing, we run power-fail tests. Whether it\'s during a read or a write, Yaffs is designed to preserve your existing data during a device power failure. And because Yaffs is open source, you can download the tests and run them yourself in the most severe conditions you expect the product to encounter. See:- http://www.yaffs.net/documents/yaffs-robustness-and-testing</p></div>\n      \";}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:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:385\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;}}',-1,1511851263.382,1,'config:filter.format.basic_html node:385 node_view rendered','265'),('entity_view:node:385:search_result:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"385\";i:3;s:13:\"search_result\";}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:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:385\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1511851263.380,1,'config:filter.format.basic_html node:385 node_view rendered','265'),('entity_view:node:385:teaser:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:856:\"<article role=\"article\" about=\"/features/robust-flash-file-system\" class=\"what-is-special-about-yaffs is-promoted teaser clearfix\">\n\n  \n      <h2>\n      <a href=\"/features/robust-flash-file-system\" rel=\"bookmark\"><span>A robust flash file system...</span>\n</a>\n    </h2>\n    \n\n  \n  <div class=\"content\">\n    <ul class=\"links inline list-inline\"><li class=\"node-readmore\"><a href=\"/features/robust-flash-file-system\" rel=\"tag\" title=\"A robust flash file system...\" hreflang=\"und\">Read more<span class=\"visually-hidden\"> about A robust flash file system...</span></a></li></ul>\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\">After more than 100,000 <strong>random</strong> power-failures during reading or writing, a test file showed NO data corruption at all!</div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:0:{}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:5:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";}s:4:\"tags\";a:4:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:385\";i:2;s:9:\"node_view\";i:3;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}}',-1,1510950428.201,1,'config:filter.format.basic_html node:385 node_view rendered user:1','272'),('entity_view:node:385:teaser:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"385\";i:3;s:6:\"teaser\";}s:8:\"contexts\";a:5:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";}s:4:\"tags\";a:4:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:385\";i:2;s:9:\"node_view\";i:3;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1510950428.198,1,'config:filter.format.basic_html node:385 node_view rendered user:1','272'),('entity_view:node:388:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b082RgWLU_r9OMCMtQLEKzVwC_Evsefh6AyK6BvkdMH5c','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:1092:\"<article role=\"article\" about=\"/features/yaffs-open-source\" class=\"what-is-special-about-yaffs is-promoted full clearfix\">\n\n  \n    \n\n  \n  <div class=\"content\">\n    \n  <div class=\"field field--name-field-icon-text field--type-string field--label-above\">\n    <div class=\"field--label\">Icon - text</div>\n              <div class=\"field--item\">fa-heart</div>\n          </div>\n\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p>Yaffs is downloadable with a GNU General Public Licence v.2, as at  http://www.gnu.org/licenses/gpl-2.0.html   You get the source code, with all the benefits that brings. And of course, if you buy a commercial licence, you get the source code too, but without the encumberance of your responsibilities under the GNU GPL</p>\n\n<p>Because it\'s Open Source, you can always see what the code is doing and trace through; and having the code means you\'ll never be in a situation where you are critically dependent on us, either from a technical or a business perspective.</p></div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:27:\"/features/yaffs-open-source\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:9:\"/node/388\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:27:\"/features/yaffs-open-source\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:388\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:37:\"<span>Yaffs is Open Source...</span>\n\";}}',-1,1511101189.597,1,'config:filter.format.basic_html config:system.site node:388 node_view rendered user:1','278'),('entity_view:node:388:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"388\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:388\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1511101189.594,1,'config:filter.format.basic_html config:system.site node:388 node_view rendered user:1','278'),('entity_view:node:388:search_result:[languages:language_interface]=en:[theme]=yaffs:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:943:\"<span>Yaffs is Open Source...</span>\n\n  <div class=\"field field--name-field-icon-text field--type-string field--label-above\">\n    <div class=\"field--label\">Icon - text</div>\n              <div class=\"field--item\">fa-heart</div>\n          </div>\n\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p>Yaffs is downloadable with a GNU General Public Licence v.2, as at  http://www.gnu.org/licenses/gpl-2.0.html   You get the source code, with all the benefits that brings. And of course, if you buy a commercial licence, you get the source code too, but without the encumberance of your responsibilities under the GNU GPL</p>\n\n<p>Because it\'s Open Source, you can always see what the code is doing and trace through; and having the code means you\'ll never be in a situation where you are critically dependent on us, either from a technical or a business perspective.</p></div>\n      \";}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:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:388\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;}}',-1,1511851263.368,1,'config:filter.format.basic_html node:388 node_view rendered','265'),('entity_view:node:388:search_result:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"388\";i:3;s:13:\"search_result\";}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:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:388\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1511851263.367,1,'config:filter.format.basic_html node:388 node_view rendered','265'),('entity_view:node:388:teaser:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:830:\"<article role=\"article\" about=\"/features/yaffs-open-source\" class=\"what-is-special-about-yaffs is-promoted teaser clearfix\">\n\n  \n      <h2>\n      <a href=\"/features/yaffs-open-source\" rel=\"bookmark\"><span>Yaffs is Open Source...</span>\n</a>\n    </h2>\n    \n\n  \n  <div class=\"content\">\n    <ul class=\"links inline list-inline\"><li class=\"node-readmore\"><a href=\"/features/yaffs-open-source\" rel=\"tag\" title=\"Yaffs is Open Source...\" hreflang=\"und\">Read more<span class=\"visually-hidden\"> about Yaffs is Open Source...</span></a></li></ul>\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\">You can have a look at the code at any time. <a href=\"/downloads\">Download it now</a>! And it\'s suitable for GPL and commercially licensed projects.</div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:0:{}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:5:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";}s:4:\"tags\";a:4:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:388\";i:2;s:9:\"node_view\";i:3;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}}',-1,1510950428.175,1,'config:filter.format.basic_html node:388 node_view rendered user:1','272'),('entity_view:node:388:teaser:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"388\";i:3;s:6:\"teaser\";}s:8:\"contexts\";a:5:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";}s:4:\"tags\";a:4:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:388\";i:2;s:9:\"node_view\";i:3;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1510950428.172,1,'config:filter.format.basic_html node:388 node_view rendered user:1','272'),('entity_view:node:389:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b0zAVTUHtpcNpIGqZBsMpenN41h2TavT32Xv7Fj96BITw','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:907:\"<article role=\"article\" about=\"/features/tried-and-tested-millions-devices\" class=\"what-is-special-about-yaffs is-promoted full clearfix\">\n\n  \n    \n\n  \n  <div class=\"content\">\n    \n  <div class=\"field field--name-field-icon-text field--type-string field--label-above\">\n    <div class=\"field--label\">Icon - text</div>\n              <div class=\"field--item\">fa-mobile-phone</div>\n          </div>\n\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p>Yaffs is the leading Flash file system, running in millions of devices. It\'s been used on Linux computers, in cameras, mobile phones, hard drives, and on many custom boards. People and companies trust it to keep their data safe. Read more about <a href=\"/documents/yaffs-robustness-and-testing\">how we test Yaffs in our Robustness and Testing white paper</a>.</p></div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:43:\"/features/tried-and-tested-millions-devices\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:9:\"/node/389\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:43:\"/features/tried-and-tested-millions-devices\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:389\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:56:\"<span>Tried and tested in millions of devices...</span>\n\";}}',-1,1511272915.949,1,'config:filter.format.basic_html config:system.site node:389 node_view rendered user:1','278'),('entity_view:node:389:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"389\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:389\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1511272915.946,1,'config:filter.format.basic_html config:system.site node:389 node_view rendered user:1','278'),('entity_view:node:389:search_result:[languages:language_interface]=en:[theme]=yaffs:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:761:\"<span>Tried and tested in millions of devices...</span>\n\n  <div class=\"field field--name-field-icon-text field--type-string field--label-above\">\n    <div class=\"field--label\">Icon - text</div>\n              <div class=\"field--item\">fa-mobile-phone</div>\n          </div>\n\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p>Yaffs is the leading Flash file system, running in millions of devices. It\'s been used on Linux computers, in cameras, mobile phones, hard drives, and on many custom boards. People and companies trust it to keep their data safe. Read more about <a href=\"/documents/yaffs-robustness-and-testing\">how we test Yaffs in our Robustness and Testing white paper</a>.</p></div>\n      \";}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:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:389\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;}}',-1,1511851263.354,1,'config:filter.format.basic_html node:389 node_view rendered','265'),('entity_view:node:389:search_result:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"389\";i:3;s:13:\"search_result\";}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:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:389\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1511851263.351,1,'config:filter.format.basic_html node:389 node_view rendered','265'),('entity_view:node:389:teaser:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:963:\"<article role=\"article\" about=\"/features/tried-and-tested-millions-devices\" class=\"what-is-special-about-yaffs is-promoted teaser clearfix\">\n\n  \n      <h2>\n      <a href=\"/features/tried-and-tested-millions-devices\" rel=\"bookmark\"><span>Tried and tested in millions of devices...</span>\n</a>\n    </h2>\n    \n\n  \n  <div class=\"content\">\n    <ul class=\"links inline list-inline\"><li class=\"node-readmore\"><a href=\"/features/tried-and-tested-millions-devices\" rel=\"tag\" title=\"Tried and tested in millions of devices...\" hreflang=\"und\">Read more<span class=\"visually-hidden\"> about Tried and tested in millions of devices...</span></a></li></ul>\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\">Yaffs is widely used in Linux and proprietary commercial RTOSs. It\'s been included in hundreds of devices, and shipped as part of Google\'s Android, with millions of units sold.</div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:0:{}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:5:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";}s:4:\"tags\";a:4:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:389\";i:2;s:9:\"node_view\";i:3;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}}',-1,1510950428.161,1,'config:filter.format.basic_html node:389 node_view rendered user:1','272'),('entity_view:node:389:teaser:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"389\";i:3;s:6:\"teaser\";}s:8:\"contexts\";a:5:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";}s:4:\"tags\";a:4:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:389\";i:2;s:9:\"node_view\";i:3;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1510950428.159,1,'config:filter.format.basic_html node:389 node_view rendered user:1','272'),('entity_view:node:38:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01nbugb5peSIBdpsE6Z4DmkkmuSNwvcIWS_vkr6UEuiCs','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:10179:\"<article role=\"article\" about=\"/yaffs-2-specification\" typeof=\"schema:WebPage\" class=\"page is-sticky full clearfix\">\n\n  \n      <span property=\"schema:name\" content=\"Yaffs 2 Specification\" class=\"hidden\"></span>\n\n\n  \n  <div class=\"content\">\n    \n            <div property=\"schema:text\" class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\">\n<h2>Summary</h2>\n<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>\n<p>To achieve this, a new design is used which also realises the following benefits:</p>\n<ul>\n<li>\n<p>Zero page rewrites means faster operation. (Yaffs1 uses a single rewrite in the spare area to delete a page).</p>\n </li>\n<li>\n<p>Ability to exploit simultaneous page programming on some chips.</p>\n </li>\n<li>\n<p>Improves performance relative to Yaffs1 speed(write:1.5x to 5x, delete: 4x, garbage collection: 2x)</p>\n </li>\n<li>\n<p>Lower RAM footprint (approx. 25% to 50% of Yaffs1).</p>\n </li>\n<li>\n<p>Can support Toshiba/Sandisk MLC parts.</p>\n </li>\n</ul>\n<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>\n<h4>Method</h4>\n<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>\n<p>Instead Yaffs2 uses two mechanisms to resolve data state.</p>\n<ul>\n<li>\n<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>\n </li>\n<li>\n<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>\n </li>\n<li>\n<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>\n </li>\n</ul>\n<p>This changes erasure slightly:</p>\n<ul>\n<li>\n<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>\n </li>\n</ul>\n<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>\n<h4>Tag structure</h4>\n<p>Each chunk in Yaffs2 has the following information:</p>\n<p>Field</p>\n<p>Comment</p>\n<p>Size for 1kb chunks</p>\n<p>Size for 2kB chunks</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>blockState</p>\n   </td>\n  <td>\n  <p>Block state. non-0xFF for bad block</p>\n   </td>\n  <td>\n  <p>1 byte</p>\n   </td>\n  <td>\n  <p>1 byte</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>chunkId</p>\n   </td>\n  <td>\n  <p>32-bit chunk Id</p>\n   </td>\n  <td>\n  <p>4 bytes</p>\n   </td>\n  <td>\n  <p>4 bytes</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>objectId</p>\n   </td>\n  <td>\n  <p>32-bit object Id</p>\n   </td>\n  <td>\n  <p>4 bytes</p>\n   </td>\n  <td>\n  <p>4 bytes</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>nBytes</p>\n   </td>\n  <td>\n  <p>Number of data bytes in this chunk</p>\n   </td>\n  <td>\n  <p>2 bytes</p>\n   </td>\n  <td>\n  <p>2 bytes</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>blockSequence</p>\n   </td>\n  <td>\n  <p>sequence number for this block</p>\n   </td>\n  <td>\n  <p>4 bytes</p>\n   </td>\n  <td>\n  <p>4 bytes</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>tagsEcc</p>\n   </td>\n  <td>\n  <p>ECC on tags area</p>\n   </td>\n  <td>\n  <p>3 bytes</p>\n   </td>\n  <td>\n  <p>3 bytes</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>ecc</p>\n   </td>\n  <td>\n  <p>ECC, 3 bytes/256 bytes of data</p>\n   </td>\n  <td>\n  <p>12 bytes</p>\n   </td>\n  <td>\n  <p>24 bytes</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p><strong>Total</strong></p>\n   </td>\n  <td>\n  <p>&nbsp;</p>\n   </td>\n  <td>\n  <p><strong>30 bytes</strong></p>\n   </td>\n  <td>\n  <p><strong>42 bytes</strong></p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p><br />\n&nbsp;</p>\n<p>To get enough spare bytes for this tagging structure requires a chunk-size of at least 1kB.</p>\n<p>The blockSequence increments each time a block is allocated. (ie. the first block allocated is block 1, and so on).</p>\n<h4>Scanning</h4>\n<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>\n<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>\n<h4>Performance</h4>\n<p>Times for 2kB read(units of 1uS).</p>\n<p>Operation</p>\n<p>Yaffs1</p>\n<p>Yaffs2 (512b pages)</p>\n<p>Yaffs2 (2kB pages)</p>\n<p>Yaffs2(2kB pages, x16)</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>Seek</p>\n   </td>\n  <td>\n  <p>40</p>\n   </td>\n  <td>\n  <p>40</p>\n   </td>\n  <td>\n  <p>10</p>\n   </td>\n  <td>\n  <p>10</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Read</p>\n   </td>\n  <td>\n  <p>220</p>\n   </td>\n  <td>\n  <p>220</p>\n   </td>\n  <td>\n  <p>220</p>\n   </td>\n  <td>\n  <p>110</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Total</p>\n   </td>\n  <td>\n  <p>260</p>\n   </td>\n  <td>\n  <p>260</p>\n   </td>\n  <td>\n  <p>230</p>\n   </td>\n  <td>\n  <p>120</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>MB/s</p>\n   </td>\n  <td>\n  <p>7.6</p>\n   </td>\n  <td>\n  <p>7.6</p>\n   </td>\n  <td>\n  <p>8.7</p>\n   </td>\n  <td>\n  <p>16.7</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Relative speed</p>\n   </td>\n  <td>\n  <p>1</p>\n   </td>\n  <td>\n  <p>1</p>\n   </td>\n  <td>\n  <p>1.1</p>\n   </td>\n  <td>\n  <p>2.2</p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p><br />\n&nbsp;</p>\n<p>Times for 2kB writes(units of 1uS).</p>\n<p>Operation</p>\n<p>Yaffs1</p>\n<p>Yaffs2 (512b pages)</p>\n<p>Yaffs2 (2kB pages)</p>\n<p>Yaffs2(2kB pages, x16)</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>Seek</p>\n   </td>\n  <td>\n  <p>40</p>\n   </td>\n  <td>\n  <p>40</p>\n   </td>\n  <td>\n  <p>10</p>\n   </td>\n  <td>\n  <p>10</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Program</p>\n   </td>\n  <td>\n  <p>800</p>\n   </td>\n  <td>\n  <p>800</p>\n   </td>\n  <td>\n  <p>200</p>\n   </td>\n  <td>\n  <p>200</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Seek</p>\n   </td>\n  <td>\n  <p>40</p>\n   </td>\n  <td>\n  <p>40</p>\n   </td>\n  <td>\n  <p>10</p>\n   </td>\n  <td>\n  <p>10</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Read</p>\n   </td>\n  <td>\n  <p>220</p>\n   </td>\n  <td>\n  <p>220</p>\n   </td>\n  <td>\n  <p>220</p>\n   </td>\n  <td>\n  <p>110</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Total</p>\n   </td>\n  <td>\n  <p>1320</p>\n   </td>\n  <td>\n  <p>1320</p>\n   </td>\n  <td>\n  <p>660</p>\n   </td>\n  <td>\n  <p>440</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>MB/s</p>\n   </td>\n  <td>\n  <p>1.5</p>\n   </td>\n  <td>\n  <p>1.5</p>\n   </td>\n  <td>\n  <p>3</p>\n   </td>\n  <td>\n  <p>4.5</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Relative speed</p>\n   </td>\n  <td>\n  <p>1</p>\n   </td>\n  <td>\n  <p>1</p>\n   </td>\n  <td>\n  <p>2</p>\n   </td>\n  <td>\n  <p>3</p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p><br />\n&nbsp;</p>\n<p>Times for 1MB delete (units of 1uS).</p>\n<p>Operation</p>\n<p>Yaffs1</p>\n<p>Yaffs2 (512b pages)</p>\n<p>Yaffs2 (2kB pages)</p>\n<p>Yaffs2(2kB pages, x16)</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>Seek</p>\n   </td>\n  <td>\n  <p>20480</p>\n   </td>\n  <td>\n  <p>0</p>\n   </td>\n  <td>\n  <p>0</p>\n   </td>\n  <td>\n  <p>0</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Program</p>\n   </td>\n  <td>\n  <p>409600</p>\n   </td>\n  <td>\n  <p>0</p>\n   </td>\n  <td>\n  <p>0</p>\n   </td>\n  <td>\n  <p>0</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Erase</p>\n   </td>\n  <td>\n  <p>128000</p>\n   </td>\n  <td>\n  <p>128000</p>\n   </td>\n  <td>\n  <p>16000</p>\n   </td>\n  <td>\n  <p>16000</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Total</p>\n   </td>\n  <td>\n  <p>558080</p>\n   </td>\n  <td>\n  <p>128000</p>\n   </td>\n  <td>\n  <p>16000</p>\n   </td>\n  <td>\n  <p>16000</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>MB/s</p>\n   </td>\n  <td>\n  <p>1.8</p>\n   </td>\n  <td>\n  <p>7.8</p>\n   </td>\n  <td>\n  <p>62.5</p>\n   </td>\n  <td>\n  <p>62.5</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Relative speed</p>\n   </td>\n  <td>\n  <p>1</p>\n   </td>\n  <td>\n  <p>4</p>\n   </td>\n  <td>\n  <p>34</p>\n   </td>\n  <td>\n  <p>34</p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p><br />\n&nbsp;</p>\n<p>Times for 1MB of garbage collection at 50% dirty (units of 1uS).</p>\n<p>Operation</p>\n<p>Yaffs1</p>\n<p>Yaffs2 (512b pages)</p>\n<p>Yaffs2 (2kB pages)</p>\n<p>Yaffs2(2kB pages, x16)</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>Delete 1MB</p>\n   </td>\n  <td>\n  <p>558080</p>\n   </td>\n  <td>\n  <p>128000</p>\n   </td>\n  <td>\n  <p>16000</p>\n   </td>\n  <td>\n  <p>16000</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Write 0.5MB</p>\n   </td>\n  <td>\n  <p>337920</p>\n   </td>\n  <td>\n  <p>337920</p>\n   </td>\n  <td>\n  <p>168960</p>\n   </td>\n  <td>\n  <p>112640</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Total</p>\n   </td>\n  <td>\n  <p>896000</p>\n   </td>\n  <td>\n  <p>465920</p>\n   </td>\n  <td>\n  <p>184960</p>\n   </td>\n  <td>\n  <p>128640</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>MB/s</p>\n   </td>\n  <td>\n  <p>1.1</p>\n   </td>\n  <td>\n  <p>2.1</p>\n   </td>\n  <td>\n  <p>5.4</p>\n   </td>\n  <td>\n  <p>7.7</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Relative speed</p>\n   </td>\n  <td>\n  <p>1</p>\n   </td>\n  <td>\n  <p>1.9</p>\n   </td>\n  <td>\n  <p>4.9</p>\n   </td>\n  <td>\n  <p>7</p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p><br />\n&nbsp;</p>\n</div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:22:\"/yaffs-2-specification\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:8:\"/node/38\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:22:\"/yaffs-2-specification\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:30:\"config:filter.format.full_html\";i:1;s:18:\"config:system.site\";i:2;s:7:\"node:38\";i:3;s:9:\"node_view\";i:4;s:6:\"user:3\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:58:\"<span property=\"schema:name\">Yaffs 2 Specification</span>\n\";}}',-1,1510664583.791,1,'config:filter.format.full_html config:system.site node:38 node_view rendered user:3','303'),('entity_view:node:38:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:2:\"38\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:30:\"config:filter.format.full_html\";i:1;s:18:\"config:system.site\";i:2;s:7:\"node:38\";i:3;s:9:\"node_view\";i:4;s:6:\"user:3\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1510664583.780,1,'config:filter.format.full_html config:system.site node:38 node_view rendered user:3','303'),('entity_view:node:38:search_result:[languages:language_interface]=en:[theme]=yaffs:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:9971:\"<span property=\"schema:name\">Yaffs 2 Specification</span>\n\n            <div property=\"schema:text\" class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\">\n<h2>Summary</h2>\n<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>\n<p>To achieve this, a new design is used which also realises the following benefits:</p>\n<ul>\n<li>\n<p>Zero page rewrites means faster operation. (Yaffs1 uses a single rewrite in the spare area to delete a page).</p>\n </li>\n<li>\n<p>Ability to exploit simultaneous page programming on some chips.</p>\n </li>\n<li>\n<p>Improves performance relative to Yaffs1 speed(write:1.5x to 5x, delete: 4x, garbage collection: 2x)</p>\n </li>\n<li>\n<p>Lower RAM footprint (approx. 25% to 50% of Yaffs1).</p>\n </li>\n<li>\n<p>Can support Toshiba/Sandisk MLC parts.</p>\n </li>\n</ul>\n<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>\n<h4>Method</h4>\n<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>\n<p>Instead Yaffs2 uses two mechanisms to resolve data state.</p>\n<ul>\n<li>\n<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>\n </li>\n<li>\n<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>\n </li>\n<li>\n<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>\n </li>\n</ul>\n<p>This changes erasure slightly:</p>\n<ul>\n<li>\n<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>\n </li>\n</ul>\n<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>\n<h4>Tag structure</h4>\n<p>Each chunk in Yaffs2 has the following information:</p>\n<p>Field</p>\n<p>Comment</p>\n<p>Size for 1kb chunks</p>\n<p>Size for 2kB chunks</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>blockState</p>\n   </td>\n  <td>\n  <p>Block state. non-0xFF for bad block</p>\n   </td>\n  <td>\n  <p>1 byte</p>\n   </td>\n  <td>\n  <p>1 byte</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>chunkId</p>\n   </td>\n  <td>\n  <p>32-bit chunk Id</p>\n   </td>\n  <td>\n  <p>4 bytes</p>\n   </td>\n  <td>\n  <p>4 bytes</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>objectId</p>\n   </td>\n  <td>\n  <p>32-bit object Id</p>\n   </td>\n  <td>\n  <p>4 bytes</p>\n   </td>\n  <td>\n  <p>4 bytes</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>nBytes</p>\n   </td>\n  <td>\n  <p>Number of data bytes in this chunk</p>\n   </td>\n  <td>\n  <p>2 bytes</p>\n   </td>\n  <td>\n  <p>2 bytes</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>blockSequence</p>\n   </td>\n  <td>\n  <p>sequence number for this block</p>\n   </td>\n  <td>\n  <p>4 bytes</p>\n   </td>\n  <td>\n  <p>4 bytes</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>tagsEcc</p>\n   </td>\n  <td>\n  <p>ECC on tags area</p>\n   </td>\n  <td>\n  <p>3 bytes</p>\n   </td>\n  <td>\n  <p>3 bytes</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>ecc</p>\n   </td>\n  <td>\n  <p>ECC, 3 bytes/256 bytes of data</p>\n   </td>\n  <td>\n  <p>12 bytes</p>\n   </td>\n  <td>\n  <p>24 bytes</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p><strong>Total</strong></p>\n   </td>\n  <td>\n  <p>&nbsp;</p>\n   </td>\n  <td>\n  <p><strong>30 bytes</strong></p>\n   </td>\n  <td>\n  <p><strong>42 bytes</strong></p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p><br />\n&nbsp;</p>\n<p>To get enough spare bytes for this tagging structure requires a chunk-size of at least 1kB.</p>\n<p>The blockSequence increments each time a block is allocated. (ie. the first block allocated is block 1, and so on).</p>\n<h4>Scanning</h4>\n<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>\n<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>\n<h4>Performance</h4>\n<p>Times for 2kB read(units of 1uS).</p>\n<p>Operation</p>\n<p>Yaffs1</p>\n<p>Yaffs2 (512b pages)</p>\n<p>Yaffs2 (2kB pages)</p>\n<p>Yaffs2(2kB pages, x16)</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>Seek</p>\n   </td>\n  <td>\n  <p>40</p>\n   </td>\n  <td>\n  <p>40</p>\n   </td>\n  <td>\n  <p>10</p>\n   </td>\n  <td>\n  <p>10</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Read</p>\n   </td>\n  <td>\n  <p>220</p>\n   </td>\n  <td>\n  <p>220</p>\n   </td>\n  <td>\n  <p>220</p>\n   </td>\n  <td>\n  <p>110</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Total</p>\n   </td>\n  <td>\n  <p>260</p>\n   </td>\n  <td>\n  <p>260</p>\n   </td>\n  <td>\n  <p>230</p>\n   </td>\n  <td>\n  <p>120</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>MB/s</p>\n   </td>\n  <td>\n  <p>7.6</p>\n   </td>\n  <td>\n  <p>7.6</p>\n   </td>\n  <td>\n  <p>8.7</p>\n   </td>\n  <td>\n  <p>16.7</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Relative speed</p>\n   </td>\n  <td>\n  <p>1</p>\n   </td>\n  <td>\n  <p>1</p>\n   </td>\n  <td>\n  <p>1.1</p>\n   </td>\n  <td>\n  <p>2.2</p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p><br />\n&nbsp;</p>\n<p>Times for 2kB writes(units of 1uS).</p>\n<p>Operation</p>\n<p>Yaffs1</p>\n<p>Yaffs2 (512b pages)</p>\n<p>Yaffs2 (2kB pages)</p>\n<p>Yaffs2(2kB pages, x16)</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>Seek</p>\n   </td>\n  <td>\n  <p>40</p>\n   </td>\n  <td>\n  <p>40</p>\n   </td>\n  <td>\n  <p>10</p>\n   </td>\n  <td>\n  <p>10</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Program</p>\n   </td>\n  <td>\n  <p>800</p>\n   </td>\n  <td>\n  <p>800</p>\n   </td>\n  <td>\n  <p>200</p>\n   </td>\n  <td>\n  <p>200</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Seek</p>\n   </td>\n  <td>\n  <p>40</p>\n   </td>\n  <td>\n  <p>40</p>\n   </td>\n  <td>\n  <p>10</p>\n   </td>\n  <td>\n  <p>10</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Read</p>\n   </td>\n  <td>\n  <p>220</p>\n   </td>\n  <td>\n  <p>220</p>\n   </td>\n  <td>\n  <p>220</p>\n   </td>\n  <td>\n  <p>110</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Total</p>\n   </td>\n  <td>\n  <p>1320</p>\n   </td>\n  <td>\n  <p>1320</p>\n   </td>\n  <td>\n  <p>660</p>\n   </td>\n  <td>\n  <p>440</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>MB/s</p>\n   </td>\n  <td>\n  <p>1.5</p>\n   </td>\n  <td>\n  <p>1.5</p>\n   </td>\n  <td>\n  <p>3</p>\n   </td>\n  <td>\n  <p>4.5</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Relative speed</p>\n   </td>\n  <td>\n  <p>1</p>\n   </td>\n  <td>\n  <p>1</p>\n   </td>\n  <td>\n  <p>2</p>\n   </td>\n  <td>\n  <p>3</p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p><br />\n&nbsp;</p>\n<p>Times for 1MB delete (units of 1uS).</p>\n<p>Operation</p>\n<p>Yaffs1</p>\n<p>Yaffs2 (512b pages)</p>\n<p>Yaffs2 (2kB pages)</p>\n<p>Yaffs2(2kB pages, x16)</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>Seek</p>\n   </td>\n  <td>\n  <p>20480</p>\n   </td>\n  <td>\n  <p>0</p>\n   </td>\n  <td>\n  <p>0</p>\n   </td>\n  <td>\n  <p>0</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Program</p>\n   </td>\n  <td>\n  <p>409600</p>\n   </td>\n  <td>\n  <p>0</p>\n   </td>\n  <td>\n  <p>0</p>\n   </td>\n  <td>\n  <p>0</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Erase</p>\n   </td>\n  <td>\n  <p>128000</p>\n   </td>\n  <td>\n  <p>128000</p>\n   </td>\n  <td>\n  <p>16000</p>\n   </td>\n  <td>\n  <p>16000</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Total</p>\n   </td>\n  <td>\n  <p>558080</p>\n   </td>\n  <td>\n  <p>128000</p>\n   </td>\n  <td>\n  <p>16000</p>\n   </td>\n  <td>\n  <p>16000</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>MB/s</p>\n   </td>\n  <td>\n  <p>1.8</p>\n   </td>\n  <td>\n  <p>7.8</p>\n   </td>\n  <td>\n  <p>62.5</p>\n   </td>\n  <td>\n  <p>62.5</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Relative speed</p>\n   </td>\n  <td>\n  <p>1</p>\n   </td>\n  <td>\n  <p>4</p>\n   </td>\n  <td>\n  <p>34</p>\n   </td>\n  <td>\n  <p>34</p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p><br />\n&nbsp;</p>\n<p>Times for 1MB of garbage collection at 50% dirty (units of 1uS).</p>\n<p>Operation</p>\n<p>Yaffs1</p>\n<p>Yaffs2 (512b pages)</p>\n<p>Yaffs2 (2kB pages)</p>\n<p>Yaffs2(2kB pages, x16)</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>Delete 1MB</p>\n   </td>\n  <td>\n  <p>558080</p>\n   </td>\n  <td>\n  <p>128000</p>\n   </td>\n  <td>\n  <p>16000</p>\n   </td>\n  <td>\n  <p>16000</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Write 0.5MB</p>\n   </td>\n  <td>\n  <p>337920</p>\n   </td>\n  <td>\n  <p>337920</p>\n   </td>\n  <td>\n  <p>168960</p>\n   </td>\n  <td>\n  <p>112640</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Total</p>\n   </td>\n  <td>\n  <p>896000</p>\n   </td>\n  <td>\n  <p>465920</p>\n   </td>\n  <td>\n  <p>184960</p>\n   </td>\n  <td>\n  <p>128640</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>MB/s</p>\n   </td>\n  <td>\n  <p>1.1</p>\n   </td>\n  <td>\n  <p>2.1</p>\n   </td>\n  <td>\n  <p>5.4</p>\n   </td>\n  <td>\n  <p>7.7</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Relative speed</p>\n   </td>\n  <td>\n  <p>1</p>\n   </td>\n  <td>\n  <p>1.9</p>\n   </td>\n  <td>\n  <p>4.9</p>\n   </td>\n  <td>\n  <p>7</p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p><br />\n&nbsp;</p>\n</div>\n      \";}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;}}',-1,1511328976.493,1,'config:filter.format.full_html node:38 node_view rendered','296'),('entity_view:node:38:search_result:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:2:\"38\";i:3;s:13:\"search_result\";}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;s:3:\"bin\";s:6:\"render\";}}',-1,1511328976.490,1,'config:filter.format.full_html node:38 node_view rendered','296'),('entity_view:node:390:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b0xGRnREGnuj14rRrQ63UTBKwF6WlugRCNHGOgeOuJUvw','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:139:\"<article role=\"article\" about=\"/get-yaffs-now\" class=\"image full clearfix\">\n\n  \n    \n\n  \n  <div class=\"content\">\n    \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:14:\"/get-yaffs-now\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:9:\"/node/390\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:14:\"/get-yaffs-now\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:4:{i:0;s:18:\"config:system.site\";i:1;s:8:\"node:390\";i:2;s:9:\"node_view\";i:3;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:27:\"<span>Get YAFFS now</span>\n\";}}',-1,1512113319.686,1,'config:system.site node:390 node_view rendered user:1','267'),('entity_view:node:390:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"390\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:4:{i:0;s:18:\"config:system.site\";i:1;s:8:\"node:390\";i:2;s:9:\"node_view\";i:3;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1512113319.682,1,'config:system.site node:390 node_view rendered user:1','267'),('entity_view:node:390:search_result:[languages:language_interface]=en:[theme]=yaffs:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:27:\"<span>Get YAFFS now</span>\n\";}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:2:{i:0;s:8:\"node:390\";i:1;s:9:\"node_view\";}s:7:\"max-age\";i:-1;}}',-1,1512113278.334,1,'node:390 node_view rendered','254'),('entity_view:node:390:search_result:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"390\";i:3;s:13:\"search_result\";}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:2:{i:0;s:8:\"node:390\";i:1;s:9:\"node_view\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1512113278.333,1,'node:390 node_view rendered','254'),('entity_view:node:391:search_result:[languages:language_interface]=en:[theme]=yaffs:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:27:\"<span>Get YAFFS now</span>\n\";}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:2:{i:0;s:8:\"node:391\";i:1;s:9:\"node_view\";}s:7:\"max-age\";i:-1;}}',-1,1512113278.322,1,'node:391 node_view rendered','254'),('entity_view:node:391:search_result:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"391\";i:3;s:13:\"search_result\";}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:2:{i:0;s:8:\"node:391\";i:1;s:9:\"node_view\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1512113278.321,1,'node:391 node_view rendered','254'),('entity_view:node:397:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b0AELjw8RIsY1aWf-MU-oeO9IBBr5A0ZYmBX048cQIWKw','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:319:\"<article role=\"article\" about=\"/logos/design-electronics\" class=\"yaffs-user-logo full clearfix\">\n\n  \n    \n\n  \n  <div class=\"content\">\n    \n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p>Design Electronics use Yaffs</p></div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:25:\"/logos/design-electronics\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:9:\"/node/397\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:25:\"/logos/design-electronics\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:397\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:32:\"<span>Design Electronics</span>\n\";}}',-1,1511135157.804,1,'config:filter.format.basic_html config:system.site node:397 node_view rendered user:1','278'),('entity_view:node:397:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"397\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:397\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1511135157.794,1,'config:filter.format.basic_html config:system.site node:397 node_view rendered user:1','278'),('entity_view:node:398:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b0Jb3fEZNp08RioqwLyxOZ5W9lWAuDwrYWIrCCNb6jzJg','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:293:\"<article role=\"article\" about=\"/logos/eaton\" class=\"yaffs-user-logo full clearfix\">\n\n  \n    \n\n  \n  <div class=\"content\">\n    \n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p>Eaton use Yaffs</p></div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:12:\"/logos/eaton\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:9:\"/node/398\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:12:\"/logos/eaton\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:398\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:19:\"<span>Eaton</span>\n\";}}',-1,1513081620.570,1,'config:filter.format.basic_html config:system.site node:398 node_view rendered user:1','279'),('entity_view:node:398:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"398\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:398\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1513081620.566,1,'config:filter.format.basic_html config:system.site node:398 node_view rendered user:1','279'),('entity_view:node:399:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b0bH3gUo6x21n2bpGESHkqqBjtu1_LMy2Dpnx_MoD2In4','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:311:\"<article role=\"article\" about=\"/logos/lancom-sytems\" class=\"yaffs-user-logo full clearfix\">\n\n  \n    \n\n  \n  <div class=\"content\">\n    \n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p>Lancom Systems use Yaffs.</p></div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:20:\"/logos/lancom-sytems\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:9:\"/node/399\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:20:\"/logos/lancom-sytems\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:399\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:27:\"<span>LANCOM Sytems</span>\n\";}}',-1,1511188992.539,1,'config:filter.format.basic_html config:system.site node:399 node_view rendered user:1','278'),('entity_view:node:399:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"399\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:399\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1511188992.520,1,'config:filter.format.basic_html config:system.site node:399 node_view rendered user:1','278'),('entity_view:node:39:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01N1vRUYLbwF9COFwL_w1_szV3rvUU5rU4q5n_-QPpiEQ','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:18184:\"<article role=\"article\" about=\"/archives/yaffs-development-notes\" typeof=\"schema:WebPage\" class=\"page is-sticky full clearfix\">\n\n  \n      <span property=\"schema:name\" content=\"Yaffs (Yaffs1) Development Notes\" class=\"hidden\"></span>\n\n\n  \n  <div class=\"content\">\n    \n            <div property=\"schema:text\" class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\">\n<p><em>These notes relate to Yaffs1. Yaffs version 2, or Yaffs2, is the current version of Yaffs. While many of the details below remain the same, you can find up to date information split between the How Yaffs Works, Yaffs Tuning and Yaffs Direct documents.</em></p>\n<p>&nbsp;</p>\n<h2>Build options</h2>\n<p>Yaffs1 can be built as either a kernel module (ie. a Linux file system) or as an application.</p>\n<p>Of course the goal is to build Yaffs as a file system running on top of real NAND flash, but yaffs can be built to run on a RAM emulation layer for in-kernel testing without NAND flash in the system.</p>\n<p>Building as an application allows the yaffs_guts algorithms to be tested/debugged in a more friendly debugging environment. The test harness is in yaffsdev.c</p>\n<h3>Trying it out</h3>\n<p>Yaffs1 can be built to run with either mtd or RAM emulation, or both. The file system that interfaces to mtd is called <strong>yaffs</strong>, the file system that uses internal ram is called <strong>yaffsram</strong>. Yaffs1 simultaneously supports both if they are enabled.</p>\n<ol>\n<li>\n<p>Hack the Makefile and change the KERNELDIR define to your kernel directory.</p>\n </li>\n<li>\n<p>If you don\'t have mtd support in your kernel, then you might need to turn off USE_MTD otherwise the Yaffs module might not load.</p>\n </li>\n<li>\n<p>Type <strong>make clean; make</strong> to build yaffs</p>\n </li>\n<li>\n<p>Load Yaffs as a module by typing <strong>/sbin/insmod yaffs.o</strong> (ya gotta be root!).</p>\n </li>\n<li>\n<p>Create a mount point eg. <strong>mkdir /mnt/y</strong></p>\n </li>\n<li>\n<p>To mount the RAM emulation version of yaffs, <strong>mount -t yaffsram none /mnt/y</strong></p>\n </li>\n<li>\n<p>Alternatively, to mount the mtd version of yaffs, <strong>mount -t yaffs /dev/mtd0 /mnt/y</strong></p>\n </li>\n</ol>\n<p><br />\n&nbsp;</p>\n<h3>Yaffs1 Data structures</h3>\n<p>All data types are defined in yaffs_guts.h</p>\n<p>Yaffs1 uses the following major objects:</p>\n<ul>\n<li>\n<p>yaffs_Object: A yaffs_Object can be a file, directory, symlink or hardlink. The yaffs_Objects \"know\" about their corresponding yaffs_ObjectHeader in NAND and the data for that object. yaffs_Objects also bind together the directory structure as follows:</p>\n </li>\n<li>\n<p>parent: pointer to the yaffs_Object that is a parent of this yaffs_Object in the directory structure.</p>\n </li>\n<li>\n<p>siblings: this field is used to link together a list of all the yaffs_Objects in the same directory.</p>\n </li>\n<li>\n<p>children: if the object is a directory, then children holds the head of the list of objects in the directory.</p>\n </li>\n<li>\n<p>yaffs_Tnode: yaffs_Tnodes form a tree structure that speeds up the search for data chunks in a file. As the file grows in size, the levels increase. The Tnodes are a constant size (32 bytes). Level 0 (ie the lowest level) comprise 16 2-byte entries giving an index used to search for the chunkId. Tnodes at other levels comprise 8 4-byte pointer entries to other tnodes lower in the tree.</p>\n </li>\n<li>\n<p>yaffs_Device: this holds the device context and is in some ways analogous to the VFS superblock. It stores the data used to access the mtd as well as function pointers to access the NAND data.</p>\n </li>\n</ul>\n<p>The Tnodes and Objects are allocated in groups to reduce memory allocation/freeing overheads. Freed up tnodes and objects are kept in a free list and re-used.</p>\n<h3>yaffs_Object</h3>\n<p>struct yaffs_ObjectStruct</p>\n<p>{</p>\n<p>__u8 fake:1; // A fake object has no presence on NAND.</p>\n<p>__u8 renameAllowed:1; // Are we allowed to rename it?</p>\n<p>__u8 unlinkAllowed:1; // Are we allowed to unlink it?</p>\n<p>__u8 dirty:1; // the object needs to be written to flash</p>\n<p>__u8 valid:1; // When the file system is being loaded up, this</p>\n<p>// object might be created before the data</p>\n<p>// is available (ie. file data records appear before the header).</p>\n<p>__u8 serial; // serial number of chunk in NAND. Store here so we don\'t have to</p>\n<p>// read back the old one to update.</p>\n<p>__u16 sum; // sum of the name to speed searching</p>\n<p>struct yaffs_DeviceStruct *myDev; // The device I\'m on</p>\n<p>struct list_head hashLink; // list of objects in this hash bucket</p>\n<p>struct list_head hardLinks; // all the equivalent hard linked objects</p>\n<p>// live on this list</p>\n<p>// directory structure stuff</p>\n<p>struct yaffs_ObjectStruct *parent; //my parent directory</p>\n<p>struct list_head siblings; // siblings in a directory</p>\n<p>// also used for linking up the free list</p>\n<p>// Where\'s my data in NAND?</p>\n<p>int chunkId; // where it lives</p>\n<p>__u32 objectId; // the object id value</p>\n<p>__u32 st_mode; // protection</p>\n<p>__u32 st_uid; // user ID of owner</p>\n<p>__u32 st_gid; // group ID of owner</p>\n<p>__u32 st_atime; // time of last access</p>\n<p>__u32 st_mtime; // time of last modification</p>\n<p>__u32 st_ctime; // time of last change</p>\n<p>yaffs_ObjectType variantType;</p>\n<p>yaffs_ObjectVariant variant;</p>\n<p>};</p>\n<p><br />\n&nbsp;</p>\n<p>Obvious stuff skipped....</p>\n<p>fake, renameAllowed, unlinkAllowed are special flags for handling \"fake\" objects which live in the file system but do not live on NAND. Currently there are only two such objects: the root object and the lost+found directory. None of these may be renamed or unlinked.</p>\n<p>serial, sum: see yaffs_ObjectHeader.</p>\n<p>dirty indicates that the object\'s contents has changed and a new yaffs_ObjectHeader must be written to flash.</p>\n<p>valid indicates that the object has been loaded up. This is only used during scanning (yaffs_Scan()) since we can know of an object\'s existance - and thus need to create the object header - before we encounter the associated yaffs_ObjectHeader.</p>\n<p>hashlink is a list of Objects in the same hash bucket.</p>\n<p>The four variants hold extra info:</p>\n<p>Files hold the file size and the top level and pointer to the tnode tree for the file.</p>\n<p>Directories hold a list of children objects.</p>\n<p>Symlinks hold a pointer to the alias string. This is probably inefficient, but that probably does not matter since we don\'t expect to see many of these.</p>\n<p>Hardlinks hold information to identify the equivalent object.</p>\n<p><br />\n&nbsp;</p>\n<h3>File structure (tnodes)</h3>\n<p>File structures are done with a tiered indexing structure</p>\n<p><br />\n&nbsp;</p>\n<p><img alt=\"\" height=\"294\" src=\"http://www.aleph1.co.uk/yaffs/sv9349341.gif\" width=\"491\" /><br />\n<br />\n&nbsp;</p>\n<p>The file structure is maintained by a tree structure. Depending where it is in the tree, each tree node (<strong><em>tnode</em></strong>) (the blue/things) holds either:</p>\n<ul>\n<li>\n<p>.... if it is at the lowest level, then 16 __u16s which identify the page.</p>\n </li>\n<li>\n<p>.... if it is at a higher level (ie an internal tnode), then 8 pointers to lowest-level tnodes.</p>\n </li>\n</ul>\n<p>When the file starts out, it is assigned only one low-level tnode. When the file expands past what a single tnode can hold, then it is assigned a second tnode and an internal node is added to point to the two tnodes. As the file grows, more low-level tnodes and high level tnodes are added.</p>\n<p>Traversing the tnode tree to find a particular page in a file is quite simple: each internal tnode is selected from by using 3 bits of the page offset in the file. The level 0 page resolves 4 bits.</p>\n<p>For example, finding page 0x235 (ie. the one starting at file position 0x46800 would proceed as follows:</p>\n<p>0x235 is 0000001000110101, partitioned as follows. 000.000.100.011.0101</p>\n<p>Level</p>\n<p>Bits</p>\n<p>Selected value</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>3 or more if they exist</p>\n   </td>\n  <td>\n  <p>&gt;= 10</p>\n   </td>\n  <td>\n  <p>Zero</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>2</p>\n   </td>\n  <td>\n  <p>9 to 7</p>\n   </td>\n  <td>\n  <p>100 binary = 4</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>1</p>\n   </td>\n  <td>\n  <p>6 to 4</p>\n   </td>\n  <td>\n  <p>011 binary = 3</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>0</p>\n   </td>\n  <td>\n  <p>3 to 0</p>\n   </td>\n  <td>\n  <p>0101 binary = 5</p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p><br />\nFree tnodes are stored in a list. When the list is exhausted, more are allocated.</p>\n<p>Each tnode takes 32 bytes. Each file needs at least one level 0 tnode. How many do we need? A full 16MB file system needs at least 16MB/512/16 = 2000 level zero tnodes. More for internal tnodes. More for files smaller than optimal.</p>\n<p>The tree grows as required. When the file is resized to a smaller size then it is pruned.</p>\n<h3>NAND data</h3>\n<p>Data is stored on NAND in \"chunks\". Currently each chunk is the same size as a NAND flash page (ie. 512 bytes + 16 byte spare). In the future we might decide to allow for different chunk sizes. Chunks can hold either:</p>\n<ul>\n<li>\n<p>A yaffs_ObjectHeader. This is the way a yaffs_Object gets stored on NAND.</p>\n </li>\n<li>\n<p>A chunk of file data.</p>\n </li>\n</ul>\n<p>The 16 byte spare area contains:</p>\n<ul>\n<li>\n<p>8 bytes of tags,</p>\n </li>\n<li>\n<p>6 bytes of ECC data</p>\n </li>\n<li>\n<p>1 byte block status (used to identify damaged blocks)</p>\n </li>\n<li>\n<p>1 byte data status (currently unused).</p>\n </li>\n</ul>\n<p>The tags are made up as follows:</p>\n<p>typedef struct</p>\n<p>{</p>\n<p>unsigned chunkId:20; //chunk number in file</p>\n<p>unsigned serialNumber:2; //serial number for chunk</p>\n<p>unsigned byteCount:10; //number of bytes of data used in this chunk</p>\n<p>unsigned objectId:18; //the object id that this chunk belongs to.</p>\n<p>unsigned ecc:12; //ECC on tags</p>\n<p>unsigned unusedStuff:2; //unused</p>\n<p>} yaffs_Tags;</p>\n<p>&nbsp;</p>\n<p>A chunkId of zero indicates that this chunk holds a yaffs_ObjectHeader. A non zero value indicates that this is a data chunk and the position of the chunk in the file (ie. the first chunk - at offset 0 - has chunkId 1). See yaffs_guts.c:yaffs_Scan () to see how this is done.</p>\n<p>When a chunk is repalced (eg. file details changed or a part of a file was overwritten), the new chunk is written before the old chunk is deleted. This means that we don\'t lose data if there is a power loss after the new chunk is created but before the old one is discarded, but it does mean that we can encounter the situation where we find both the old and the new chunks in flash. The serialNumber is incremented each time the chunk is written. 2 bits is sufficient to resolve any ambiguity.</p>\n<p>bytecount applies only to data chunks and tells how many of the data bytes are valid.</p>\n<p>objectId says which object this chunk belongs to.</p>\n<p>ecc is used to perform error correction on the tags. Another ecc field is used to error correct the data.</p>\n<h3>yaffs_ObjectHeader</h3>\n<p>typedef struct</p>\n<p>{</p>\n<p>yaffs_ObjectType type;</p>\n<p>&nbsp;</p>\n<p>// Apply to everything</p>\n<p>int parentObjectId;</p>\n<p>__u16 sum; // checksum of name</p>\n<p>char name[YAFFS_MAX_NAME_LENGTH + 1];</p>\n<p>&nbsp;</p>\n<p>// Thes following apply to directories, files, symlinks - not hard links</p>\n<p>__u32 st_mode; // protection</p>\n<p>__u32 st_uid; // user ID of owner</p>\n<p>__u32 st_gid; // group ID of owner</p>\n<p>__u32 st_atime; // time of last access</p>\n<p>__u32 st_mtime; // time of last modification</p>\n<p>__u32 st_ctime; // time of last change</p>\n<p>&nbsp;</p>\n<p>// File size applies to files only</p>\n<p>int fileSize;</p>\n<p>&nbsp;</p>\n<p>// Equivalent object id applies to hard links only.</p>\n<p>int equivalentObjectId;</p>\n<p>// alias only applies to symlinks</p>\n<p>char alias[YAFFS_MAX_ALIAS_LENGTH + 1];</p>\n<p>&nbsp;</p>\n<p>&nbsp;</p>\n<p>} yaffs_ObjectHeader;</p>\n<p>&nbsp;</p>\n<p>A yaffs_ObjectHeader is stored in NAND for every yaffs_Object.</p>\n<p>type holds the type of yaffs_Object (file,directory,hardlink or symlink).</p>\n<p>parentObject is the objectId of this object\'s parent. name holds the object\'s name. Together these form the directory structure of the file system. Also worth mention is sum. This is a \"checksum\" on the name which speeds directory searching (ie. when searching the directory we only compare the name for those entries where sum matches).</p>\n<p>Obvious stuff skipped....</p>\n<p>equivalentObjectId is used by hardlinks. A hardlink to an object uses this field to specify the object that this links to. This way of doing things is a bit different than the normal Linux way of doing things (ie. keeping the links distinct from the inode) but is simpler and uses less space except for a few corner cases with hardlinks.</p>\n<p>alias is used by symlinks to hold the symlink alias string. This limits the size of the symlink alias. In future we should expand Yaffs1 to use data chunks to store aliases too long to fit into the yaffs_ObjectHeader.</p>\n<h3>NAND Interface</h3>\n<p>All NAND access is performed via four functions pointed to by yaffs_Device. At the moment a chunk is a page.</p>\n<ul>\n<li>\n<p>int WriteChunkToNAND(struct yaffs_DeviceStruct *dev,int chunkInNAND, const __u8 *data, yaffs_Spare *spare)</p>\n </li>\n<li>\n<p>int ReadChunkFromNAND(struct yaffs_DeviceStruct *dev,int chunkInNAND, __u8 *data, yaffs_Spare *spare);</p>\n </li>\n<li>\n<p>int EraseBlockInNAND(struct yaffs_DeviceStruct *dev,int blockInNAND);</p>\n </li>\n<li>\n<p>int InitialiseNAND(struct yaffs_DeviceStruct *dev);</p>\n </li>\n</ul>\n<p>In the Readxxx and Writexxx functions, the data and/or spare pointers may be NULL in which case these data transfers are ignored.</p>\n<p>A quick note about NAND:</p>\n<ul>\n<li>\n<p>NAND is not random access, but page oriented. Thus, we do all reads &amp; writes in pages.</p>\n </li>\n<li>\n<p>Each NAND page holds 512 bytes of data and 16 \"spare\" bytes. Yaffs structures the spare area with tags used to identify what is stored in the data area. There are 32 such pages to a block.</p>\n </li>\n<li>\n<p>NAND writes will only change 1 bits to 0. eg. if a byte holds 10110011 and you write 11011010 to it you will get the logical and of the two values: 10010010. The only way to get 1s again is to erase the entire block.</p>\n </li>\n<li>\n<p>You may only write to a page a few times before erasing the entire block. Yaffs lives within these limitations. Each page only gets written to twice (once when written and once when discarded).</p>\n </li>\n<li>\n<p>ECC is normally used with NAND to correct for single bit errors. Yaffs1 applies the ECC itself, so the MTD should not do this.</p>\n </li>\n<li>\n<p>The current mtd interfaces are not particularly well suited to Yaffs1 and we will address the issue with the mtd group. (The mtd interface does not support page-oriented read/write which Yaffs1 would prefer).</p>\n </li>\n</ul>\n<h3>mkyaffs</h3>\n<p>mkyaffs is the tool to format a NAND mtd to be used for Yaffs1. This is quite simple, just erase all the undamaged blocks. Yaffs1 treats erased blocks as free (empty) space.</p>\n<h2>Expected performance</h2>\n<p>The following numbers should give an indication of the performance we should expect from Yaffs1.</p>\n<p>As an example, I\'ll use the following numbers. Since the hardware is capable of 50ns read/write, these numbers allow for some other ovberheads. Clearly though, the performance can be degraded in various ways.</p>\n<p>Seek</p>\n<p>10uS/page</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>Read</p>\n   </td>\n  <td>\n  <p>100nS/byte</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Write</p>\n   </td>\n  <td>\n  <p>100nS/byte</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Program</p>\n   </td>\n  <td>\n  <p>200uS/page</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Erase</p>\n   </td>\n  <td>\n  <p>2mS/block</p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p>&nbsp;</p>\n<p>From this we can derive some higher-level numbers:</p>\n<p>Operation</p>\n<p>Time</p>\n<p>Calculation</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>Read spare</p>\n   </td>\n  <td>\n  <p>12uS</p>\n   </td>\n  <td>\n  <p>seek + 16 * read</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Read page</p>\n   </td>\n  <td>\n  <p>63 uS</p>\n   </td>\n  <td>\n  <p>seek + 528 * read</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Write page</p>\n   </td>\n  <td>\n  <p>326 uS</p>\n   </td>\n  <td>\n  <p>seek + 528 * write + program + read page (for verification)</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Discard page</p>\n   </td>\n  <td>\n  <p>212 uS</p>\n   </td>\n  <td>\n  <p>seek + 16 * write + program</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Overwrite page</p>\n   </td>\n  <td>\n  <p>538 uS</p>\n   </td>\n  <td>\n  <p>write page + discard page</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Erase overhead per page</p>\n   </td>\n  <td>\n  <p>63uS</p>\n   </td>\n  <td>\n  <p>erase/32</p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p><br />\n&nbsp;</p>\n<p>From this we can infer the following flash access times:</p>\n<p>Operation</p>\n<p>Time</p>\n<p>Calculation</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>Read 1MB file</p>\n   </td>\n  <td>\n  <p>0.13s (about 7.5 MB/s)</p>\n   </td>\n  <td>\n  <p>2000 * read page</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Write 1MB (clean system)</p>\n   </td>\n  <td>\n  <p>0.53s (about 1.8 MB/s)</p>\n   </td>\n  <td>\n  <p>2000 * write page</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Overwrite 1MB file (no gc)</p>\n   </td>\n  <td>\n  <p>1.08s (about 0.9MB/s)</p>\n   </td>\n  <td>\n  <p>2000 * overwrite page</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Overwrite 1MB with 50% gc</p>\n   </td>\n  <td>\n  <p>2.4s (about 0.4 MB/s)</p>\n   </td>\n  <td>\n  <p>2000 * overwrite page + 2000 * page copy (== overwrite page) + 4000 * erase overhead</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Delete 1MB file</p>\n   </td>\n  <td>\n  <p>0.43s (about 2.2 MB/s)</p>\n   </td>\n  <td>\n  <p>2000 * discard page</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Delete 1MB file with 50% gc</p>\n   </td>\n  <td>\n  <p>0.49s (about 2.0MB/s)</p>\n   </td>\n  <td>\n  <p>2000 * discard page + 1000 * erase overhead</p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p>&nbsp;</p>\n</div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:33:\"/archives/yaffs-development-notes\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:8:\"/node/39\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:33:\"/archives/yaffs-development-notes\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:30:\"config:filter.format.full_html\";i:1;s:18:\"config:system.site\";i:2;s:7:\"node:39\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:69:\"<span property=\"schema:name\">Yaffs (Yaffs1) Development Notes</span>\n\";}}',-1,1510657445.183,1,'config:filter.format.full_html config:system.site node:39 node_view rendered user:1','310'),('entity_view:node:39:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:2:\"39\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:30:\"config:filter.format.full_html\";i:1;s:18:\"config:system.site\";i:2;s:7:\"node:39\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1510657445.166,1,'config:filter.format.full_html config:system.site node:39 node_view rendered user:1','310'),('entity_view:node:39:search_result:[languages:language_interface]=en:[theme]=yaffs:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:17965:\"<span property=\"schema:name\">Yaffs (Yaffs1) Development Notes</span>\n\n            <div property=\"schema:text\" class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\">\n<p><em>These notes relate to Yaffs1. Yaffs version 2, or Yaffs2, is the current version of Yaffs. While many of the details below remain the same, you can find up to date information split between the How Yaffs Works, Yaffs Tuning and Yaffs Direct documents.</em></p>\n<p>&nbsp;</p>\n<h2>Build options</h2>\n<p>Yaffs1 can be built as either a kernel module (ie. a Linux file system) or as an application.</p>\n<p>Of course the goal is to build Yaffs as a file system running on top of real NAND flash, but yaffs can be built to run on a RAM emulation layer for in-kernel testing without NAND flash in the system.</p>\n<p>Building as an application allows the yaffs_guts algorithms to be tested/debugged in a more friendly debugging environment. The test harness is in yaffsdev.c</p>\n<h3>Trying it out</h3>\n<p>Yaffs1 can be built to run with either mtd or RAM emulation, or both. The file system that interfaces to mtd is called <strong>yaffs</strong>, the file system that uses internal ram is called <strong>yaffsram</strong>. Yaffs1 simultaneously supports both if they are enabled.</p>\n<ol>\n<li>\n<p>Hack the Makefile and change the KERNELDIR define to your kernel directory.</p>\n </li>\n<li>\n<p>If you don\'t have mtd support in your kernel, then you might need to turn off USE_MTD otherwise the Yaffs module might not load.</p>\n </li>\n<li>\n<p>Type <strong>make clean; make</strong> to build yaffs</p>\n </li>\n<li>\n<p>Load Yaffs as a module by typing <strong>/sbin/insmod yaffs.o</strong> (ya gotta be root!).</p>\n </li>\n<li>\n<p>Create a mount point eg. <strong>mkdir /mnt/y</strong></p>\n </li>\n<li>\n<p>To mount the RAM emulation version of yaffs, <strong>mount -t yaffsram none /mnt/y</strong></p>\n </li>\n<li>\n<p>Alternatively, to mount the mtd version of yaffs, <strong>mount -t yaffs /dev/mtd0 /mnt/y</strong></p>\n </li>\n</ol>\n<p><br />\n&nbsp;</p>\n<h3>Yaffs1 Data structures</h3>\n<p>All data types are defined in yaffs_guts.h</p>\n<p>Yaffs1 uses the following major objects:</p>\n<ul>\n<li>\n<p>yaffs_Object: A yaffs_Object can be a file, directory, symlink or hardlink. The yaffs_Objects \"know\" about their corresponding yaffs_ObjectHeader in NAND and the data for that object. yaffs_Objects also bind together the directory structure as follows:</p>\n </li>\n<li>\n<p>parent: pointer to the yaffs_Object that is a parent of this yaffs_Object in the directory structure.</p>\n </li>\n<li>\n<p>siblings: this field is used to link together a list of all the yaffs_Objects in the same directory.</p>\n </li>\n<li>\n<p>children: if the object is a directory, then children holds the head of the list of objects in the directory.</p>\n </li>\n<li>\n<p>yaffs_Tnode: yaffs_Tnodes form a tree structure that speeds up the search for data chunks in a file. As the file grows in size, the levels increase. The Tnodes are a constant size (32 bytes). Level 0 (ie the lowest level) comprise 16 2-byte entries giving an index used to search for the chunkId. Tnodes at other levels comprise 8 4-byte pointer entries to other tnodes lower in the tree.</p>\n </li>\n<li>\n<p>yaffs_Device: this holds the device context and is in some ways analogous to the VFS superblock. It stores the data used to access the mtd as well as function pointers to access the NAND data.</p>\n </li>\n</ul>\n<p>The Tnodes and Objects are allocated in groups to reduce memory allocation/freeing overheads. Freed up tnodes and objects are kept in a free list and re-used.</p>\n<h3>yaffs_Object</h3>\n<p>struct yaffs_ObjectStruct</p>\n<p>{</p>\n<p>__u8 fake:1; // A fake object has no presence on NAND.</p>\n<p>__u8 renameAllowed:1; // Are we allowed to rename it?</p>\n<p>__u8 unlinkAllowed:1; // Are we allowed to unlink it?</p>\n<p>__u8 dirty:1; // the object needs to be written to flash</p>\n<p>__u8 valid:1; // When the file system is being loaded up, this</p>\n<p>// object might be created before the data</p>\n<p>// is available (ie. file data records appear before the header).</p>\n<p>__u8 serial; // serial number of chunk in NAND. Store here so we don\'t have to</p>\n<p>// read back the old one to update.</p>\n<p>__u16 sum; // sum of the name to speed searching</p>\n<p>struct yaffs_DeviceStruct *myDev; // The device I\'m on</p>\n<p>struct list_head hashLink; // list of objects in this hash bucket</p>\n<p>struct list_head hardLinks; // all the equivalent hard linked objects</p>\n<p>// live on this list</p>\n<p>// directory structure stuff</p>\n<p>struct yaffs_ObjectStruct *parent; //my parent directory</p>\n<p>struct list_head siblings; // siblings in a directory</p>\n<p>// also used for linking up the free list</p>\n<p>// Where\'s my data in NAND?</p>\n<p>int chunkId; // where it lives</p>\n<p>__u32 objectId; // the object id value</p>\n<p>__u32 st_mode; // protection</p>\n<p>__u32 st_uid; // user ID of owner</p>\n<p>__u32 st_gid; // group ID of owner</p>\n<p>__u32 st_atime; // time of last access</p>\n<p>__u32 st_mtime; // time of last modification</p>\n<p>__u32 st_ctime; // time of last change</p>\n<p>yaffs_ObjectType variantType;</p>\n<p>yaffs_ObjectVariant variant;</p>\n<p>};</p>\n<p><br />\n&nbsp;</p>\n<p>Obvious stuff skipped....</p>\n<p>fake, renameAllowed, unlinkAllowed are special flags for handling \"fake\" objects which live in the file system but do not live on NAND. Currently there are only two such objects: the root object and the lost+found directory. None of these may be renamed or unlinked.</p>\n<p>serial, sum: see yaffs_ObjectHeader.</p>\n<p>dirty indicates that the object\'s contents has changed and a new yaffs_ObjectHeader must be written to flash.</p>\n<p>valid indicates that the object has been loaded up. This is only used during scanning (yaffs_Scan()) since we can know of an object\'s existance - and thus need to create the object header - before we encounter the associated yaffs_ObjectHeader.</p>\n<p>hashlink is a list of Objects in the same hash bucket.</p>\n<p>The four variants hold extra info:</p>\n<p>Files hold the file size and the top level and pointer to the tnode tree for the file.</p>\n<p>Directories hold a list of children objects.</p>\n<p>Symlinks hold a pointer to the alias string. This is probably inefficient, but that probably does not matter since we don\'t expect to see many of these.</p>\n<p>Hardlinks hold information to identify the equivalent object.</p>\n<p><br />\n&nbsp;</p>\n<h3>File structure (tnodes)</h3>\n<p>File structures are done with a tiered indexing structure</p>\n<p><br />\n&nbsp;</p>\n<p><img alt=\"\" height=\"294\" src=\"http://www.aleph1.co.uk/yaffs/sv9349341.gif\" width=\"491\" /><br />\n<br />\n&nbsp;</p>\n<p>The file structure is maintained by a tree structure. Depending where it is in the tree, each tree node (<strong><em>tnode</em></strong>) (the blue/things) holds either:</p>\n<ul>\n<li>\n<p>.... if it is at the lowest level, then 16 __u16s which identify the page.</p>\n </li>\n<li>\n<p>.... if it is at a higher level (ie an internal tnode), then 8 pointers to lowest-level tnodes.</p>\n </li>\n</ul>\n<p>When the file starts out, it is assigned only one low-level tnode. When the file expands past what a single tnode can hold, then it is assigned a second tnode and an internal node is added to point to the two tnodes. As the file grows, more low-level tnodes and high level tnodes are added.</p>\n<p>Traversing the tnode tree to find a particular page in a file is quite simple: each internal tnode is selected from by using 3 bits of the page offset in the file. The level 0 page resolves 4 bits.</p>\n<p>For example, finding page 0x235 (ie. the one starting at file position 0x46800 would proceed as follows:</p>\n<p>0x235 is 0000001000110101, partitioned as follows. 000.000.100.011.0101</p>\n<p>Level</p>\n<p>Bits</p>\n<p>Selected value</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>3 or more if they exist</p>\n   </td>\n  <td>\n  <p>&gt;= 10</p>\n   </td>\n  <td>\n  <p>Zero</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>2</p>\n   </td>\n  <td>\n  <p>9 to 7</p>\n   </td>\n  <td>\n  <p>100 binary = 4</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>1</p>\n   </td>\n  <td>\n  <p>6 to 4</p>\n   </td>\n  <td>\n  <p>011 binary = 3</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>0</p>\n   </td>\n  <td>\n  <p>3 to 0</p>\n   </td>\n  <td>\n  <p>0101 binary = 5</p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p><br />\nFree tnodes are stored in a list. When the list is exhausted, more are allocated.</p>\n<p>Each tnode takes 32 bytes. Each file needs at least one level 0 tnode. How many do we need? A full 16MB file system needs at least 16MB/512/16 = 2000 level zero tnodes. More for internal tnodes. More for files smaller than optimal.</p>\n<p>The tree grows as required. When the file is resized to a smaller size then it is pruned.</p>\n<h3>NAND data</h3>\n<p>Data is stored on NAND in \"chunks\". Currently each chunk is the same size as a NAND flash page (ie. 512 bytes + 16 byte spare). In the future we might decide to allow for different chunk sizes. Chunks can hold either:</p>\n<ul>\n<li>\n<p>A yaffs_ObjectHeader. This is the way a yaffs_Object gets stored on NAND.</p>\n </li>\n<li>\n<p>A chunk of file data.</p>\n </li>\n</ul>\n<p>The 16 byte spare area contains:</p>\n<ul>\n<li>\n<p>8 bytes of tags,</p>\n </li>\n<li>\n<p>6 bytes of ECC data</p>\n </li>\n<li>\n<p>1 byte block status (used to identify damaged blocks)</p>\n </li>\n<li>\n<p>1 byte data status (currently unused).</p>\n </li>\n</ul>\n<p>The tags are made up as follows:</p>\n<p>typedef struct</p>\n<p>{</p>\n<p>unsigned chunkId:20; //chunk number in file</p>\n<p>unsigned serialNumber:2; //serial number for chunk</p>\n<p>unsigned byteCount:10; //number of bytes of data used in this chunk</p>\n<p>unsigned objectId:18; //the object id that this chunk belongs to.</p>\n<p>unsigned ecc:12; //ECC on tags</p>\n<p>unsigned unusedStuff:2; //unused</p>\n<p>} yaffs_Tags;</p>\n<p>&nbsp;</p>\n<p>A chunkId of zero indicates that this chunk holds a yaffs_ObjectHeader. A non zero value indicates that this is a data chunk and the position of the chunk in the file (ie. the first chunk - at offset 0 - has chunkId 1). See yaffs_guts.c:yaffs_Scan () to see how this is done.</p>\n<p>When a chunk is repalced (eg. file details changed or a part of a file was overwritten), the new chunk is written before the old chunk is deleted. This means that we don\'t lose data if there is a power loss after the new chunk is created but before the old one is discarded, but it does mean that we can encounter the situation where we find both the old and the new chunks in flash. The serialNumber is incremented each time the chunk is written. 2 bits is sufficient to resolve any ambiguity.</p>\n<p>bytecount applies only to data chunks and tells how many of the data bytes are valid.</p>\n<p>objectId says which object this chunk belongs to.</p>\n<p>ecc is used to perform error correction on the tags. Another ecc field is used to error correct the data.</p>\n<h3>yaffs_ObjectHeader</h3>\n<p>typedef struct</p>\n<p>{</p>\n<p>yaffs_ObjectType type;</p>\n<p>&nbsp;</p>\n<p>// Apply to everything</p>\n<p>int parentObjectId;</p>\n<p>__u16 sum; // checksum of name</p>\n<p>char name[YAFFS_MAX_NAME_LENGTH + 1];</p>\n<p>&nbsp;</p>\n<p>// Thes following apply to directories, files, symlinks - not hard links</p>\n<p>__u32 st_mode; // protection</p>\n<p>__u32 st_uid; // user ID of owner</p>\n<p>__u32 st_gid; // group ID of owner</p>\n<p>__u32 st_atime; // time of last access</p>\n<p>__u32 st_mtime; // time of last modification</p>\n<p>__u32 st_ctime; // time of last change</p>\n<p>&nbsp;</p>\n<p>// File size applies to files only</p>\n<p>int fileSize;</p>\n<p>&nbsp;</p>\n<p>// Equivalent object id applies to hard links only.</p>\n<p>int equivalentObjectId;</p>\n<p>// alias only applies to symlinks</p>\n<p>char alias[YAFFS_MAX_ALIAS_LENGTH + 1];</p>\n<p>&nbsp;</p>\n<p>&nbsp;</p>\n<p>} yaffs_ObjectHeader;</p>\n<p>&nbsp;</p>\n<p>A yaffs_ObjectHeader is stored in NAND for every yaffs_Object.</p>\n<p>type holds the type of yaffs_Object (file,directory,hardlink or symlink).</p>\n<p>parentObject is the objectId of this object\'s parent. name holds the object\'s name. Together these form the directory structure of the file system. Also worth mention is sum. This is a \"checksum\" on the name which speeds directory searching (ie. when searching the directory we only compare the name for those entries where sum matches).</p>\n<p>Obvious stuff skipped....</p>\n<p>equivalentObjectId is used by hardlinks. A hardlink to an object uses this field to specify the object that this links to. This way of doing things is a bit different than the normal Linux way of doing things (ie. keeping the links distinct from the inode) but is simpler and uses less space except for a few corner cases with hardlinks.</p>\n<p>alias is used by symlinks to hold the symlink alias string. This limits the size of the symlink alias. In future we should expand Yaffs1 to use data chunks to store aliases too long to fit into the yaffs_ObjectHeader.</p>\n<h3>NAND Interface</h3>\n<p>All NAND access is performed via four functions pointed to by yaffs_Device. At the moment a chunk is a page.</p>\n<ul>\n<li>\n<p>int WriteChunkToNAND(struct yaffs_DeviceStruct *dev,int chunkInNAND, const __u8 *data, yaffs_Spare *spare)</p>\n </li>\n<li>\n<p>int ReadChunkFromNAND(struct yaffs_DeviceStruct *dev,int chunkInNAND, __u8 *data, yaffs_Spare *spare);</p>\n </li>\n<li>\n<p>int EraseBlockInNAND(struct yaffs_DeviceStruct *dev,int blockInNAND);</p>\n </li>\n<li>\n<p>int InitialiseNAND(struct yaffs_DeviceStruct *dev);</p>\n </li>\n</ul>\n<p>In the Readxxx and Writexxx functions, the data and/or spare pointers may be NULL in which case these data transfers are ignored.</p>\n<p>A quick note about NAND:</p>\n<ul>\n<li>\n<p>NAND is not random access, but page oriented. Thus, we do all reads &amp; writes in pages.</p>\n </li>\n<li>\n<p>Each NAND page holds 512 bytes of data and 16 \"spare\" bytes. Yaffs structures the spare area with tags used to identify what is stored in the data area. There are 32 such pages to a block.</p>\n </li>\n<li>\n<p>NAND writes will only change 1 bits to 0. eg. if a byte holds 10110011 and you write 11011010 to it you will get the logical and of the two values: 10010010. The only way to get 1s again is to erase the entire block.</p>\n </li>\n<li>\n<p>You may only write to a page a few times before erasing the entire block. Yaffs lives within these limitations. Each page only gets written to twice (once when written and once when discarded).</p>\n </li>\n<li>\n<p>ECC is normally used with NAND to correct for single bit errors. Yaffs1 applies the ECC itself, so the MTD should not do this.</p>\n </li>\n<li>\n<p>The current mtd interfaces are not particularly well suited to Yaffs1 and we will address the issue with the mtd group. (The mtd interface does not support page-oriented read/write which Yaffs1 would prefer).</p>\n </li>\n</ul>\n<h3>mkyaffs</h3>\n<p>mkyaffs is the tool to format a NAND mtd to be used for Yaffs1. This is quite simple, just erase all the undamaged blocks. Yaffs1 treats erased blocks as free (empty) space.</p>\n<h2>Expected performance</h2>\n<p>The following numbers should give an indication of the performance we should expect from Yaffs1.</p>\n<p>As an example, I\'ll use the following numbers. Since the hardware is capable of 50ns read/write, these numbers allow for some other ovberheads. Clearly though, the performance can be degraded in various ways.</p>\n<p>Seek</p>\n<p>10uS/page</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>Read</p>\n   </td>\n  <td>\n  <p>100nS/byte</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Write</p>\n   </td>\n  <td>\n  <p>100nS/byte</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Program</p>\n   </td>\n  <td>\n  <p>200uS/page</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Erase</p>\n   </td>\n  <td>\n  <p>2mS/block</p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p>&nbsp;</p>\n<p>From this we can derive some higher-level numbers:</p>\n<p>Operation</p>\n<p>Time</p>\n<p>Calculation</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>Read spare</p>\n   </td>\n  <td>\n  <p>12uS</p>\n   </td>\n  <td>\n  <p>seek + 16 * read</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Read page</p>\n   </td>\n  <td>\n  <p>63 uS</p>\n   </td>\n  <td>\n  <p>seek + 528 * read</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Write page</p>\n   </td>\n  <td>\n  <p>326 uS</p>\n   </td>\n  <td>\n  <p>seek + 528 * write + program + read page (for verification)</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Discard page</p>\n   </td>\n  <td>\n  <p>212 uS</p>\n   </td>\n  <td>\n  <p>seek + 16 * write + program</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Overwrite page</p>\n   </td>\n  <td>\n  <p>538 uS</p>\n   </td>\n  <td>\n  <p>write page + discard page</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Erase overhead per page</p>\n   </td>\n  <td>\n  <p>63uS</p>\n   </td>\n  <td>\n  <p>erase/32</p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p><br />\n&nbsp;</p>\n<p>From this we can infer the following flash access times:</p>\n<p>Operation</p>\n<p>Time</p>\n<p>Calculation</p>\n<table>\n<tbody>\n <tr>\n </tr>\n <tr>\n  <td>\n  <p>Read 1MB file</p>\n   </td>\n  <td>\n  <p>0.13s (about 7.5 MB/s)</p>\n   </td>\n  <td>\n  <p>2000 * read page</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Write 1MB (clean system)</p>\n   </td>\n  <td>\n  <p>0.53s (about 1.8 MB/s)</p>\n   </td>\n  <td>\n  <p>2000 * write page</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Overwrite 1MB file (no gc)</p>\n   </td>\n  <td>\n  <p>1.08s (about 0.9MB/s)</p>\n   </td>\n  <td>\n  <p>2000 * overwrite page</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Overwrite 1MB with 50% gc</p>\n   </td>\n  <td>\n  <p>2.4s (about 0.4 MB/s)</p>\n   </td>\n  <td>\n  <p>2000 * overwrite page + 2000 * page copy (== overwrite page) + 4000 * erase overhead</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Delete 1MB file</p>\n   </td>\n  <td>\n  <p>0.43s (about 2.2 MB/s)</p>\n   </td>\n  <td>\n  <p>2000 * discard page</p>\n   </td>\n </tr>\n <tr>\n  <td>\n  <p>Delete 1MB file with 50% gc</p>\n   </td>\n  <td>\n  <p>0.49s (about 2.0MB/s)</p>\n   </td>\n  <td>\n  <p>2000 * discard page + 1000 * erase overhead</p>\n   </td>\n </tr>\n</tbody>\n</table>\n<p>&nbsp;</p>\n</div>\n      \";}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:39\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;}}',-1,1510823692.221,1,'config:filter.format.full_html node:39 node_view rendered','297'),('entity_view:node:39:search_result:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:2:\"39\";i:3;s:13:\"search_result\";}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:39\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1510823692.219,1,'config:filter.format.full_html node:39 node_view rendered','297'),('entity_view:node:400:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b05shBIa1rjinwW61ccdG8xL9h6XmBZ6TwSst_dvxpUTw','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:298:\"<article role=\"article\" about=\"/logos/bernina\" class=\"yaffs-user-logo full clearfix\">\n\n  \n    \n\n  \n  <div class=\"content\">\n    \n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p>Bernina use Yaffs.</p></div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:14:\"/logos/bernina\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:9:\"/node/400\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:14:\"/logos/bernina\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:400\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:21:\"<span>Bernina</span>\n\";}}',-1,1511428621.248,1,'config:filter.format.basic_html config:system.site node:400 node_view rendered user:1','278'),('entity_view:node:400:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"400\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:400\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1511428621.191,1,'config:filter.format.basic_html config:system.site node:400 node_view rendered user:1','278'),('entity_view:node:401:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b0gOO6DdBGbLE9Fgd0rArqGXDIBTszUnU7wiLjCuOpSWk','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:299:\"<article role=\"article\" about=\"/logos/gallagher\" class=\"yaffs-user-logo full clearfix\">\n\n  \n    \n\n  \n  <div class=\"content\">\n    \n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p>Used by Gallagher</p></div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:16:\"/logos/gallagher\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:9:\"/node/401\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:16:\"/logos/gallagher\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:401\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:23:\"<span>Gallagher</span>\n\";}}',-1,1513554571.985,1,'config:filter.format.basic_html config:system.site node:401 node_view rendered user:1','280'),('entity_view:node:401:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"401\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:401\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1513554571.983,1,'config:filter.format.basic_html config:system.site node:401 node_view rendered user:1','280'),('entity_view:node:407:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b0OOs4htQoiIF17gfDFz9xe_CLus6bKJGx0_OV93aPEjE','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:708:\"<article role=\"article\" about=\"/features/booting-fast\" class=\"what-is-special-about-yaffs is-promoted full clearfix\">\n\n  \n    \n\n  \n  <div class=\"content\">\n    \n  <div class=\"field field--name-field-icon-text field--type-string field--label-above\">\n    <div class=\"field--label\">Icon - text</div>\n              <div class=\"field--item\">fa-space-shuttle</div>\n          </div>\n\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p>Being quick to boot was one of the fundamental requirements in Yaffs\' design. Boot-time scanning to build the file structure lists should require just one pass reading NAND memory.</p></div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:22:\"/features/booting-fast\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:9:\"/node/407\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:22:\"/features/booting-fast\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:407\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:32:\"<span>Booting is fast...</span>\n\";}}',-1,1511166125.993,1,'config:filter.format.basic_html config:system.site node:407 node_view rendered user:1','278'),('entity_view:node:407:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"407\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:407\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1511166125.978,1,'config:filter.format.basic_html config:system.site node:407 node_view rendered user:1','278'),('entity_view:node:407:search_result:[languages:language_interface]=en:[theme]=yaffs:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:559:\"<span>Booting is fast...</span>\n\n  <div class=\"field field--name-field-icon-text field--type-string field--label-above\">\n    <div class=\"field--label\">Icon - text</div>\n              <div class=\"field--item\">fa-space-shuttle</div>\n          </div>\n\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p>Being quick to boot was one of the fundamental requirements in Yaffs\' design. Boot-time scanning to build the file structure lists should require just one pass reading NAND memory.</p></div>\n      \";}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:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:407\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;}}',-1,1511166101.725,1,'config:filter.format.basic_html node:407 node_view rendered','265'),('entity_view:node:407:search_result:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"407\";i:3;s:13:\"search_result\";}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:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:407\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1511166101.723,1,'config:filter.format.basic_html node:407 node_view rendered','265'),('entity_view:node:407:teaser:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:774:\"<article role=\"article\" about=\"/features/booting-fast\" class=\"what-is-special-about-yaffs is-promoted teaser clearfix\">\n\n  \n      <h2>\n      <a href=\"/features/booting-fast\" rel=\"bookmark\"><span>Booting is fast...</span>\n</a>\n    </h2>\n    \n\n  \n  <div class=\"content\">\n    <ul class=\"links inline list-inline\"><li class=\"node-readmore\"><a href=\"/features/booting-fast\" rel=\"tag\" title=\"Booting is fast...\" hreflang=\"und\">Read more<span class=\"visually-hidden\"> about Booting is fast...</span></a></li></ul>\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\">It is important for a Flash filesystem to boot fast, so boot speed was a fundamental consideration in the design of Yaffs.</div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:0:{}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:5:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";}s:4:\"tags\";a:4:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:407\";i:2;s:9:\"node_view\";i:3;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}}',-1,1510950428.147,1,'config:filter.format.basic_html node:407 node_view rendered user:1','272'),('entity_view:node:407:teaser:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"407\";i:3;s:6:\"teaser\";}s:8:\"contexts\";a:5:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";}s:4:\"tags\";a:4:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:407\";i:2;s:9:\"node_view\";i:3;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1510950428.145,1,'config:filter.format.basic_html node:407 node_view rendered user:1','272'),('entity_view:node:408:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b0YN866JtIRQbEizHOIATkZSl4BH4VcBoMHbRsOh0R8C0','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:1294:\"<article role=\"article\" about=\"/features/active-community\" class=\"what-is-special-about-yaffs is-promoted full clearfix\">\n\n  \n    \n\n  \n  <div class=\"content\">\n    \n  <div class=\"field field--name-field-icon-text field--type-string field--label-above\">\n    <div class=\"field--label\">Icon - text</div>\n              <div class=\"field--item\">fa-users</div>\n          </div>\n\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p>You can learn from the experience of people and companies who are working with Yaffs. Thousands of developers have used Yaffs successfully, and commercially-licensed Yaffs has many customers that use it repeatedly. Have a look at the mailing list - it\'s a great place to start if you have some questions.<br /><a href=\"http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs\">http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs</a></p>\n\n<p>The searchable archive of postings is at <a href=\"http://lists.aleph1.co.uk/lurker/list/yaffs.html\">http://lists.aleph1.co.uk/lurker/list/yaffs.html   </a>Or search online to see the variety of work done with Yaffs as its basis - from research papers through to skunkworks projects for testing particular concepts.</p></div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:26:\"/features/active-community\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:9:\"/node/408\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:26:\"/features/active-community\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:408\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:36:\"<span>An active community...</span>\n\";}}',-1,1511824447.324,1,'config:filter.format.basic_html config:system.site node:408 node_view rendered user:1','278'),('entity_view:node:408:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"408\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:5:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:18:\"config:system.site\";i:2;s:8:\"node:408\";i:3;s:9:\"node_view\";i:4;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1511824447.317,1,'config:filter.format.basic_html config:system.site node:408 node_view rendered user:1','278'),('entity_view:node:408:search_result:[languages:language_interface]=en:[theme]=yaffs:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:1145:\"<span>An active community...</span>\n\n  <div class=\"field field--name-field-icon-text field--type-string field--label-above\">\n    <div class=\"field--label\">Icon - text</div>\n              <div class=\"field--item\">fa-users</div>\n          </div>\n\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\"><p>You can learn from the experience of people and companies who are working with Yaffs. Thousands of developers have used Yaffs successfully, and commercially-licensed Yaffs has many customers that use it repeatedly. Have a look at the mailing list - it\'s a great place to start if you have some questions.<br /><a href=\"http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs\">http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs</a></p>\n\n<p>The searchable archive of postings is at <a href=\"http://lists.aleph1.co.uk/lurker/list/yaffs.html\">http://lists.aleph1.co.uk/lurker/list/yaffs.html   </a>Or search online to see the variety of work done with Yaffs as its basis - from research papers through to skunkworks projects for testing particular concepts.</p></div>\n      \";}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:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:408\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;}}',-1,1512113328.825,1,'config:filter.format.basic_html node:408 node_view rendered','265'),('entity_view:node:408:search_result:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"408\";i:3;s:13:\"search_result\";}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:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:408\";i:2;s:9:\"node_view\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1512113328.823,1,'config:filter.format.basic_html node:408 node_view rendered','265'),('entity_view:node:408:teaser:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:3:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:788:\"<article role=\"article\" about=\"/features/active-community\" class=\"what-is-special-about-yaffs is-promoted teaser clearfix\">\n\n  \n      <h2>\n      <a href=\"/features/active-community\" rel=\"bookmark\"><span>An active community...</span>\n</a>\n    </h2>\n    \n\n  \n  <div class=\"content\">\n    <ul class=\"links inline list-inline\"><li class=\"node-readmore\"><a href=\"/features/active-community\" rel=\"tag\" title=\"An active community...\" hreflang=\"und\">Read more<span class=\"visually-hidden\"> about An active community...</span></a></li></ul>\n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\">There\'s an active community of people who use Yaffs and who have developed with Yaffs, just a click or two away.</div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:0:{}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:5:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";}s:4:\"tags\";a:4:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:408\";i:2;s:9:\"node_view\";i:3;s:6:\"user:1\";}s:7:\"max-age\";i:-1;}}',-1,1510950428.130,1,'config:filter.format.basic_html node:408 node_view rendered user:1','272'),('entity_view:node:408:teaser:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"408\";i:3;s:6:\"teaser\";}s:8:\"contexts\";a:5:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";}s:4:\"tags\";a:4:{i:0;s:31:\"config:filter.format.basic_html\";i:1;s:8:\"node:408\";i:2;s:9:\"node_view\";i:3;s:6:\"user:1\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1510950428.122,1,'config:filter.format.basic_html node:408 node_view rendered user:1','272'),('entity_view:node:409:full:[languages:language_interface]=en:[theme]=yaffs:[timezone]=Europe/London:[url.path.is_front]=is_front.0:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b0-wS7UjeTEFoBIZylP0HhFmhxA6By9lI7zUVMVTu3GrI','a:5:{s:7:\"#markup\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:229167:\"<article role=\"article\" about=\"/documents/how-yaffs-works\" class=\"paper is-promoted full clearfix\">\n\n  \n    \n\n      <footer>\n      \n      <div class=\"author\">\n        Submitted by <span><span lang=\"\" about=\"/user/charles-manning\" typeof=\"schema:Person\" property=\"schema:name\" datatype=\"\">Charles Manning</span></span>\n on <span>2 June, 2012 - 12:28am</span>\n        \n      </div>\n    </footer>\n  \n  <div class=\"content\">\n    \n      <div class=\"field field--name-upload field--type-file field--label-hidden field--items\">\n              <div class=\"field--item\"><span class=\"file file--mime-application-pdf file--application-pdf icon-before\"><span class=\"file-icon\"><span class=\"icon glyphicon glyphicon-file text-primary\" aria-hidden=\"true\"></span></span><span class=\"file-link\"><a href=\"https://yaffs.net/sites/default/files/downloads/HowYaffsWorks.pdf\" type=\"application/pdf; length=402514\" title=\"Open file in new window\" target=\"_blank\" data-toggle=\"tooltip\" data-placement=\"bottom\">HowYaffsWorks.pdf</a></span><span class=\"file-size\">393.08 KB</span></span></div>\n          </div>\n  \n            <div class=\"field field--name-body field--type-text-with-summary field--label-hidden field--item\">\n<p style=\"margin-top: 0.42cm; orphans: 0; widows: 0; page-break-after: avoid\"><br />\n<br />\n</p>\n<p>This document aims to give an explanation of most of the core mechanisms that make Yaffs work. </p>\nThis document is the starting point for understanding Yaffs.\n<h1 class=\"western\">1 Purpose</h1>\n<p>The purpose of this document is to give a reasonable explanation of most of the core mechanisms that make Yaffs work. As of the time of writing this, the Yaffs2 code base includes approximately 19,000 lines of code making a very detailed discussion impractical.</p>\n<p>This document should serve as a first port of call for understanding Yaffs. Further detailed questions and discussions are welcomed on the Yaffs discussion list.</p>\n<p>This document is updated periodically. Yaffs mechanism design changes from time to time and this document will not always reflect the most up to date code. </p>\n<h1 class=\"western\">2 What is Yaffs?</h1>\n<p>Yaffs stands for <i>Yet Another Flash File System</i>, a term coined by Charles Manning in 2001 when suggesting that the already cluttered flash file system space could do with yet another offering – this time a flash file system designed from the ground up to work with NAND flash.</p>\n<p>The first release of Yaffs was developed during the end of 2001 and the beginning of 2002. By mid-2002, Yaffs was being trialled in various products. In May 2002, Yaffs was announced and a few more projects started playing with it. In June, porting to other OSs started. In September 2002, Yaffs was announced on linuxdevices.com which started a far wider uptake of Yaffs.</p>\n<p>Yaffs1, the original version of Yaffs, supported 512-byte page NAND devices with a SmartMedia-like memory layout.</p>\n<p>Yaffs2 is a follow-up to Yaffs1 extending Yaffs1 to support larger and different devices with different constraints.</p>\n<p>Yaffsis highly portable and has been used in many different products and applications as varied as sewing machines, point of sale, phones and aerospace. Yaffs has been used with multiple different operating systems. Native support is available for Linux, WindowsCE and eCOS while Yaffs Direct Interface provides a layer that can be used in other applications such as RTOSs. Yaffs has been used with multiple different CPUs and compilers.</p>\n<p>Yaffs has also been used as a NOR file system and even as a RAM file system.</p>\n<h1 class=\"western\">3 Design and coding strategies</h1>\n<p>Yaffs is designed to work in multiple environments which drives the need for portability. Portability also improves the debugging and testing since it is easier to develop and debug code in an application environment than within an OS kernel. This generally allows Yaffs to progress faster with less programming resources and provides more varied testing. Primary strategies that improve portability include:</p>\n<ul>\n<li>\n<p>No OS-specific features used in main code body.</p>\n </li>\n<li>\n<p>No compiler-specific features used in the main code body.</p>\n </li>\n<li>\n<p>Abstract types and functions used to allow Unicode or ASCII operation.</p>\n </li>\n</ul>\n<p style=\"page-break-before: auto; page-break-after: avoid\">Simplicity is another key goal. Complexity is limited to those situations that provide significant improvements to performance or utility. Simplicity improves robustness and the ease of integration and development. Primary strategies that improve simplicity are:</p>\n<ul>\n<li>\n<p>Single threaded model. Yaffs is locked on a per-partition basis at a high level. This is simpler than tracking lower-level locking. Yaffs Direct Interface uses a single lock for all partitions.</p>\n </li>\n</ul>\n<ul>\n<li>\n<p>Log structure makes for a simpler garbage collector and allocation methodology.</p>\n </li>\n<li>\n<p>Abstractions that build layered code which is easier to understand, port and debug.</p>\n </li>\n</ul>\n<h1 class=\"western\">4 Terminology: Yaffs vs Yaffs1 vs Yaffs2</h1>\n<p>Before we embark on our quest to understand what Yaffs is, a terminology explanation is in order.</p>\n<p>There are two versions of Yaffs code: the original Yaffs code-base and the current Yaffs2 code-base. The Yaffs2 code-base supports functionality provided by the Yaffs code-base as well as being extended with new functionality to provide extra modes of operation, most importantly those required to work with larger and more modern NAND parts. The Yaffs2 code-base supports the Yaffs1 mode of operation through a backward compatibility mode.</p>\n<p>Unless explicitly mentioned, this text refers to the Yaffs2 code-base.</p>\n<p>This text uses three terms Yaffs, Yaffs1 and Yaffs2 depending on various modes of operation.</p>\n<ul>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Yaffs1 is a simpler mode of operation that uses deletion markers to track state. </span> </p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Yaffs2 is a more complex mode of operating that was developed to support larger modern flash types, in particular MLC NAND, that cannot used deletion markers.</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Yaffs means operations common to both.</span></p>\n </li>\n</ul>\n<p>Yaffs1 originally only worked with 512-byte page devices but has been extended to support larger flash pages such as Intel M18 flash with 1k pages.</p>\n<p>Yaffs2 was originally designed for 1k or larger page sizes but can be used with smaller pages by using in-band tags.</p>\n<p>Since the Yaffs1 mode of operation is simpler to understand than the Yaffs2 mode of operation, Yaffs1 will be described first and readers interested in Yaffs2 operation should first fully acquaint themselves with the Yaffs1 mode of operation. It is suggested that this document be read sequentially rather than browsing it.</p>\n<h1 class=\"western\">5 Objects</h1>\n<p>In Yaffs-speak, an Object is anything that is stored in the file system. These are:</p>\n<ul>\n<li>\n<p>Regular data files</p>\n </li>\n<li>\n<p>Directories</p>\n </li>\n<li>\n<p>Hard-links</p>\n </li>\n<li>\n<p>Symbolic links</p>\n </li>\n<li>\n<p>Special objects (pipes, devices etc).</p>\n </li>\n</ul>\n<p>All objects are identified by a unique integer object id (<i><b>obj_id</b></i><i><b>)</b></i>.</p>\n<p>In the standard POSIX model, as used by Linux, there are inodes and directory entries (dentries). </p>\n<p>An inode may be a regular file, directory, or special file.</p>\n<p>Directory entries provide the naming mechanism that is used to locate inodes.</p>\n<p>Under POSIX, each inode may have zero, one or many dentries:</p>\n<ul>\n<li>\n<p>One dentry per inode is commonly understood.</p>\n </li>\n<li>\n<p>Multiple dentries per inode allow the same inode to be accessed via multiple names. This is achieved through hard links.</p>\n </li>\n<li>\n<p>Zero dentries per inode is less often understood. This happens when an inode is unlinked while there is still a handle open to the inode. The unlinking deletes the dentry but the inode still exists. As soon as the handle is closed the inode is deleted too.</p>\n </li>\n</ul>\n<h1 class=\"western\">6 The Yaffs NAND model</h1>\n<p>The memory in NAND flash is arranged in <i><b>pages.</b></i> A page is the unit of allocation and programming. In Yaffs, the unit of allocation is the <i></i><i><b>chunk</b></i>. Typically a chunk will be the same as a NAND page, but there is flexibility to use chunks which map to multiple pages (eg. A system may have two NAND chips in parallel requiring 2x2048 = 4096 byte chunks) . This distinction gives a lot of flexibility in how the system can be configured. In this text the term page and chunk are synonymous unless stated otherwise.</p>\n<p>Many, typically 32 to 128 but as many as a few hundred, chunks form a <i><b>block</b></i>. A block is the unit of erasure. </p>\n<p>NAND flash may be shipped with bad blocks and further blocks may go bad during the operation of the device. Thus, Yaffs is aware of bad blocks and needs to be able to detect and mark bad blocks.</p>\n<p>NAND flash also typically requires the use of some sort of error detection and correction code (ECC). Yaffs can either use existing ECC logic or provide its own.</p>\n<h1 class=\"western\">7 How Yaffs1 stores files</h1>\n<p>Yaffs1 has a modified log structure, while Yaffs2 (see below) has a true log structure. A true log structured file system only ever writes sequentially. Yaffs1 uses deletion markers, which breaks the sequential write rule. Yaffs2 does not use deletion markers and is thus a true log structured file system.</p>\n<p>Instead of writing data in locations specific to the files, the file system data is written in the form of a sequential log, The entries in the log are all one chunk in size and can hold one of two types of chunk:</p>\n<ul>\n<li>\n<p><i><b>Data chunk</b></i>: A chunk holding regular data file contents.</p>\n </li>\n<li>\n<p><i><b>Object Header</b></i>: A descriptor for an object (directory, regular data file, hard link, soft link, special descriptor,...). This holds details such as the identifier for the parent directory, object name, etc.</p>\n </li>\n</ul>\n<p>Each chunk has <i><b>tags</b></i> associated with it. The tags comprise the following important fields (others being ignored for now):</p>\n<ul>\n<li>\n<p><i><b>Object Id (</b></i><i><b>obj_id</b></i><i><b>)</b></i>: Identifies which object the chunk belongs to.</p>\n </li>\n<li>\n<p><i><b>Chunk Id (</b></i><i><b>chunk_id</b></i><i><b>)</b></i>: Identifies where in the file this chunk belongs. A chunk_id of zero signifies that this chunk contains an objectHeader. chunk_id==1 signifies the first chunk in the file (ie. At file offset 0), chunk_id==2 is the next chunk and so on.</p>\n </li>\n<li>\n<p><i><b>Deletion Marker (</b></i><i><b>is_deleted</b></i><i><b>)</b></i><i><b>:</b></i> (Yaffs1 only) Shows that this chunk is no longer in use.</p>\n </li>\n<li>\n<p><i><b>Byte Count</b></i><b>: </b><b>(n_bytes)</b>: Number of bytes of data if this is a data chunk.</p>\n </li>\n<li>\n<p><i><b>Serial Number </b></i><i><b>(ser</b></i><i><b>ia</b></i><i><b>l_number)</b></i>: (Yaffs1 only) Serial number used to differentiate chunks with the same obj_id and chunk_id.</p>\n </li>\n</ul>\n<p style=\"page-break-before: always\">Now let\'s bring that all together in an explanation. This is a simplified explanation and skips over issues such as Soft Deletion (mentioned later in the document). For explanation purposes, we shall consider usage of fictitious NAND type that has 4 chunks per block, starting with an empty (erased) flash.</p>\n<p>First we\'ll create a file.</p>\n<table cellpadding=\"4\" style=\"width: 605px; border-spacing: 0px;\">\n<col width=\"37\" /> <col width=\"56\" /> <col width=\"67\" /> <col width=\"60\" /> <col width=\"64\" /> <col width=\"271\" />\n<tr valign=\"top\">\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p style=\"font-weight: normal\">Block</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 56px;\">\n <p style=\"font-weight: normal\">Chunk</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 67px;\">\n <p style=\"font-weight: normal\">obj_id</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p style=\"font-weight: normal\">chunk_id</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p style=\"font-weight: normal\">Deletion</p>\n  </td>\n <td style=\"border: 1px solid #000000; padding: 0.1cm; width: 271px;\">\n <p style=\"font-weight: normal\">Comment</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px; height: 26px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 56px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 67px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>Live</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 271px;\">\n <p>Object Header for this file (length 0)</p>\n  </td>\n</tr>\n</table>\n<p>Next we write a few chunks of data to the file.</p>\n<table cellpadding=\"4\" style=\"width: 605px; border-spacing: 0px;\">\n<col width=\"37\" /> <col width=\"48\" /> <col width=\"60\" /> <col width=\"64\" /> <col width=\"56\" /> <col width=\"290\" />\n<tr valign=\"top\">\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>Block</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>Chunk</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>obj_id</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>chunk_id</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 56px;\">\n <p>Deletion</p>\n  </td>\n <td style=\"border: 1px solid #000000; padding: 0.1cm; width: 290px;\">\n <p>Comment</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 56px;\">\n <p>Live</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 290px;\">\n <p>Object Header for t<span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">his file (length 0)</span></p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 56px;\">\n <p>Live</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 290px;\">\n <p>First chunk of data</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 56px;\">\n <p>Live</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 290px;\">\n <p>Second chunk of data</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>3</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>3</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 56px;\">\n <p>Live</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 290px;\">\n <p>Third chunk of data</p>\n  </td>\n</tr>\n</table>\n<p>Next we close the file. This writers a new object header for the file. Notice how the previous object header is deleted.</p>\n<table cellpadding=\"4\" style=\"width: 605px; border-spacing: 0px;\">\n<col width=\"37\" /> <col width=\"48\" /> <col width=\"60\" /> <col width=\"68\" /> <col width=\"60\" /> <col width=\"282\" />\n<tr valign=\"top\">\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>Block</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>Chunk</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>obj_id</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 68px;\">\n <p>chunk_id</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>Deletion</p>\n  </td>\n <td style=\"border: 1px solid #000000; padding: 0.1cm; width: 282px;\">\n <p>Comment</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 68px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>Deleted</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 282px;\">\n <p>Obsoleted object header <span style=\"font-size: 10pt; font-size: small; font-size: small;\">(length 0)</span></p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 68px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>Live</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 282px;\">\n <p>First chunk of data</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 68px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>Live</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 282px;\">\n <p>Second chunk of data</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>3</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 68px;\">\n <p>3</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>Live</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 282px;\">\n <p>Third chunk of data</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 68px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>Live</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 282px;\">\n <p>New object header <span style=\"font-size: 10pt; font-size: small; font-size: small;\">(length n)</span></p>\n  </td>\n</tr>\n</table>\n<p style=\"page-break-before: always\">Let\'s now open the file for read/write, overwrite part of the first chunk in the file and close the file. The replaced data and object header chunks become deleted.</p>\n<table cellpadding=\"4\" style=\"page-break-inside: avoid; width: 605px; border-spacing: 0px;\">\n<col width=\"37\" /> <col width=\"48\" /> <col width=\"64\" /> <col width=\"64\" /> <col width=\"71\" /> <col width=\"271\" />\n<tr valign=\"top\">\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>Block</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>Chunk</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>obj_id</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>chunk_id</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 71px;\">\n <p>Deletion</p>\n  </td>\n <td style=\"border: 1px solid #000000; padding: 0.1cm; width: 271px;\">\n <p>Comment</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 71px;\">\n <p>Deleted</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 271px;\">\n <p>Obsolete object header.</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 71px;\">\n <p>Deleted</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 271px;\">\n <p>Obsolete first chunk of data</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 71px;\">\n <p>Live</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 271px;\">\n <p>Second chunk of data</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>3</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>3</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 71px;\">\n <p>Live</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 271px;\">\n <p>Third chunk of data</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 71px;\">\n <p>Deleted</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 271px;\">\n <p>Obsolete object header</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 71px;\">\n <p>Live</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 271px;\">\n <p>New first chunk of file</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 71px;\">\n <p>Live</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 271px;\">\n <p>New object header</p>\n  </td>\n</tr>\n</table>\n<p>Now let\'s resize the file to zero by opening the file with O_TRUNC and closing the file. This writes a new object header with length 0 and the contents are pruned making the data chunks deleted.</p>\n<table cellpadding=\"4\" style=\"width: 605px; border-spacing: 0px;\">\n<col width=\"37\" /> <col width=\"48\" /> <col width=\"64\" /> <col width=\"64\" /> <col width=\"71\" /> <col width=\"271\" />\n<tr valign=\"top\">\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>Block</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>Chunk</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>obj_id</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>chunk_id</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 71px;\">\n <p>Deletion</p>\n  </td>\n <td style=\"border: 1px solid #000000; padding: 0.1cm; width: 271px;\">\n <p>Comment</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 71px;\">\n <p>Deleted</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 271px;\">\n <p>Obsolete object header.</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 71px;\">\n <p>Deleted</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 271px;\">\n <p>Obsolete first chunk of data</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 71px;\">\n <p>Deleted</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 271px;\">\n <p>Second chunk of data</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>3</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>3</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 71px;\">\n <p>Deleted</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 271px;\">\n <p>Third chunk of data</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 71px;\">\n <p>Deleted</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 271px;\">\n <p>Obsolete object header</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 71px;\">\n <p>Deleted</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 271px;\">\n <p>Deleted first chunk of file</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 71px;\">\n <p>Delted</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 271px;\">\n <p>Obsoleted object header</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 37px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 48px;\">\n <p>3</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 64px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 71px;\">\n <p>Live</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 271px;\">\n <p>New object header <span style=\"font-size: 10pt; font-size: small; font-size: small;\">(length 0).</span></p>\n  </td>\n</tr>\n</table>\n<p>Note how all the pages in block 1 are now marked as deleted. This means that block 1 no longer contains useful information so we can now erase block 1 and reuse the space.</p>\n<p>We will now rename the file. To do this we write a new object header for the file</p>\n<table cellpadding=\"4\" style=\"page-break-inside: avoid; width: 605px; border-spacing: 0px;\">\n<col width=\"38\" /> <col width=\"42\" /> <col width=\"58\" /> <col width=\"60\" /> <col width=\"60\" /> <col width=\"297\" />\n<tr valign=\"top\">\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 38px;\">\n <p>Block</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 42px;\">\n <p>Chunk</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 58px;\">\n <p>obj_id</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>chunk_id</p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>Deleted</p>\n  </td>\n <td style=\"border: 1px solid #000000; padding: 0.1cm; width: 297px;\">\n <p>Comment</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 38px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 42px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 58px;\">\n <p><br />\n  </p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p><br />\n  </p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p><br />\n  </p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 297px;\">\n <p>Erased</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 38px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 42px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 58px;\">\n <p><br />\n  </p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p><br />\n  </p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p><br />\n  </p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 297px;\">\n <p>Erased</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 38px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 42px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 58px;\">\n <p><br />\n  </p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p><br />\n  </p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p><br />\n  </p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 297px;\">\n <p>Erased</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 38px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 42px;\">\n <p>3</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 58px;\">\n <p><br />\n  </p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p><br />\n  </p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p><br />\n  </p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 297px;\">\n <p>Erased</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 38px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 42px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 58px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>Deleted</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 297px;\">\n <p>Obsolete object header</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 38px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 42px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 58px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>1</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>Deleted</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 297px;\">\n <p>Deleted first chunk of file</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 38px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 42px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 58px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>Deleted</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 297px;\">\n <p>Obsoleted object header</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 38px;\">\n <p>2</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 42px;\">\n <p>3</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 58px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>Deleted</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 297px;\">\n <p>Obsolete object header</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 38px;\">\n <p>3</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 42px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 58px;\">\n <p>500</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>0</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 60px;\">\n <p>Live</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 297px;\">\n <p>New object header showing new name</p>\n  </td>\n</tr>\n</table>\n<p>Block 2 now contains only deleted chunks and can be erased and reused.</p>\n<p>Note how the tags tell us:</p>\n<ul>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Which chunks belong to which object</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">The position of the chunks within a file,</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Which chunks are current</span></p>\n </li>\n</ul>\n<ul>\n</ul>\n<p><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">Note that there are no file allocation tables or similar structures stored in the flash. This reduces the amount of writing and erasing (improving write performance) while also improving robustness. Corruption of file allocation tables and similar structures is a common failure mechanism for embedded file systems. The lack of such structures makes Yaffs more robust. Or, to put it another way, you can\'t corrupt what you don\'t store.</span></p>\n<h1 class=\"western\">8 Garbage collection</h1>\n<p>As we have shown so far, when a block is made up only of deleted chunks, that block can be erased and reused. However, consider what will happen if we have many blocks which each have a few current chunks in them. Clearly we cannot erase any of the current blocks or we will destroy data. What we need to do is copy the useful data chunks off a block, deleting the originals and allowing the block to be erased and reused. This process is referred to as <i><b>garbage collection</b></i>.</p>\n<p>The Yaffs garbage collection process works as follows:</p>\n<ol>\n<li>\n<p>Find a block worth collecting (according the the heuristics below). If none found, then exit.</p>\n </li>\n<li>\n<p>Iterate through the chunks in the block. If the chunk is in use then create a new copy and delete the original. Fix up the RAM data structures to reflect the change.</p>\n </li>\n</ol>\n<p>Once all chunks in this block have been deleted, the block can be erased ready for reuse.</p>\n<p>Note that although step 2 deletes the original chunk when it gets copied there is not much point in actually programming the deletion marker (is_deleted flag) in flash since we\'re about to erase the block anyway. Thus Yaffs does not program the deletion marker in these cases. If power is lost part way through the operation we can still tell the difference between the original and the copy by looking at the serial number (not that it really matters anyway since the two have the same contents so either can be used).</p>\n<p>The heuristics to determine whether a block is worth collecting are as follows:</p>\n<ol>\n<li>\n<p>If there are many erased blocks available, then Yaffs does not need to work hard, but will instead only attempt to perform garbage collection of blocks with very few chunks in use. This is termed <i><b>passive</b></i> garbage collection.</p>\n </li>\n<li>\n<p>If, however, there are very few erased blocks, Yaffs will work much harder to recover more space and will garbage collect blocks with more chunks in use. This is termed <i><b>aggressive</b></i> garbage collection.</p>\n </li>\n</ol>\n<p>OK, the passive/aggressive names are a bit silly, but they were contrived around midnight... give me a break!</p>\n<p>If garbage collection is aggressive, we need erased space urgency and the whole block is collected in a single garbage collection cycle. If the collection is passive then only a few chunks are collected at a time thus spreading the effort over many garbage collection cycles. This is done to reduce garbage collection load and improve responsiveness.</p>\n<p>The rationale behind the above heuristics is to delay garbage collection when possible to reduce the amount of collection that needs to be performed, thus increasing average system performance. Yet there is a conflicting goal of trying to spread the garbage collection so that it does not all happen at the same causing fluctuations in file system throughput. These conflicting goals make garbage tuning quite challenging.</p>\n<p>All flash file systems need some sort of garbage collector to reclaim space. The garbage collector is often a determining factor in the performance of the flash file system. Many file systems have to do a significant amount of effort in a single collection sweep.</p>\n<p>Yaffs only deals with one block at a time which constrains the amount of effort in a garbage collection cycle, thus reducing the “stall time”. Under normal conditions that garbage collection is performed a few chunks at a time, further reducing “stall time”.</p>\n<h1 class=\"western\">9 Yaffs1 serial numbers</h1>\n<p>In Yaffs1, each chunk is marked with a 2-bit serial number that is incremented every time a chunk with the same tags value is replaced (eg. When a chunk is overwritten or when copied by garbage collection).</p>\n<p>Now let\'s suppose first that we did not have a serial number. </p>\n<p>Let\'s consider a rename where an object header chunk must be replaced with a new one with the new name. Yaffs could do the following:</p>\n<ul>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Delete the old chunk.</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Write the new chunk. </span> </p>\n </li>\n</ul>\n<p>If the system fails after the delete, the system could end up with no chunks matching the relevant tags values. This could cause files to be lost (end up in the lost+found directory). Thus, we have to write the new chunk before deleting the old chunk.</p>\n<p>But now consider what might happen if we did this:</p>\n<ul>\n<li>\n<p>W<span style=\"font-family: Liberation Serif, serif;\">rite new chunk.</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Delete old chunk.</span></p>\n </li>\n</ul>\n<p>If the system failed after the write we now have two chunks that match the tags. How can we tell which one is current?</p>\n<p>The current chunk is determined by inspecting the serial number. Since the serial number is only incremented by one before the old chunk is deleted, a 2-bit serial number is sufficient. Valid pairs are:</p>\n<table cellpadding=\"4\" style=\"width: 86px; border-spacing: 0px;\">\n<col width=\"35\" /> <col width=\"33\" />\n<tr valign=\"top\">\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 35px;\">\n <p>Old</p>\n  </td>\n <td style=\"border: 1px solid #000000; padding: 0.1cm; width: 33px;\">\n <p>New</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 35px;\">\n <p>00</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 33px;\">\n <p>01</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 35px;\">\n <p>01</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 33px;\">\n <p>10</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 35px;\">\n <p>10</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 33px;\">\n <p>11</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 35px;\">\n <p>11</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 33px;\">\n <p>00</p>\n  </td>\n</tr>\n</table>\n<p>Thus, by inspecting the serial number attached to the old and new tags the current chunk can be determined and the old chunk can be deleted.</p>\n<h1 class=\"western\">10 Yaffs2 NAND model</h1>\n<p>Yaffs2 is an extension of Yaffs designed to fulfill a new set of objectives to work with newer NAND types including:</p>\n<ul>\n<li>\n<p>Zero overwrites. Yaffs1 only ever overwrites a single byte in the spare area of the chunks to set the deletion marker. More modern NAND devices are less tolerant of overwrites and Yaffs2 performs no overwrites at all.</p>\n </li>\n<li>\n<p>Sequential chunk writing within a block. More modern NAND reliability specifications tend to assume sequential writing. Since Yaffs2 does not write deletion markers, the writing of chunks within a block is strictly sequential.</p>\n </li>\n<li>\n<p>Some flash technologies – such as MLC – only work properly if pages are written sequentially. This is a fundamental requirement of how many MLC types perform the bit overlaying.</p>\n </li>\n</ul>\n<p>Since Yaffs2 performs less writes, there is potential for Yaffs2 to have improved write performance.</p>\n<p>Yaffs2 cannot use a deletion marker because that would violate the zero overwrites mandate and alternate mechanisms are provided to determine which chunks are current and which are deleted. These mechanisms are:</p>\n<ul>\n<li>\n<p><i><b>Sequence Number </b></i><i><b>(seq_number)</b></i>: As each block is allocated, the file system\'s sequence number is incremented and each chunk in the block is marked with that sequence number. The sequence number thus provides a way of organising the log in chronological order.</p>\n </li>\n<li>\n<p><i><b>Shrink Header Marker </b></i><i><b>(shrink_header)</b></i>: The shrink header marker is used to mark object headers that are written to shrink the size of a data file. This is explained more in the accompanying text.</p>\n </li>\n</ul>\n<p><i><b>Note: The Yaffs2 sequence number is not the same as the Yaffs1 serial number!</b></i></p>\n<p>Note: We still refer to chunk deletion in Yaffs2. The chunks are marked as deleted in the RAM data structures used by garbage collection etc, but there is no deletion marker written to flash.</p>\n<h2 class=\"western\">10.1 Sequence Number</h2>\n<ul>\n<li>\n<p>Since we\'re scanning backwards, the most recently written – and thus current – chunk matching an obj_id:chunk_id pair will be encountered first and all subsequent matching chunks must be obsolete and treated as deleted.</p>\n </li>\n<li>\n<p>The file length in object headers are used to trim back resized files. If an object header is encountered, then subsequent data chunks that lie beyond that file length are clearly obsolete and treated as deleted. Note that both current and obsolete object header sizes must be used to obtain an accurate reconstruction.</p>\n </li>\n</ul>\n<h2 class=\"western\">10.2 Shrink Header</h2>\n<p>Explaining the purpose of the shrink header marker is a bit convoluted. The purpose of a shrink header marker is to show that this object header indicates that a file has shrunken in size, and to prevent those object headers from being deleted by garbage collection. To understand this, it is easiest to consider what would happen if the shrink header markers did not exist.</p>\n<p>For simplification we\'ll assume no garbage collection happens during this part of the exercise. It is safe to make that assumption since it does not alter the reasoning.</p>\n<p>Consider a file that has been through the following:</p>\n<p class=\"code-western\"><span style=\"font-family: Liberation Mono, monospace;\"><span style=\"font-size: 10pt; font-size: small; font-size: small;\"><b>#define MB (1024 * 1024)<br />\n</b></span></span><br />\n</p>\n<p class=\"code-western\"><code class=\"western\"><span style=\"font-family: Liberation Mono, monospace;\"><span style=\"font-size: 9pt; font-size: small; font-size: small;\">h = open(“foo”,O_CREAT| O_RDWR, S_IREAD|S_IWRITE); /* create file */</span></span></code><code class=\"western\"><span style=\"font-size: 9pt; font-size: small; font-size: small;\"><br />\nwrite(h,data,5*</span></code><code class=\"western\"><span style=\"font-size: 9pt; font-size: small; font-size: small;\">MB</span></code><code class=\"western\"><span style=\"font-size: 9pt; font-size: small; font-size: small;\">); /* write 5 MB of data /<br />\ntruncate(h,1*</span></code><code class=\"western\"><span style=\"font-size: 9pt; font-size: small; font-size: small;\">MB</span></code><code class=\"western\"><span style=\"font-size: 9pt; font-size: small; font-size: small;\">); /* truncate to 1MB */<br />\nlseek(h,2*</span></code><code class=\"western\"><span style=\"font-size: 9pt; font-size: small; font-size: small;\">MB</span></code><code class=\"western\"><span style=\"font-size: 9pt; font-size: small; font-size: small;\">, SEEK_SET); /* set the file access position to 2MB */<br />\nwrite(h,data,1*</span></code><code class=\"western\"><span style=\"font-size: 9pt; font-size: small; font-size: small;\">MB</span></code><code class=\"western\"><span style=\"font-size: 9pt; font-size: small; font-size: small;\">); /* write 1MB of data */<br />\nclose(h);</span></code><br />\n<br />\n</p>\n<p>The file will now be 3MB in length, but there will be a “hole” between 1MB and 2MB. According to POSIX (and to aid security etc) that “hole” should always read back as zeros.</p>\n<p>Yaffs2 would represent that in NAND with the following sequence of chunks:</p>\n<ol>\n<li>\n<p>Object header for file creation (file length = 0)</p>\n </li>\n<li>\n<p>5MB worth of data chunks (0 to 5MB)</p>\n </li>\n<li>\n<p>Object header for truncation (file length = 1MB)</p>\n </li>\n<li>\n<p>1MB worth of data chunks (2MB to 3MB)</p>\n </li>\n<li>\n<p>Object header for close (file length = 3MB)</p>\n<p>At this stage, only the the following data chunks are current:</p>\n </li>\n</ol>\n<ul>\n<li>\n<p>The first 1MB of data created in step 2 above.</p>\n </li>\n<li>\n<p>The 1MB of data created in step 4 above.</p>\n </li>\n<li>\n<p>The object header created in step 5 above.</p>\n </li>\n</ul>\n<p>But Yaffs must remember the truncation that happened in step 3, otherwise Yaffs will “forget” that there is a hole, which would cause the old data to be visible again. Thus, if Yaffs creates a hole it first writes a shrink header to indicate the start of the hole and a regular object header to mark the end of the hole. </p>\n<p>The shrink header modifies the behavior of the garbage collector to ensure that these shrink headers are not erased until it is safe to do so. This unfortunately has a negative impact on garbage collection in systems which make extensive use of files with holes.</p>\n<p>Shrink headers are also used to indicate that a file has been deleted and that the record of the file deletion is not lost.</p>\n<h2 class=\"western\">10.3 Yaffs2 extended tags</h2>\n<p>Yaffs2 extends the tags in object headers with extra fields to improve mount scanning performance. The operation of extended tags is described later in this document.</p>\n<h1 class=\"western\">11 Bad block handling NAND error handling</h1>\n<p>NAND flash is designed to be very low cost and very high density. In order to get high yields, and thus keep costs down, NAND flash is typically shipped with a few bad blocks and some further blocks are expected to go bad during the use of the device. Thus, any flash file system without an effective bad block handling policy is unsuitable for NAND flash.</p>\n<p>Yaffs1 uses the Smart-Media style of bad block marking. This checks the sixth byte (byte 5) of the spare area. In a good block this should be 0xFF. A factory-marked bad block should be 0x00. If Yaffs1 determines that a block has gone bad it is marked bad with 0x59 (\'Y\'). Using a distinctive marker allows Yaffs-marked bad blocks to be differentiated from factory-marked bad blocks.</p>\n<p>Yaffs2 mode is designed to support a wider range of devices and spare-area layouts. Thus, Yaffs2 does not decide which bytes to mark but instead calls driver functions to determine whether the block is bad, or to mark it bad.</p>\n<p>So, when does Yaffs mark a block bad? Yaffs will mark a block bad if a read or write operation fails or if three ECC errors are detected. A block that is marked bad is retired from use, thus improving the robustness of the file system. This policy is suitable for SLC flash. MLC policies are under development.</p>\n<p>Further, NAND flash cells can sometimes be disturbed (corrupted) by NAND activity and charge loss. These errors are corrected by error correction codes (ECC) which may be implemented in hardware, software drivers, or within Yaffs itself. Again, any flash file system lacking effective ECC handling is unsuitable for NAND flash.</p>\n<p>Yaffs1 mode can use either the built in ECC or use ECC provided by the driver or hardware.</p>\n<p>Since Yaffs2 mode is designed for a wider range of devices, it does not provide ECC internally but requires that the driver provide the ECC.</p>\n<p>The ECC code supplied with Yaffs (yaffs_ecc.c) is the fastest C code implementation of a Smart Media compatible ECC algorithm that we are aware of. This code will correct any single bit error within a 256-byte data block and detect 2 errors per 256-byte data block. This is sufficient error correction to provide very high reliability on most SLC-type NAND flash.</p>\n<p>For a more complete description of failure handling, please refer to the Yaffs error mitigation document.</p>\n<h1 class=\"western\">12 RAM structures</h1>\n<p>While it is theoretically possible to use a log structured file system with very few RAM structures, this would provide reduce performance. Thus, significant RAM data structures are required to store enough information to provide sufficiently high performance. </p>\n<p>Before we jump in, it is a good idea to first figure out what purpose the RAM structures serve. The main structures are defined in yaffs_guts.h and their main purposes, are :</p>\n<ul>\n<li>\n<p>Device/partition: This is named <i><b>yaffs_dev</b></i><span style=\"font-style: normal\"><span style=\"font-weight: normal\">. </span></span>This is required to hold information relating to a Yaffs “partition” or “mount point”. Using these, rather than globals, allows Yaffs to simultaneously support multiple partitions and partitions of different types. In fact, almost other data structures mentioned here are part of, or accessed via, the structure.</p>\n </li>\n<li>\n<p>NAND Block Information: This is named <i><b>yaffs_block_info </b></i>and holds the current state of the NAND blocks. Each yaffs_dev has an array of these.</p>\n </li>\n<li>\n<p>NAND Chunk Information: This is a bitfield attached to the yaffs_dev that holds the current in-use state of each chunk in the system. There is one bit per chunk in the partition.</p>\n </li>\n<li>\n<p>Object: This is named <i><b>yaffs_obj</b></i> and holds the state of an object (see section 3). There is one of these for each object in the file system, where an object is one of a regular file, directory, hard link, symbolic link or special link. There are different variants of yaffs_Objects to reflect the different data required for these different object types. Each object is uniquely identified by an obj_id.</p>\n </li>\n<li>\n<p>File structure: For each file object, Yaffs holds a tree which provides the mechanism to find the data chunks in a file. The tree consists of nodes called <i><b>yaffs_tnode</b></i> (tree nodes).</p>\n </li>\n<li>\n<p>Directory structure: The directory structure allows objects to be found by name. The directory structure is built from a doubly-linked list that is rooted in the directory and binds together the sibling objects within a directory.</p>\n </li>\n<li>\n<p>Object number hash table: The object number hash table provides a mechanism to find an object from its obj_id. The obj_id is hashed to select a hash bucket. Each hash bucket has a doubly-linked list of objects that belong in this hash bucket, as well as a count of the objects in the bucket.</p>\n </li>\n<li>\n<p>Cache: Yaffs provides a read/write cache that significantly improves performance for short operations. The size of the cache can be set at run-time.</p>\n </li>\n</ul>\n<p>The usage of these structures is described in more detail below.</p>\n<p>Yaffs makes significant use of doubly-linked lists. These data structures are very useful because they provide rapid insertion, removal and traversal. They do however come at the expense of requiring two pointers rather than just one that would be required by a singly-linked list.</p>\n<h2 class=\"western\">12.1 Yaffs objects (struct yaffs_obj)</h2>\n<p>Each object (file, directory,...) in the system is represented by a yaffs_obj structure </p>\n<p>The yaffs_obj\'s main function is to store most of the object metadata and type-specific information. This means that almost all the information about an object can be accessed immediately without reading flash.</p>\n<p>The metadata includes, amongst others:</p>\n<ul>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">obj_id: The number used to identify the object.</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">parent: A pointer to the parent directory. Not all objects have a parent. The root director and special directories for unlinked and deleted files do not have parents so this is NULL.</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">short_name: If the name is short enough to fit in a small fixed-sized array (default 16 characters) then it is stored here otherwise it must be fetched from flash each time it is requested.</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">type: Type of object.</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Permissions, time, ownership and other attributes</span></p>\n </li>\n</ul>\n<p><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">Depending on the object type, yaffs_obj also stores:</span></p>\n<ul>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">A tnode tree, file extents etc for data files</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">A directory chain for directories</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">An equivalent object for hard links</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">A string for symbolic links</span></p>\n </li>\n</ul>\n<h2 class=\"western\">12.2 Look-up by obj_id</h2>\n<p>The purpose of this mechanism is to rapidly access an object by its device and obj_id. This is required during garbage collection, scanning and similar operations.</p>\n<p>Each yaffs_dev uses a hash table for this purpose. The hash table has 256 “buckets” (tunable), each holding a doubly-linked list of the yaffs_objs in that bucket.</p>\n<p>The hash table\'s hash function is just masking the least significant bits of the obj_id. This is a very cheap function that provides reasonable “spread”.</p>\n<p>Yaffs makes an attempt to assign obj_ids in a way that keeps the number of objects in each hash bucket quite low, thus preventing any one hash entry getting too long.</p>\n<p>This mechanism is also charged with assigning new (unique) obj_id values.</p>\n<h2 class=\"western\">12.3 Directory structure</h2>\n<p>The purpose of the directory structure is to rapidly access an object by name. This is required to perform file operations such as opening, renaming etc.</p>\n<p><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">The Yaffs directory structure is formed by a tree of objects of type YAFFS_OBJECT_TYPE_DIRECTORY. These objects have a doubly linked node of children.</span></p>\n<p>Each yaffs_obj also has a doubly linked list node called sibling which chain together the siblings in a directory.</p>\n<p>Each Yaffs partition has a root directory.</p>\n<p>Each yaffs partition also has some special purpose “fake” directories which are not stored in NAND but are instead created on mounting:</p>\n<ul>\n<li>\n<p>lost+found: This directory is used as a place to store any lost file parts that cannot be placed in the normal directory tree.</p>\n </li>\n<li>\n<p>Unlinked and deleted: These are pseudo-directories that are not in the directory tree. Placing objects in these directories gives them a status of being unlinked or deleted.</p>\n </li>\n</ul>\n<p>Each object has a name that is used to look up the object within the directory, Thus, each name within a directory must be unique. This rule does not apply to objects in the unlinked and deleted pseudo-directories since we never use names to look up unlinked/deleted files and there may be many files of the same name that have been deleted.</p>\n<p>Name resolution is sped up by two mechanisms:</p>\n<ul>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">short_names are stored directly in the yaffs_obj so that they don\'t have to be loaded from flash.</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Each object has a “name sum”. This is a simple hashing of the name which speeds up the matching process because it is cheaper to compare the hash than compare the whole name string.</span></p>\n </li>\n</ul>\n<p><img src=\"data:image/png;base64,[encoded data, 22776 characters]\" width=\"412\" height=\"355\" alt=\"image\" id=\"Object2\" /> <br style=\"clear: left;\" />\n<br />\n<br />\n</p>\n<p>The above directory structure represents the following directory tree</p>\n<table cellpadding=\"4\" style=\"width: 605px; border-spacing: 0px;\">\n<col width=\"119\" /> <col width=\"468\" />\n<tr valign=\"top\">\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 119px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-family: Courier, monospace;\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">/</span></span></p>\n  </td>\n <td style=\"border: 1px solid #000000; padding: 0.1cm; width: 468px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">Root directory</span></p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 119px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-family: Courier, monospace;\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">/a</span></span></p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 468px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">Directory containing c,d,e</span></p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 119px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-family: Courier, monospace;\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">/b</span></span></p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 468px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">Empty directory</span></p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 119px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-family: Courier, monospace;\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">/lost+found</span></span></p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 468px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">Empty directory</span></p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 119px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-family: Courier, monospace;\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">/a/c</span></span></p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 468px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">Directory</span></p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 119px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-family: Courier, monospace;\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">/a/d</span></span></p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 468px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">Data file</span></p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 119px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-family: Courier, monospace;\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">/a/e</span></span></p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 468px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">Data file</span></p>\n  </td>\n</tr>\n</table>\n<p style=\"margin-bottom: 0cm; orphans: 0; widows: 0; page-break-before: auto\"><br />\n</p>\n<p>If a Yaffs partition has been somehow corrupted then it is possible for an object to be created during scanning but with no object header (which contains the object name) being found. The object would then not have a name. In these cases, Yaffs creates a pseudonym from the object number of the form objnnnn so that the object can be placed in the directory structure. </p>\n<h2 class=\"western\" style=\"page-break-before: always\">12.4 Hard links</h2>\n<p>In POSIX file systems, the objects (inodes in Linux terminology, vnode in BSD-speak) and the object names (dentry in Linux terminology) are independent in that an object can have zero, one or more names.</p>\n<p>Having files with zero links is caused by constructs such as:</p>\n<p style=\"margin-left: 1.25cm; margin-bottom: 0cm; orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-family: Courier 10 Pitch;\"><span style=\"font-size: 8pt; font-size: xx-small; font-size: xx-small;\"><code class=\"western\"><span style=\"font-size: 10pt; font-size: small; font-size: small;\">h = open(“foo”,O_CREAT | O_RDWR, S_IREAD | S_IWRITE); /* create file “foo” */</span></code></span></span></p>\n<p style=\"margin-left: 1.25cm; margin-bottom: 0cm; orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-family: Courier 10 Pitch;\"><span style=\"font-size: 8pt; font-size: xx-small; font-size: xx-small;\"><code class=\"western\"><span style=\"font-size: 10pt; font-size: small; font-size: small;\">unlink(“foo”); /* unlink it </span></code><code class=\"western\"><span style=\"font-size: 10pt; font-size: small; font-size: small;\">to remove</span></code><code class=\"western\"><span style=\"font-size: 10pt; font-size: small; font-size: small;\">directory </span></code><code class=\"western\"><span style=\"font-size: 10pt; font-size: small; font-size: small;\">entry </span></code><code class=\"western\"><span style=\"font-size: 10pt; font-size: small; font-size: small;\">*/</span></code></span></span></p>\n<p style=\"margin-left: 1.25cm; margin-bottom: 0cm; orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-family: Courier 10 Pitch;\"><span style=\"font-size: 8pt; font-size: xx-small; font-size: xx-small;\"><code class=\"western\"><span style=\"font-size: 10pt; font-size: small; font-size: small;\">/* we still have a handle to the file so can still access it via the handle */</span></code></span></span></p>\n<p style=\"margin-left: 1.25cm; margin-bottom: 0cm; orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-family: Courier 10 Pitch;\"><span style=\"font-size: 8pt; font-size: xx-small; font-size: xx-small;\"><code class=\"western\"><span style=\"font-size: 10pt; font-size: small; font-size: small;\">read(h,buffer,100); </span></code></span></span></p>\n<p style=\"margin-left: 1.25cm; margin-bottom: 0cm; orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-family: Courier 10 Pitch;\"><span style=\"font-size: 8pt; font-size: xx-small; font-size: xx-small;\"><code class=\"western\"><span style=\"font-size: 10pt; font-size: small; font-size: small;\">write(h,buffer,100);</span></code></span></span></p>\n<p style=\"margin-left: 1.25cm; margin-bottom: 0cm; orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-family: Courier 10 Pitch;\"><span style=\"font-size: 8pt; font-size: xx-small; font-size: xx-small;\"><code class=\"western\"><span style=\"font-size: 10pt; font-size: small; font-size: small;\">close(h); /* as soon as the handle is closed the file is deleted */</span></code></span></span></p>\n<p style=\"margin-left: 1.25cm; margin-bottom: 0cm; orphans: 0; widows: 0; page-break-before: auto\"><br />\n</p>\n<p>Yaffs does not store separate object and name records because that would waste space and incur extra reading/writing. Instead, Yaffs is optimised for the most typical case of one name per object. That is, Yaffs stores one name per yaffs_obj and uses “cheats” to achieve other behavior:</p>\n<ul>\n<li>\n<p>Objects that have zero names (ie unlinked objects) are handled by renaming the object into a fake directory that is used to designate unlinked objects.</p>\n </li>\n<li>\n<p>Multiple names object are handled by designating one of the objects the main object and having multiple hard link pseudo-objects that refer to it.</p>\n </li>\n<li>\n<p>The inode number (vnid in BSD-speak) is a per-file system unique number that identifies the object. The Yaffs obj_id of the main object is presented to the user. That is, if the inode number is queried from a hardlink object then the obj_id of the equivalent object is returned.</p>\n </li>\n</ul>\n<p>The linkage between hard link pseudo-objects and their equivalent object is through two fields:</p>\n<ul>\n<li>\n<p>Each object has a hard_links doubly linked list node that links the list of hard links to that object.</p>\n </li>\n<li>\n<p>Each hard link has a equiv_obj pointer to the “equivalent object”.</p>\n </li>\n</ul>\n<p style=\"page-break-before: always\">The usage of this structure is straight forward except for one interesting case when hard links are being deleted. Consider the following sequence of events:</p>\n<table cellpadding=\"4\" style=\"width: 605px; border-spacing: 0px;\">\n<col width=\"50\" /> <col width=\"80\" /> <col width=\"449\" />\n<tr valign=\"top\">\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 50px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">1</span></p>\n  </td>\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 80px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\"># touch a</span></p>\n  </td>\n <td style=\"border: 1px solid #000000; padding: 0.1cm; width: 449px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">Create file a</span></p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 50px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">2</span></p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 80px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\"># ln a b</span></p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 449px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">Create a hard link b with equivalent object a.</span></p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 50px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">3</span></p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 80px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\"># rm a</span></p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 449px;\">\n <p style=\"orphans: 0; widows: 0; page-break-before: auto\"><span style=\"font-size: 12pt; font-size: medium; font-size: medium;\">Remove a. The object must still exist under the name b</span></p>\n  </td>\n</tr>\n</table>\n<p style=\"margin-bottom: 0cm; orphans: 0; widows: 0; page-break-before: auto\"><br />\n</p>\n<p>In step 3, Yaffs cannot just delete the equivalent object since that would leave a “hanging” hard link with no equivalent object. </p>\n<p>We also cannot just change the type of one of the hardlink objects because that would cause the object\'s obj_id to change. This would be unacceptable since it would break any mechanism that use the obj_id (of which there are many within and outside of Yaffs).</p>\n<p>Thus, if an object is deleted and it has hard links to it then we do the following:</p>\n<ul>\n<li>\n<p>Select one of the object\'s hard links.</p>\n </li>\n<li>\n<p>Rename the object to the name in the hard link.</p>\n </li>\n<li>\n<p>Delete the hard link pseudo-object.</p>\n </li>\n</ul>\n<h2 class=\"western\">12.5 Symbolic links and special objects</h2>\n<p>These object types just store values that are needed to provide a full POSIX file system.</p>\n<p>A symbolic link object saves a symbolic link string that is used to provide the POSIX symbolic string mechanism.</p>\n<p>A special object is used to store entries for device numbers, pipes and other similar special objects.</p>\n<h2 class=\"western\">12.6 File objects</h2>\n<p>The yaffs_Objects have a type and a variant portion which is a union of different data required to hold the state of different object types.</p>\n<p>The file objects have type YAFFS_OBJECT_TYPE_FILE, and an associated file variant. This stores the following main values:</p>\n<ul>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">file_size: file size</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">top_level: depth of the Tnode tree</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">top: pointer to top of Tnode tree</span></p>\n </li>\n</ul>\n<p>The meaning of the file size is quite obvious. This is the current length of the file. Note that a file might have holes in it caused by seeking forward past the extents of the file.</p>\n<p>The top and top_level work together to control the Tnode trees. </p>\n<h3 class=\"western\" style=\"page-break-before: always\">12.6.1 Tnode tree</h3>\n<p>Each file has a tnode tree to provide the mapping from file position to actual NAND chunk address. top is a pointer to the top of the tnode tree</p>\n<p><img src=\"data:image/png;base64,[encoded data, 20236 characters]\" width=\"385\" height=\"378\" alt=\"image\" id=\"Object1\" /> <br style=\"clear: left;\" />\n<br />\n<br />\n</p>\n<p>The tnode tree is made up of tnodes (tree nodes) arranged in levels, each of which holds either:</p>\n<ul>\n<li>\n<p>At levels greater than 0, a tnode has 8 pointers to other tnodes in the next level down.</p>\n </li>\n<li>\n<p>At level 0, a tnode has 16 NAND chunk Ids which identify the chunk\'s location in RAM.</p>\n </li>\n</ul>\n<p>These numbers are powers of 2 which makes for simple look-ups by just applying bitmasks. The code that traverses this tree is in yaffs_find_tnode_0().</p>\n<p>As the file size grows, more tnodes are added and as the levels fill, more levels are added. If the file is truncated or resized downwards, then the tree is pruned. If a chunk in a file is replaced (eg. data is overwritten or copied by garbage collection) then the tnode tree must be updated to reflect the change.</p>\n<p>Tnodes typically make up the bulk of the Yaffs\' RAM usage.</p>\n<h1 class=\"western\">13 How various mechanisms work</h1>\n<p>Having looked at the Yaffs data structures, we now consider how some of the mechanisms in Yaffs operates. This is most easily done by walking through some operations that Yaffs performs.</p>\n<h2 class=\"western\">13.1 Block and chunk management</h2>\n<h3 class=\"western\">13.1.1 Block states</h3>\n<p>Yaffs tracks the state of each block and chunk in the partition. This information is first built up during scanning (or recovered from a checkpoint). A block may be in one of the following states (see definition of enum yaffs_block_state):</p>\n<table cellpadding=\"4\" style=\"width: 605px; border-spacing: 0px;\">\n<col width=\"146\" /> <col width=\"441\" />\n<tr valign=\"top\">\n <td style=\"border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 146px;\">\n <p>UNKNOWN</p>\n  </td>\n <td style=\"border: 1px solid #000000; padding: 0.1cm; width: 441px;\">\n <p>The block state is not yet known.</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 146px;\">\n <p>NEEDS_SCANNING</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 441px;\">\n <p>During pre-scanning it has been determined that this block has something on it and needs scanning.</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 146px;\">\n <p>SCANNING</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 441px;\">\n <p>This block is currently being scanned.</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 146px;\">\n <p>EMPTY</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 441px;\">\n <p>This block has nothing in it (is erased) and may be used for allocation. The block can get to this state by being erased.</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 146px;\">\n <p>ALLOCATING</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 441px;\">\n <p>This is the block currently being used for allocation by the chunk allocator.</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 146px;\">\n <p>FULL</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 441px;\">\n <p>All the chunks in this block have been allocated and at least one chunk contains useful information that has not yet been deleted.</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 146px;\">\n <p>DIRTY</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 441px;\">\n <p>All the chunks in this block have been allocated and all have been deleted. The block might have been in the FULL or COLLECTING state before this. This block can now be erased and returned to EMPTY state.</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 146px;\">\n <p>CHECKPOINT</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 441px;\">\n <p>This block has checkpoint data in it. When the checkpoint is invalidated this block will be erased and returned to the EMPTY state.</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 146px;\">\n <p>COLLECTING</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 441px;\">\n <p>This block is being garbage collected. As soon as all live data has been inspected this block becomes DIRTY.</p>\n  </td>\n</tr>\n<tr valign=\"top\">\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm; width: 146px;\">\n <p>DEAD</p>\n  </td>\n <td style=\"border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm; width: 441px;\">\n <p>This block has been retired or was marked bad. This is a terminal state.</p>\n  </td>\n</tr>\n</table>\n<p><img src=\"data:image/png;base64,[encoded data, 42088 characters]\" width=\"575\" height=\"510\" alt=\"image\" id=\"Object3\" /> <br style=\"clear: left;\" />\n<br />\n<br />\n</p>\n<p>The regular runtime states are; EMPTY, ALLOCATING, FULL, COLLECTING and DIRTY.</p>\n<p>The checkpoint state is used for checkpoint blocks.</p>\n<p>The DEAD state is the terminal state for blocks that were retired because they were either marked bad or an error was detected.</p>\n<h3 class=\"western\">13.1.2 Block and chunk allocation</h3>\n<p>An available chunk must be allocated before it can be written. The chunk allocation mechanism is provided by yaffs_alloc_chunk() and is very simple. Each yaffs_dev has a current block that it is allocating from. This is termed the <i><b>allocation block </b></i><i><b>(alloc_block)</b></i>. Chunks are allocated sequentially from the allocation block. As the chunks are allocated, block and chunk management information is updated, including the block\'s pages_in_use count and the chunk use bitmap.</p>\n<p>When the block is fully allocated, another empty block is selected to become the allocation block. The blocks are selected by searching upwards from the previous allocation block.</p>\n<p>In older versions of Yaffs, the Yaffs scanning would identify the allocation block being used when the file system was last shut down and would continue allocation from that point. This had the benefit of continuing to use the same block and slightly reduce garbage creation. However, doing this could potentially cause problems due to attempting to write a block that had been in the middle of a write when power was lost. Thus Yaffs now always starts allocation on a new block after a mount. This slightly increases the amount of garbage (typically by an insignificant amount) but improves robustness.</p>\n<h3 class=\"western\">13.1.3 A word about wear leveling</h3>\n<p>Since flash memory blocks can only endure a limited number of writes and erases ( termed the flash endurance), a flash file system needs to ensure that the same few blocks are not overwritten continuously causing those blocks to wear out while the other blocks are hardly used at all.. Instead it is important that the file system spreads out the wear.</p>\n<p>This is extremely important in a file system such as FAT which uses a limited set of logical blocks to store the file allocation table entries which get modified frequently. If FAT is used with a static logical to physical block mapping then the file allocation table blocks will wear out far before other blocks causing premature device failure. Thus, for FAT, it is very important that the logical to physical mapping gets stirred up a bit to cause the file allocation tables to be written to different physical blocks, thus leveling out the wear.</p>\n<p>Wear leveling is far less of a concern in a log structured file system such as Yaffs since we always write to the end of the log and thus don\'t keep on overwriting the same blocks.</p>\n<p>There are basically two ways to achieve wear leveling:</p>\n<ul>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Use a specifically written set of functions that actively perform wear leveling.</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Allow a degree of wear leveling to happen as a side effect of other activity.</span></p>\n </li>\n</ul>\n<p>Yaffs takes the second approach.</p>\n<p>Firstly, being log structured, Yaffs inherently spreads out the wear by performing all writes in sequence. That means that we don\'t single out a few blocks for a specific purpose and write them more than others.</p>\n<p>Secondly, blocks are allocated serially from the erased blocks in the partition. Thus the process of erasing (after deletion of garbage collection) and then allocating blocks does tend to spread the block use and provides a level of wear leveling.</p>\n<p>Thus, even though there is no code to specifically perform wear leveling it does happen as a side effect of other activity.</p>\n<p>This strategy performs well and has survived many accelerated lifetime tests in both simulations and on real NAND-based products.</p>\n<h3 class=\"western\">13.1.4 Management of yaffs_tnode and yaffs_obj structures</h3>\n<p>yaffs_tnodes and yaffs_objs are dynamically created and released as they are needed. </p>\n<p>The allocation and management could be done by just using the standard memory allocator (malloc, kmalloc etc), but this could cause performance problems, particularly in embedded systems which tend to have rather simplistic memory allocators. </p>\n<p>The allocation and deletion of many small structures can cause memory fragmentation causing out-of-memory and slowdown problems.</p>\n<p>To prevent these problems, Yaffs manages these objects internally. Yaffs creates many structures (100 or so) at a time and then allocates them singly from a free list. When structures are released they are placed on the free list for reuse.</p>\n<h2 class=\"western\">13.2 Internal cache</h2>\n<p>This describes the standard Yaffs internal cache implementation. Alternative caches have been devised for other purposes and at some future point Yaffs might be extended to support pluggable cache policies.</p>\n<p>The main purpose of the internal cache is to reduce NAND access for badly behaved applications which perform many small reads and writes. Believe it or not, but there are applications out there that read or write files a few bytes at a time:</p>\n<p class=\"code-western\"><code class=\"western\">while(...)<br />\nwrite(h,buf,1);</code></p>\n<p style=\"margin-left: 1.25cm\"><br />\n<br />\n</p>\n<p>This sort of behavior would be terrible for performance and flash memory life if each read or write operation resulted in a flash access. Yaffs provides an internal cache to mitigate against this sort of behaviour.</p>\n<p>The Yaffs internal cache is called a “Short Op Cache” (short operation cache) and only comes in to play for operations which are not chunk aligned. The caching mechanism is very simple and was primarily written for less sophisticated OSs that lack their own file caching layer. The cache is still beneficial in OSs like Linux, which provide a caching layer, because it caches both the read and write path. Thus, while short reads will be serviced by the Linux page cache, the short op cache does address non-chunk aligned writes.</p>\n<p>Page aligned reads/writes bypass the cache unless that chunk is already in the cache, except when inband tags are used. Inband tags always require the cache because the cache is used to build up the buffer where the tags are attached to the data chunk being written.</p>\n<p>The cache is stored in an array of cache entries. The number of cache entries is set in the yaffs_dev parameters n_caches and the cache is configured during initialisation. n_caches of zero disables the cache. The cache management algorithms are simplistic and probably don\'t scale well to very large numbers. This means that it is probably best to stick with around 5 to 20 cache entries.</p>\n<p>Each cache entry holds:</p>\n<ul>\n<li>\n<p>obj_id, chunk id, nbytes (the tag info of the chunk being cached)</p>\n </li>\n<li>\n<p>The actual data bytes</p>\n </li>\n<li>\n<p>Cache slot status (last used counter, dirty,...)</p>\n </li>\n</ul>\n<p>Finding an unused cache entry is a simple operation. We just iterate through the cache entries searching for one that is not assigned. If all cache entries are busy then a cache push-out is performed to free up a cahce entry.</p>\n<p>Whenever a cache entry is accessed (read or written) the last-use counter is is set to an incrementing number. This counter value is used to drive the least-recently-used (LRU) algorithm.</p>\n<p>Cache entries which have been modified and not yet written back to flash are marked with a dirty flag. This is tells us whether we need to write out the data during a flush or push-out.</p>\n<p>A push-out happens whenever the cache is full and we need to push an entry out of the cache to make space to load a new entry. Yaffs uses the LRU algorithm to select the LRU cache entry, write it out if needed and then assign that for use.</p>\n<p>Whenever a file is flushed (file flush or close), the file\'s dirty entries are written out. At certain times (eg. before an unmount or at sync()) the entire cache is flushed.</p>\n<p>This caching policy is gives a useful performance improvement with very simple algorithms (ie good bang-for-bucks).</p>\n<p>Apart from its normal caching function, the short op cache also does much of the heavy lifting for inband tags support since all the inband tags accesses are not chunk aligned and must typically be re-aligned. The cache makes this easy.</p>\n<h2 class=\"western\">13.3 Scanning</h2>\n<p>Scanning is the process whereby file system state is rebuilt from scratch. This happens on mounting a Yaffs partition if no checkpoint data is available or if the mounting was told to ignore the checkpoint data.</p>\n<p>Scanning involves reading the tags from all the active chunks in the system so can take quite a while, but probably less time than you\'d expect.</p>\n<p>The scanning process is different for Yaffs1 vs Yaffs2 because of the differences mentioned before.</p>\n<h3 class=\"western\">13.3.1 Yaffs1 scanning</h3>\n<p>Yaffs1 scanning is rather straight forward because Yaffs1 uses deletion markers.</p>\n<p>All we really need to do is read the tags off all the chunks in the partition and determine if the chunk is active. Order is not important and blocks could be read in any order. If the deletion marker has not been set then it is active and we need to add the chunk to the file system state as follows:</p>\n<p>If the chunk is a data chunk (chunk_id &gt; 0) then the chunk must be added to the relevant file\'s tnode tree. If the object does not exist, then we create it in lost+found, although it has no name and other file details yet.</p>\n<p>If the chunk is an object header (chunk_id == 0) then the object must be created (or it might already exist in lost + found and we need to fix up its details and slot it into the correct part of the directory tree.</p>\n<p>If at any time during scanning we find that we are reading a second chunk with the same obj_id:chunk_id as a previously encountered chunk then the 2-bit serial number is used to resolve the dispute.</p>\n<p>Once the scanning is complete we still need to fix up a few things: </p>\n<p>Hard links must be connected up properly (it is more efficient to defer this until after the scanning has completed).</p>\n<p>Also, objects which were marked as unlinked must be deleted since there are no longer handles open to these objects.</p>\n<h3 class=\"western\">13.3.2 Yaffs2 scanning</h3>\n<p>Yaffs2 has no deletion markers which makes the scanning significantly more complex.</p>\n<p>The first thing that needs to be done is to pre-scan the blocks to determine the sequence number for the blocks. The list of blocks and sequence numbers is then sorted to make a chronologically ordered list.</p>\n<p>Yaffs then scans <i><b>backwards</b></i> through these blocks (ie in reverse chronological order). Thus, the first encountered obj_id:chunk_id pair is the current one and subsequent chunks with those tags are out of date.</p>\n<p style=\"margin-left: 1.25cm\">We read the tags for each chunk in each block. </p>\n<p style=\"margin-left: 1.25cm\">If it is a data chunk ( ie. chunk_id &gt; 0) then:</p>\n<ul>\n<li>\n<p>If a chunk with the same obj_id:chunk_id has already been found then this is not the current chunk. Delete this one.</p>\n </li>\n<li>\n<p>Else if the object is marked as deleted, or corrupted, then delete it.</p>\n </li>\n<li>\n<p>Else if the object does not yet exist then this chunk was written since the last object header write for this object so this chunk must be the last written chunk in the file and must have happened just before an unclean shutdown with the file still open. We can create the file and use the chunk_id and nbytes to set the file extents.</p>\n </li>\n<li>\n<p>Else if the object does exist and the chunk lies beyond the object\'s file scan size (extents) then it is a truncated chunk and can be deleted.</p>\n </li>\n<li>\n<p>Else it is placed into the file\'s tnode tree.</p>\n </li>\n</ul>\n<p style=\"margin-left: 1.25cm\">If it is an object header (ie. chunk_id == 0) then:</p>\n<ul>\n<li>\n<p>If the object is in the deleted directory then mark the object as deleted and set the object\'s shrink size to zero.</p>\n </li>\n<li>\n<p>Else if an object header has not yet been found for this object, then this is the most current object header and holds the most current name etc. If no data chunks have yet been found for this chunk then the size in the object header is also the file extents. The file size is used to set the file scan size since at the time it was written the file did not extend past that point and we can safely ignore further data chunks for that file that extend past that point.</p>\n </li>\n<li>\n<p>Else just use the file size as the scan size if it is smaller than the current file scan size.</p>\n </li>\n<li>\n<p>Else this an obsolete object header. It is deleted.</p>\n </li>\n</ul>\n<p>A bit more explanation is probably needed to describe the file scan size. The whole purpose of this is to determine data chunks that should be ignored due to the file being truncated.</p>\n<h2 class=\"western\">13.4 Checkpoint</h2>\n<p>Mount scanning takes quite a lot of time and slows mounting, though perhaps by less than you\'d think. Checkpointing is a mechanism to speed the mounting by taking a snapshot of the Yaffs runtime state at unmount or sync() and then reconstituting the runtime state on re-mounting. The speed up is dramatic.</p>\n<p>The actual checkpoint mechanism is quite simple. A “stream” of data is written to a set of blocks which are marked as holding checkpoint data and the important runtime state is written to the stream.</p>\n<p>Not all state needs to be saved, only the state needed to reconstitute the structure of the runtime data. For example, file metadata need not be saved since it is very easy to load that through lazy-loading.</p>\n<p>The checkpoint stores data in the following order:</p>\n<ul>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Start marker, including checkpoint format id.</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">yaffs_dev information</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Block information</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Chunk flags</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Objects, including file structure</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">End marker</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Checksum</span></p>\n </li>\n</ul>\n<p>The checkpoint validity is ensured by the following mechanisms:</p>\n<ul>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">The data is stored using whatever ECC mechanisms are in place.</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">The start marker includes a checkpoint version so that an obsolete checkpoint will not be read if the checkpoint code changes.</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Data is written to the stream as structured records, each with a type and size.</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">The end marker must be read when expected.</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">Two checksums are maintained across the whole checkpoint data set.</span></p>\n </li>\n</ul>\n<p>If any checks fail, the checkpoint is ignored and the state is re-scanned.</p>\n<p>The astute reader might notice that block state changes as we\'re writing checkpoint blocks, so how do we manage to re-constitute the block states correctly? This is achieved by the following:</p>\n<ul>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">As we write the checkpoint, the checkpoint block allocation selects EMPTY blocks. We don\'t change the state as we\'re writing the checkpoint so their state is written to the checkpoint as EMPTY or CHECKPOINT, it does not really matter which.</span></p>\n </li>\n<li>\n<p><span style=\"font-family: Liberation Serif, serif;\">After reading the checkpoint, we know which blocks have been used to store checkpoint data. We update those blocks to reflect the CHECKPOINT state.</span></p>\n </li>\n</ul>\n<p>A checkpoint is invalidated by any modifications (writes, erases,...) thus any modification path also checks to see if there is a checkpoint and erases it.</p>\n<p>The regular Yaffs block allocator and garbage collection logic also needs to be aware of the approximate size of the checkpoint so that these can ensure enough spare space is reserved to store a checkpoint. There is a calculation that updates the value whenever the number of objects etc changes.</p>\n<h2 class=\"western\">13.5 Extended tags and packed tags</h2>\n<p>Extended tags is an abstraction of a way to store more information in the tags, allowing for faster scan times. Packed Tags is a physical implementation of the storage of extended tags.</p>\n<p>When we\'re scanning we really only need to build up the structure of the file system. In other words, rebuild the directory relationships, tnode trees and such. Much of the detail such as file names, permissions etc can be lazy loaded if and when needed.</p>\n<p>This required storing extra information, such as the parent directory and object type, in the tags of object headers. But how do we do this without enlarging the tags size?</p>\n<p>Object headers always have a chunk_id of zero and n_bytes has no meaning because it is not a data chunk. By using a single bit to identify object headers we suddenly open up a whole lot of space that we can stuff full of useful data. By being clever as to what data we use, we can pack in the important data in most circumstances.</p>\n<p>Sometimes, for example very large files, the packing will not work because there are insufficient bits to hold the field so we just write regular tags instead. That\'s OK since there can only be few such files in the system so the performance reduction only impacts very few files and the system level impact is unnoticeable. A simple, cheap, strategy that gives speed up 99% of the time is a very handy one.</p>\n<p>Other details are lazy-loaded on demand. This will happen when the object is looked up (eg. by a file open or searching for the file in the directory).</p>\n<h2 class=\"western\">13.6 Block summaries</h2>\n<p>Scanning requires that the tags for each chunk are read so that they can be inspected. Reading the tags from each chunk can be time consuming. Thus, block summaries were added in 2011.</p>\n<p>Block summaries write all the tags data for chunks in the block into the last few (typically only one) chunk in a block. This allows all the tags for chunks in that block to be read in one hit. Depending on the system throughput (CPU, RAM and flash speeds), this can speed up mount time dramatically.</p>\n<p>Note that the block summary does not replace the tags attached to each chunk. Both are written. Thus, if the whole block is not written (and the block summary is thus not written), the chunk tags can still be read and used.</p>\n<p>If a block summary is not available for a block, then the old mechanism is still used to scan the tags on each chunk.</p>\n<h2 class=\"western\">13.7 Inband tags</h2>\n<p>Thus far we have considered chunks where there are sufficient unallocated bytes in the spare (or out of band) area to store the tags. </p>\n<p>But what happens if we don\'t have enough space in the spare area to store the tags? Inband tags to the rescue! </p>\n<p>With inband tags we store the tags in the flash data area alongside the data. This gives us far more flexibility in the types of storage that Yaffs can support.</p>\n<p>There are three major penalties with inband tags:</p>\n<ul>\n<li>\n<p>Due to the loss of chunk alignment, all transactions must pass through the short op cache. This costs an extra memcpy().</p>\n </li>\n<li>\n<p></p>\n </li>\n<li>\n<p>Reading tags during scanning etc can involve reading the whole page, making this slower. The impact is minimised by using checkpointing or block summaries.</p>\n </li>\n</ul>\n<p>Thus, it is better, performance wise, to only use inband tags when regular tags will not work.</p>\n<h2 class=\"western\">13.8 Soft deletion</h2>\n<p>Soft deletion is a mechanism that was added to speed up file deletion in Yaffs1 mode.</p>\n<p>Looking back to the description of how files are stored in Yaffs1, you can see that deleting a file involves writing the deletion marker of every data chunk in the file. This can take quite some time for large files.</p>\n<p>The soft deletion mechanism was added to avoid writing all those deletion markers. Instead of writing the deletion markers, soft deletion instead tracks the number of chunks in each block that belong to deleted files and leaves the clean up to the garbage collector.</p>\n<p>When the garbage collector looks at a block it can see what current chunks (ie chunks not yet deleted) belong to deleted files and does not copy those, thus effectively deleting the chunk. Once all the chunks associated with a deleted file have cleaned up by the garbage collector the file header object can also be deleted.</p>\n<p>Yaffs2 mode does not write deletion markers and thus does not use soft deletion.</p>\n</div>\n      \n  </div>\n\n</article>\n\";}s:9:\"#attached\";a:1:{s:14:\"html_head_link\";a:3:{i:0;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"canonical\";s:4:\"href\";s:26:\"/documents/how-yaffs-works\";}i:1;b:1;}i:1;a:2:{i:0;a:2:{s:3:\"rel\";s:9:\"shortlink\";s:4:\"href\";s:9:\"/node/409\";}i:1;b:1;}i:2;a:2:{i:0;a:2:{s:3:\"rel\";s:8:\"revision\";s:4:\"href\";s:26:\"/documents/how-yaffs-works\";}i:1;b:1;}}}s:6:\"#cache\";a:3:{s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:6:{i:0;s:29:\"config:filter.format.raw_html\";i:1;s:18:\"config:system.site\";i:2;s:7:\"file:76\";i:3;s:8:\"node:409\";i:4;s:9:\"node_view\";i:5;s:6:\"user:6\";}s:7:\"max-age\";i:-1;}s:17:\"#cache_properties\";a:1:{i:0;s:6:\"#title\";}s:6:\"#title\";O:25:\"Drupal\\Core\\Render\\Markup\":1:{s:9:\"\0*\0string\";s:29:\"<span>How Yaffs works</span>\n\";}}',-1,1511912048.222,1,'config:filter.format.raw_html config:system.site file:76 node:409 node_view rendered user:6','305'),('entity_view:node:409:full:[languages:language_interface]=en:[theme]=yaffs:[user.permissions]=aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01:[user.roles:anonymous]=0','a:2:{s:15:\"#cache_redirect\";b:1;s:6:\"#cache\";a:5:{s:4:\"keys\";a:4:{i:0;s:11:\"entity_view\";i:1;s:4:\"node\";i:2;s:3:\"409\";i:3;s:4:\"full\";}s:8:\"contexts\";a:7:{i:0;s:28:\"languages:language_interface\";i:1;s:5:\"theme\";i:2;s:8:\"timezone\";i:3;s:17:\"url.path.is_front\";i:4;s:16:\"user.permissions\";i:5;s:20:\"user.roles:anonymous\";i:6;s:24:\"user.roles:authenticated\";}s:4:\"tags\";a:6:{i:0;s:29:\"config:filter.format.raw_html\";i:1;s:18:\"config:system.site\";i:2;s:7:\"file:76\";i:3;s:8:\"node:409\";i:4;s:9:\"node_view\";i:5;s:6:\"user:6\";}s:7:\"max-age\";i:-1;s:3:\"bin\";s:6:\"render\";}}',-1,1511912048.220,1,'config:filter.format.raw_html config:system.site file:76 node:409 node_view rendered user:6','305'),