Yaffs Tuning. Charles Manning

Similar documents
YAFFS A NAND flash filesystem

How YAFFS Works. Charles Manning Table of Contents

How Yaffs Works. Charles Manning

The Journalling Flash File System

Outline. Operating Systems. File Systems. File System Concepts. Example: Unix open() Files: The User s Point of View

Reverse Engineering of the Android File System (YAFFS2)

EMSOFT 09 Yangwook Kang Ethan L. Miller Hongik Univ UC Santa Cruz 2009/11/09 Yongseok Oh

Crash Consistency: FSCK and Journaling. Dongkun Shin, SKKU

Motivation. Operating Systems. File Systems. Outline. Files: The User s Point of View. File System Concepts. Solution? Files!

Anatomy of Linux flash file systems

Mobile phones Memory technologies MMC, emmc, SD & UFS

Caching and reliability

Operating Systems Design 14. Special File Systems. Paul Krzyzanowski

Older geometric based addressing is called CHS for cylinder-head-sector. This triple value uniquely identifies every sector.

Systems Programming/ C and UNIX

MTD Based Compressed Swapping for Embedded Linux.

Yaffs Direct Interface

Lecture Conservative Garbage Collection. 3.2 Precise Garbage Collectors. 3.3 Other Garbage Collection Techniques

The Journalling Flash File System

Understanding UFFS. Ricky Zheng < > Created: March 2007 Last modified: Nov 2011

JOURNALING FILE SYSTEMS. CS124 Operating Systems Winter , Lecture 26

File systems: management 1

3.3 WinCE System Installation

Conditional Compilation

2. PICTURE: Cut and paste from paper

TRANSACTIONAL FLASH CARSTEN WEINHOLD. Vijayan Prabhakaran, Thomas L. Rodeheffer, Lidong Zhou

Optimizing Translation Information Management in NAND Flash Memory Storage Systems

The Care and Feeding of a MySQL Database for Linux Adminstrators. Dave Stokes MySQL Community Manager

Technical Note. Enabling On-Die ECC NAND with JFFS2. Introduction. TN-29-75: Enabling On-Die ECC NAND with JFFS2. Introduction.

Designing experiments Performing experiments in Java Intel s Manycore Testing Lab

File Systems. What do we need to know?

COS 318: Operating Systems. Journaling, NFS and WAFL

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

Debugging and profiling in R

Binghamton University. CS-220 Spring Cached Memory. Computer Systems Chapter

CSM CompSci Field Session 2012: 'ddable' Live USB Image Generation for Oracle Solaris Final Report

ScaleFFS: A Scalable Log-Structured Flash File System for Mobile Multimedia Systems

Memory Management. COMP755 Advanced Operating Systems

CS 318 Principles of Operating Systems

Operating Systems 2014 Assignment 4: File Systems

Operating Systems, Fall

IPL+UBI: Flexible and Reliable with Linux as the Bootloader

smxnand RTOS Innovators Flash Driver General Features

Description of common NAND special features

Keeping Up With The Linux Kernel. Marc Dionne AFS and Kerberos Workshop Pittsburgh

Operating Systems 2015 Assignment 4: File Systems

File System Consistency. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Part II: Data Center Software Architecture: Topic 2: Key-value Data Management Systems. SkimpyStash: Key Value Store on Flash-based Storage

NTFS Recoverability. CS 537 Lecture 17 NTFS internals. NTFS On-Disk Structure

ò Very reliable, best-of-breed traditional file system design ò Much like the JOS file system you are building now

Debugging Applications in Pervasive Computing

Bootstrap, Memory Management and Troubleshooting. LS 12, TU Dortmund

Topics. File Buffer Cache for Performance. What to Cache? COS 318: Operating Systems. File Performance and Reliability

OPERATING SYSTEMS CS136

File System Consistency

ANITA S SUPER AWESOME RECITATION SLIDES

Choosing and Tuning Linux File Systems

High Performance Real-Time Operating Systems

Ext3/4 file systems. Don Porter CSE 506

FS Consistency & Journaling

<Insert Picture Here> Looking at Performance - What s new in MySQL Workbench 6.2

Runtime. The optimized program is ready to run What sorts of facilities are available at runtime

FILE SYSTEMS, PART 2. CS124 Operating Systems Fall , Lecture 24

Operating Systems. Week 13 Recitation: Exam 3 Preview Review of Exam 3, Spring Paul Krzyzanowski. Rutgers University.

CS 416: Operating Systems Design April 22, 2015

OMAP3530 has 256MB NAND flash in PoP (PoP: Package-On-Package implementation for Memory Stacking) configuration.

ETFS Design and Implementation Notes#

Last week. Data on the stack is allocated automatically when we do a function call, and removed when we return

Addressing Scalability and Consistency Issues in Hybrid File System for BPRAM and NAND Flash

The SURE Architecture

Microsoft File Allocation Table

To understand this, let's build a layered model from the bottom up. Layers include: device driver filesystem file

Introduction to Parallel Performance Engineering

Fall 2017 :: CSE 306. File Systems Basics. Nima Honarmand

Flash File Systems Overview

Block Device Scheduling. Don Porter CSE 506

EECS 482 Introduction to Operating Systems

Spring 2016, Malloc Lab: Writing Dynamic Memory Allocator

Chapter 4 File Systems. Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved

CSE 351, Spring 2010 Lab 7: Writing a Dynamic Storage Allocator Due: Thursday May 27, 11:59PM

Contents. Acknowledgments... xi. Foreword 1... xiii Pierre FICHEUX. Foreword 2... xv Maryline CHETTO. Part 1. Introduction... 1

412 Notes: Filesystem

C13: Files and Directories: System s Perspective

Memory Management. Mobile Hardware Resources. Address Space and Process. Memory Management Overview. Memory Management Concepts

Anthony AWR report INTERPRETATION PART I

File system internals Tanenbaum, Chapter 4. COMP3231 Operating Systems

CS5460: Operating Systems Lecture 20: File System Reliability

Implementation should be efficient. Provide an abstraction to the user. Abstraction should be useful. Ownership and permissions.

File Systems Ch 4. 1 CS 422 T W Bennet Mississippi College

Operating Systems. File Systems. Thomas Ropars.

CS720 - Operating Systems

Debugging uclinux on Coldfire

Block Device Scheduling. Don Porter CSE 506

Block Device Scheduling

ICS Principles of Operating Systems

Glossary. The target of keyboard input in a

CS3210: Crash consistency

CS 326: Operating Systems. Process Execution. Lecture 5

Chapter 8 Virtual Memory

File Systems. CS 4410 Operating Systems

Transcription:

Yaffs Tuning Charles Manning 2012-07-22 Yaffs has many options for tuning for speed or memory use. This document details them for Yaffs Direct and Linux, covering compile time flags and settings, initialisation parameters, tracing, and state inspection.

Table of Contents 1 Yaffs Direct Configuration...2 1.1 Initialisation Parameters...2 1.2 Compile-time settings...4 2 Tracing mechanism...5 3 Linux...6 3.1 Linux compile-time flags...6 3.2 Linux: /proc/yaffs trace adjustment...6 3.3 Linux: /sys/ interface...6 3.4 Linux: /proc/yaffs state dumping...6 4 Conclusions...7 1 Yaffs Direct Configuration Yaffs behaviour is dictated by compile time and run-time flags. 1.1 Initialisation Parameters Each yaffs device is configured by a yaffs_deviceparameterstruct structure which is part of the yaffs_devicestruct structure. This contains the following fields: name totalbytesperchunk sparebytesperchunk startblock endblock An optional name for the device The number of bytes in the data area of the flash page. If inbandtags is not set then this whole area will be used to store data and the tags will be stored in the spare area. If inbandtags is set then part of this area will be used to store tags and the rest will be used to store data. The number of available bytes in the spare area of the flash page. This excludes space used by ECC, bad block markers etc. The first block in the partition to be used. 0 for first block. The last block in the partition to be used. nreservedblocks inbandtags Number of good blocks blocks reserved for garbage collection etc. Needs to be at least 2, but 5 would be a more typical number. Yaffs2 only:flag indicating whether tags should be stored in the data area. If inbandtags is set then the short Op cache must be enabled (ie nshortopcaches must be non- Page 2/7 of Yaffs Tuning, 2012-03-07

usenandecc notagsecc isyaffs2 zero. Yaffs1 only: Flag indicating whether the driver performs ECC. If this is zero then Yaffs will perform ECC. Yaffs2 only: Flag indicating whether the tags have ECC attached to them. Flag indicating if this is using the Yaffs2 mechanism. If this is not set then Yaffs1 mode of operation is provided. nshortopcaches emptylostandfound skipcheckpointread skipcheckpointwrite refreshperiod Number of chunks to store in the short operation cache. Zero disables caching. Typical value is 10 to 20 or so. Caching is required for inband tags. Flag to delete all files in lost and found on mount. Yaffs2 only: Flag to skip reading checkpoint on mount. If set then a re-scan is forced. Yaffs2 only: Flag to skip writing checkpoint on sync or unmount. Yaffs2 only: How often Yaffs should do a block refresh. Values less than 10 disable block refreshing. Typical values would be1000. initialisenand deinitialisenand eraseblockinnand Pointer to function to initialise flash driver. Pointer to function to de-initialise flash driver Pointer to function to erase a flash block writechunktonand readchunkfromnand Yaffs1 only: Pointer to function to write a chunk Yaffs1 only: Pointer to function to read a chunk. writechunkwithtagstonand readchunkwithtagsfromnand marknandblockbad querynandblock Yaffs2 only: Pointer to function to write a chunk plus tags Yaffs2 only: Pointer to function to read a chunk plus tags Yaffs2 only: Function to mark a block bad Yaffs2 only: Function to query a block state gccontrol Callback function that returns the garbage collector Page 3/7 of Yaffs Tuning, 2012-03-07

removeobjectcallback marksuperblockdirty control flags. This is optional. Callback function called when an object is removed. This is set by the wrapper. Callback function that is called when a clean file system is first modified. This is set by the wrapper. disablesoftdelete Yaffs1 only. Debug only. Disables soft deletion if nonzero. useheaderfilesize disablelazyloading widetnodedisabled Debug only. Leave as zero Debug only. Leave as zero. Debug only. Leave as zero. deferdirectoryupdate Used to defer directory updates. 1.2 Compile-time settings These setting are used to apply compile-time configurations. CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED Normally Yaffs checks that chunks are erased only on the first chunk write to each block. This flag allows you to force all chunks to be checked. This is slower, but is worth using when doing early debugging. CONFIG_YAFFS_CASE_INSENSITIVE When selected case insensitive name comparisons are used. Note that this will not magically change Yaffs to be case insensitive in a case sensitive OS. This needs to be set according to the OS policy. Typically this is only used in Windows CE. CONFIG_YAFFS_DIRECT Used when compiling Yaffs Direct. CONFIG_YAFFS_DISABLE_LAZY_LOAD Lazy loading is used to defer loading up object details until the objects are accessed. This makes mount time faster. This flag can disable lazy loading. Debug only. CONFIG_YAFFS_ECC_WRONG_ORDER This flag should only be used with old Linux MTD code which had a bug in the ECC byte ordering. Page 4/7 of Yaffs Tuning, 2012-03-07

CONFIG_YAFFS_NO_YAFFS1 Used to say that only Yaffs2 operation should be compiled in. Not currently supported. CONFIG_YAFFS_SHORT_NAMES_IN_RAM Set to configure Yaffs to store short object names in RAM. This is faster, but uses up more memory. CONFIG_YAFFS_UNICODE Set to configure Yaffs to use Unicode file names (eg. With WinCE). CONFIG_YAFFS_USE_OWN_SORT By default, Yaffs uses qsort for sorting blocks at mount scanning time. This is faster. Using this flag forces Yaffs to use a slow internal sort instead. Debug only. CONFIG_YAFFS_UTIL Used when compiling Yaffs for utilities. CONFIG_YAFFS_WINCE Set when compiling Yaffs for WinCE. CONFIG_YAFFS_YAFFS2 Set when using Yaffs2 mode. At present this must always be set. CONFIG_YAFFSFS_PROVIDE_VALUES Used when compiling Yaffs Direct only. 2 Tracing mechanism Yaffs has a lot of built in tracing to help debug and integrate. The tracing is controlled by yaffs_tracemask bitmask which allows various sets of tracing to be disabled or enabled at runtime. The trace bits are specified in the yaffs_trace.h file. The tracing mechanism has also been 'hijacked' to provide a control mask for extra verification code when the YAFFS_TRACE_VERIFYxxx trace bits are selected. The tracing mechanism is readily integrated into the system via printf-like statements. Tracing is all done through macros which allow the strings to be converted into unicode or similar if need be. Page 5/7 of Yaffs Tuning, 2012-03-07

3 Linux 3.1 Linux compile-time flags The Linux compile time flags are documented in the Kconfig file and will not be duplicated here. 3.2 Linux: /proc/yaffs trace adjustment Under Linux, the tracing mechanism is hooked up to both the /proc/yaffs and the sys interface. The /proc/yaffs interface is very user friendly. #cat +os > /proc/yaffs # Enables YAFFS_TRACE_OS #cat -all+gc > /proc/yaffs # Disables everything then enable YAFFS_TRACE_GC #cat 0xf000 > /proc/yaffs # Set trace mask to specified bitmask. 3.3 Linux: /sys/ interface The Linux /sys/ interface is used by many Linux OS components to access the state of control variables. Some Yaffs variables are available via /sys/module/yaffs2/parameters/ *. Values can be read and modified using standard shell commands or from application programs. # ls /sys/module/yaffs2/parameters/ yaffs_auto_checkpoint yaffs_tracemask yaffs_wr_attempts # cat /sys/module/yaffs2/parameters/yaffs_auto_checkpoint 1 # echo "2" > /sys/module/yaffs2/parameters/yaffs_auto_checkpoint # cat /sys/module/yaffs2/parameters/yaffs_auto_checkpoint 2 Yaffs currently supports the following variables: yaffs_auto_checkpoint: Controls when checkpoints should be written. yaffs_tracemask: An alternative, and less user friendly,interface to modify tracing. yaffs_wr_attempts: The number of attempts that Yaffs will make to write a chunk. yaffs_gc_control: Controls the garbage collector. 3.4 Linux: /proc/yaffs state dumping Some of the state of Yaffs mounts can be determined by reading the /proc/yaffs entry. # cat /proc/yaffs charles@charles-laptop:/opt/y/cvs/yaffs2$ cat /proc/yaffs YAFFS built:mar 16 2010 11:52:25 $Id: yaffs_fs.c,v 1.101 2010-03-15 22:27:15 charles Exp $ $Id: yaffs_guts.c,v 1.119 2010-03-12 02:48:34 charles Exp $ Device 0 "NAND simulator partition 0" Page 6/7 of Yaffs Tuning, 2012-03-07

startblock... 0 endblock... 511 totalbytesperchunk. 2048 usenandecc... 1 notagsecc... 0 isyaffs2... 1 inbandtags... 0 emptylostandfound.. 1 disablelazyload... 0 refreshperiod... 10000 nshortopcaches... 10 nreservedblocks... 5 ndatabytesperchunk. 2048 chunkgroupbits... 0 chunkgroupsize... 1 nerasedblocks... 152 blocksincheckpoint. 0 ntnodescreated... 2300 nfreetnodes... 1852 nobjectscreated... 2300 nfreeobjects... 1842 nfreechunks... 27843 npagewrites... 65993 npagereads... 19631 nblockerasures... 1133 ngccopies... 37 garbagecollections. 161 passivegcs... 137 nretriedwrites... 0 nretireblocks... 0 eccfixed... 0 eccunfixed... 0 tagseccfixed... 0 tagseccunfixed... 0 cachehits... 44110 ndeletedfiles... 0 nunlinkedfiles... 42917 refreshcount... 1 nbackgrouddeletions 0 4 Conclusions Yaffs includes many options for changing speed or memory use, with specific flags for the Yaffs Direct Interface as well as Linux. Under Linux many of the control variables can be altered using standard Linux systems. Page 7/7 of Yaffs Tuning, 2012-03-07