NAND FLASH용 파일 시스템을 usb에 적용은 어떤식으로 해야하나요?

wavekr의 이미지

NAND FLASH용 파일 시스템을 yaffs2를 nandflash인 usb에 적용시켜서
파일시스템을 뜯어고쳐보고 성능이 좀 개선되는지 확인해보려고 합니다.
현재 리눅스에서 yaffs2를 기본적으로 설치시 제공안해서 따로 받은뒤 커널 컴파일후
해당 파일시스템 설치된 상태로 부팅까지 했는데
앞으로 어떻게 해야하는지 감이 잘 안잡힙니다.
마운트를 하라고 하는데 마운트를 아무폴더나 하면은 그 폴더들이 사실상 하드디스크상에 잡히지만 가상으로 yaffs2파일시스템이라
생각하고 자료를 저장하는건지..아니면 진짜 플래시 메모리인 usb를 마운트시켜야 yaffs2파일시스템이 직접 nand플래시에 올라감으로써
적용이 되는건지궁금하네요..

결과적으로 yaffs2파일시스템 좀 수정해서 이러한걸 테스트하고 파일시스템부분에서 어느정도 성능개선이 되는지 확인하려하는데
어떠한 방식으로 테스트 환경을 구축해야할지 감이 잘 안잡히는데 조언좀 부탁드리겠습니다.

hiseob의 이미지

USB는 중간에 FTL이 있는 컨트롤러가 있는형태라 YAFFS2를 적용하기엔 애매하다고 생각되네요.
NAND를 직접 쓰는 보드를 구매하셔야...

bushi의 이미지

nandsim 드라이버를 사용하면 RAM 을 NAND flash 로 simulation 할 수 있습니다.
드라이버 파라미터가 굉장히 다양하고 많으니 mtd-utils 패키지에서 제공되는 load_nandsim.sh 스크립트를 사용하시는 것이 정신건강에 좋습니다.
http://git.infradead.org/mtd-utils.git/blob/HEAD:/load_nandsim.sh

block2mtd 드라이버를 사용하면 MTD 장치로 emulation 할 수 있지만, NAND flash 로 사용할 수 있는 것은 아닙니다.

yaffs2 를 만지시려고 마음먹었다면,
차라리 잘 된 일이니 block2mtd 를 약간 수정해서 NAND flash 처럼 사용할 수 있도록 고쳐보는 것이 큰 도움이 될 것이라 생각합니다.
콜백 몇 개와 정보 몇 개를 추가하는 정도여서 크게 어려운 일은 아닌데...
(http://git.infradead.org/mtd-2.6.git/blob/HEAD:/drivers/mtd/devices/block2mtd.c#l266)
NAND flash 의 특성을 모르는 상태에서 NAND flash 전용 파일 시스템을 만진다는 것이 어불성설인데도,
USB memory 로 어떻게 해 보려는 생각을 하셨다니 좀 걱정스럽습니다.

$ modinfo block2mtd
filename:       /lib/modules/2.6.32-35-generic/kernel/drivers/mtd/devices/block2mtd.ko
description:    Emulate an MTD using a block device
author:         Joern Engel <joern@lazybastard.org>
license:        GPL
srcversion:     903B71343C6AA0C6FFC99F0
depends:        mtd
vermagic:       2.6.32-35-generic SMP mod_unload modversions 
parm:           block2mtd:Device to use. "block2mtd=<dev>[,<erasesize>]"

$ modinfo nandsim
filename:       /lib/modules/2.6.32-35-generic/kernel/drivers/mtd/nand/nandsim.ko
description:    The NAND flash simulator
author:         Artem B. Bityuckiy
license:        GPL
srcversion:     0D0006EFEC083D5DA056F88
depends:        mtd,nand,nand_ids
vermagic:       2.6.32-35-generic SMP mod_unload modversions 
parm:           first_id_byte:The first byte returned by NAND Flash 'read ID' command (manufacturer ID) (uint)
parm:           second_id_byte:The second byte returned by NAND Flash 'read ID' command (chip ID) (uint)
parm:           third_id_byte:The third byte returned by NAND Flash 'read ID' command (uint)
parm:           fourth_id_byte:The fourth byte returned by NAND Flash 'read ID' command (uint)
parm:           access_delay:Initial page access delay (microseconds) (uint)
parm:           programm_delay:Page programm delay (microseconds (uint)
parm:           erase_delay:Sector erase delay (milliseconds) (uint)
parm:           output_cycle:Word output (from flash) time (nanodeconds) (uint)
parm:           input_cycle:Word input (to flash) time (nanodeconds) (uint)
parm:           bus_width:Chip's bus width (8- or 16-bit) (uint)
parm:           do_delays:Simulate NAND delays using busy-waits if not zero (uint)
parm:           log:Perform logging if not zero (uint)
parm:           dbg:Output debug information if not zero (uint)
parm:           parts:Partition sizes (in erase blocks) separated by commas (array of ulong)
parm:           badblocks:Erase blocks that are initially marked bad, separated by commas (charp)
parm:           weakblocks:Weak erase blocks [: remaining erase cycles (defaults to 3)] separated by commas e.g. 113:2 means eb 113 can be erased only twice before failing (charp)
parm:           weakpages:Weak pages [: maximum writes (defaults to 3)] separated by commas e.g. 1401:2 means page 1401 can be written only twice before failing (charp)
parm:           bitflips:Maximum number of random bit flips per page (zero by default) (uint)
parm:           gravepages:Pages that lose data [: maximum reads (defaults to 3)] separated by commas e.g. 1401:2 means page 1401 can be read only twice before failing (charp)
parm:           rptwear:Number of erases inbetween reporting wear, if not zero (uint)
parm:           overridesize:Specifies the NAND Flash size overriding the ID bytes. The size is specified in erase blocks and as the exponent of a power of two e.g. 5 means a size of 32 erase blocks (uint)
parm:           cache_file:File to use to cache nand pages instead of memory (charp)

cats96의 이미지

커널에 yaffs2를 포함 시켰다면 다 끝난일이네요

usb를 yaffs2로 포맷시킨후

mount -t yaffs2 /dev/usb /mnt/usb 하시면 됩니다

ps. usb디바이스명이나 마운트 폴더명은 임의로 설정하였습니다