mtd device上的JFFS2等文件系统不建议使用在block device上

I am going to use JFFS2 on top of my USB stick/CF card/etc, is it OK?

USB sticks, CompactFlash cards and other removable flash media are not MTDdevices. They are block devices. They do contain flash chip inside, butthey also contain some translation layer above which emulates block device.This translation layer is implemented in hardware. So for outside world thesedevices look exactly as hard drives, not like MTD devices.

Please, read the bellow FAQ entry about usingJFFS2 on top of hard drives.

[

First off, JFFS2 was designed for MTD devices, not for block devices like harddrives. These are two very different types of devices. Please read the last chapter in this page for the difference.

Now you understand that you are going to use JFFS2 with devices it was notdesigned for, is it OK? Obviously, it is generally not OK.

It is possible to use JFFS2 with the block2mtd driver. The driveremulates an MTD device on top of a block device so that you may feed theemulated MTD device to JFFS2 and utilize the file system on top of it. But donot complain when you have noticed that the performance suffers.

Owing to peculiarities of flash devices, JFFS2 is very different toconventional HDD-oriented file system. And one of its drawbacks is that mounttime as well as memory consumption grow linearly with growing flash size. Sobeware you may end up with tremendous amount memory eaten and huge mount time ifyour block device is very large. Also, JFFS2 implements only write-throughcaching (while conventional filesystems have write-back) and does many things which arenot really needed in the case of hard drives.

So, beware of this and think twice. Also, nobody guaranteesblock2mtd is bug-free. It it mostly used for debugging purposes,when it is easier to utilize emulated mtd device on the host developmentmachine rather then debug on the target board. But of course, if you tested itand everything is OK with you - go ahead.

]

So, the answer is probably yes, you technically can, but be sure you realizewhy you do this. In general it is bad idea. It is much better to use anyconventional file system like ext2.

Also note, these devices are "black boxes". The way they implement thisflash-to-block device translation layer is not usually published. And in manycases the algorithms used at this layer are far from brilliant. For example,many USB sticks and other cards lose data in case of unclean reboots/powercuts. So, be very careful.


What are the differences between flash devices and block drives?

The following table describes the differences between block devices andraw flashes. Note, SSD, MMC, eMMC, RS-MMC, SD, mini-SD, micro-SD, USB flashdrive, CompactFlash, MemoryStick, MemoryStick Micro, and other FTL devicesare block devices, not raw flash devices. Of course, hard drives arealso block devices.

Block deviceMTD device
Consists of sectorsConsists of eraseblocks
Sectors are small (512, 1024 bytes)Eraseblocks are larger (typically 128KiB)
Maintains 2 main operations: read sector andwrite sectorMaintains 3 main operations: read from eraseblock,write to eraseblock, and erase eraseblock
Bad sectors are re-mapped and hidden by hardware (atleast in modern LBA hard drives); in case of FTLdevices it is the responsibility of FTL to provide thisBad eraseblocks are not hidden and should be dealt within software
Sectors are devoid of the wear-out property (in FTL devicesit is the responsibility of FTL to provide this)Eraseblocks wear-out and become bad and unusable afterabout 103 (for MLC NAND) - 105(NOR, SLC NAND) erase cycles

So as one sees flashes (MTD devices) are somewhat more difficult to workwith.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值