zoukankan      html  css  js  c++  java
  • raw flash vs FTL

    1. 区别

    raw flash devices: NAND, NOR, OneNAND, etc,其被作为MTD设备处理(既不是字符设备,也不是块设备)。

    FTL device:Flash Translation layer device, MMC, eMMC, SD,不仅包含flash,还包含控制器,其被作为块设备处理。

    FTL stands for "Flash Translation Layer" and it is software which emulates a block device on top of flash
    hardware. At early days FTL ran on the host computer. For example, old PCMCIA flash devices were essentially
    raw flash devices, and the PCMCIA standard defined the media storage format for them. So the host computer
    had to run the FTL software driver which implemented PCMCIA FTL. However, nowadays FTL is usually firmware,
    and it is run by the controller which is built into the storage device. For example, if you look inside an
    USB flash drive, you'll find there a NAND chip (or several of them), and a micro-controller, which runs FTL
    firmware. Some USB flash drives are known to have quite powerful ARM processors inside. Similarly, MMC,
    eMMC, SD, SSD, and other FTL devices have a built-in controller which runs FTL firmware.

    All FTL devices have an interface which provides block I/O access. Well, the interfaces are different and
    they are defined by different specifications, e.g., MMC, eMMC, SD, USB mass storage, ATA, and so on. But all
    of them provide block-based access to the device. By block-based access we mean that whole device is
    represented as an linear array of (usually 512-byte) blocks. Each block may be read or written.

    http://www.linux-mtd.infradead.org/doc/ubifs.html#L_raw_vs_ftl

    2. 常用的文件系统ext2、FAT等不能用于MTD设备上(raw flash),可运行于FTL device上。

    3. mtd设备对应的设备文件为/dev/mtd,FTL设备对应的设备文件可为/dev/mtdblock。
    There is an extremely simple FTL layer in Linux MTD subsystem - mtdblock. It emulates block devices over MTD
    devices. There is also an mtdblock_ro module which emulates read-only block devices. When you load this
    module, it creates a block device for each MTD device in the system. The block devices are then accessible
    via /dev/mtdblockX device nodes.

    But in many cases using mtdblock is a very bad idea because what it basically does if you change any sector
    of your mtdblockX device, it reads the whole corresponding eraseblock into the memory, erases the
    eraseblock, changes the sector in RAM, and writes the whole eraseblock back. This is very straightforward.
    If you have a power failure when the eraseblock is being erased, you lose all the block device sectors in
    it. The flash will likely decay soon because you will wear few eraseblocks out - most probably those ones
    which contain FAT/bitmap/inode table/etc.

    Unfortunately it is a rather difficult task to create a good FTL layer and nobody still managed to implement
    one for Linux. But now when we have UBI (see here) it is much easier to do it on top of UBI.

  • 相关阅读:
    计算字符个数
    字符串最后一个单词的长度
    C++面试宝典
    给定三角形ABC和一点P(x,y,z),判断点P是否在ABC内,给出思路并手写代码
    N-皇后问题(N Queens)
    图着色算法详解(Graph Coloring)
    c++学习路线连接
    数据结构--经典排序算法
    5. 最长回文子串
    4. 寻找两个有序数组的中位数
  • 原文地址:https://www.cnblogs.com/embedded-linux/p/5646851.html
Copyright © 2011-2022 走看看