FlaSim

Retired DISLab
이동: 둘러보기, 찾기

목차

FlaSim : A FTL & Flash Memoty Emulator on Linux

1. Download - Binary codes

2. User's manual (Korean) - FlaSim/Implementation Notes

3. Environment

  • Linux 2.6.20 or above
  • GCC 4.2.4

4. How to execute FlaSim

1) Create a directory /home/flasim/vol
# mkdir /home/flasim/vol
2) Create file /home/flasim/vol/nfdda.vol
# mkvol -f small -path /home/flasim/vol -s 512 -p 1000 a
3) Create and initialize the flash volume
# mkftl.log /home/flasim/vol/nfdda.vol 3 
4) Load kernel modules for NAND flash emulator
# insmod klib.ko
# insmod fdevmgr.ko
# insmod small.ko
# insmod log-small.ko
# insmod nfdd.ko ndevices=1 volpath=/home/flasim/vol
5) Check the kernel modules
# cat /proc/fdevmgr
6) Format the FTL volume
# mkfs.ext2 /dev/nfdda
7) Mount the ext2 file system on directory a
# mount /dev/nfdda a

5. You can get statistics of Flasim through proc files.

# cat /proc/nfdd/nfdda/vol
# cat /proc/nfdd/nfdda/ftl
# cat /proc/nfdd/nfdda/flash

How to use nfdd

How to create a volume

You can create a volume using mkvol. This tool create a file in the directory, and it will be treated as a flash memory as /dev/nfdda device.

Usage: mkvol [-h]                       (display meta information)
             [-f large|small|small-ecc] (flash memory type)
             [-path volume_path]        (the path of the volume)
             [-s sector_size]           (physical sector size)
             -p size                    (the number of blocks)
             device_id                  (device id: a, b, etc)

Example

# mkvol -f small -path /home/vol -s 512 -p 1000 a
# mkvol -f large -path /home/vol -s 512 -p 2000 b
# mkvol -f small-ecc -path /home/vol -s 512 -p 3000 c

FTL Initialization

In this section, the utilities to initialize a flash memory (volume) to specific FTL are describe.

FMAX

Each data block has a corresponding replacement block.

Usage: mkftl.fmax volume_name

Examples:

# mkftl.fmax /home/vol/nfdda.vol

Format FMAX applying SLB (it's experimental)

Usage: mkftl.fmax-slb volume_name SLB_size

Example : when setting the number of SLB as 101

# mkftl.fmax-slb /home/vol/nfdda.vol 101

Mitsubishi

Each block has spare space.

Usage: mkftl.mits volume_name no_spare

Example : when setting the number of spare space as 16 sectors

# mkftl.mits /home/swpark/vol/nfddb.vol 16

Format to use M-System applying SLB

Usage: mkftl.mits-slb volume_name no_spare SLB_size

Example : setting the number of spare space as 16, the number of SLB as 101

# mkftl.mits-slb /home/vol/nfddb.vol 16 101

Log block

There are several log blocks.

Usage: mkvol.log file no_log_blocks

Example : when setting the number of log blocks as 3

# mkvol.log /home/vol/nfddc.vol 3

Install Device drivers

klib, fdevmgr

# insmod klib.ko
# insmod fdevmgr.ko

If you install fdevmgr, then file /proc/fdevmgr will be created. You can verify the installed device drivers when you dump this file.

# cat /proc/fdevmgr
 0 : e0c266f0, small
 1 : e0c57b34, fmax-small

flash memory device driver

Currently supported types of flash memories

  1. small
  2. large
  3. small-ecc

If you want to load three device drivers, the instructions are as follows:

# insmod small.ko log_msg=0 - if you want to log, set the option as log_msg=1 or default option
# insmod large.ko
# insmod small-ecc.ko

FTL device dirver

Currently supported FTLs are as follows:

  1. fmax-small
  2. fmax-slb-small
  3. mits-large
  4. mits-small
  5. mits-slb-small
  6. log-small
  7. log-large

If you want install these device drivers, type like this

# insmod fmax-small.ko
# insmod fmax-slb-small.ko
# insmod mits-large.ko
# insmod mits-small.ko
# insmod mits-slb-small.ko
# insmod log-small.ko
# insmod log-large.ko

You can check the installation status when reading /proc/fdevmgr file.

nfdd device driver

This is how to load device drivers. The method in this section loads a volume in the directory /home/vol. After that, a file /dev/nfdda will be created. If you give the option as ndevices=2, then a file called /dev/nfddb will be created.

Usage: insmod nfdd.ko ndevices=1 volpath=/home/vol


  • When you want to load a new volume after installing nfdd device driver, you can do it as follows:
# echo "insvol b" > /proc/nfdd/command


  • If you want to remove a volume during runtime, unmount the volume and type below instruction.
# echo "rmvol b" > /proc/nfdd/command


  • When you install nfdd, then a directory /proc/nfdd is created.
# ls /proc/nfdd
 
command  nfdda  status
 
# cat /proc/nfdd/status
 
volume path : /home/swpark/vol
 
no  device  ftl             flash        psize  lsize  sector
-------------------------------------------------------------
 0  nfdda   fmax-small      small         1000    499     512


  • Directory contents of /proc/nfdd/nfdda
# ls -l /proc/nfdd/nfdda
total 0
-r--r--r-- 1 root root 0 2011-05-01 02:47 flash
--w--w--w- 1 root root 0 2011-05-01 02:47 flash.type
-r--r--r-- 1 root root 0 2011-05-01 02:47 ftl
--w--w--w- 1 root root 0 2011-05-01 02:47 ftl.command
-r--r--r-- 1 root root 0 2011-05-01 02:47 vol
  1. flash : display the status of flash memory
  2. flash.type : set the flash type
  3. ftl : display the status of FTL
  4. ftl.command : proc file to send a command to FTL
  5. vol : display the information of command transferred from File system to the FTL


  • How to display the status information of flash memory
# cat /proc/nfdd/nfdda/flash
 
Device conf : []
Volume name : /home/swpark/vol/nfdda.vol
   Log name : /home/swpark/vol/nfdda.log
 Operations : e0c266f0
 Company:    Model: 
 tERASE: 0  tPROG: 0  tR: 0  tH2D: 0  tD2H: 0
 
The number of operation calls
 load_page  store_page  erase_block  get_from_register  put_to_register
    544444      135554         3013             524399           248943
 
The number of bytes transferred
     reg2host     host2reg     time
      971903     59225902            0


  • How to display the status information of FTL
# cat /proc/nfdd/nfdda/ftl
 
flash:e0c1b000  ftl_operations:e0c57b34
merge: 715   smart merge:3166   no of fmax blocks:499  mirror util:59%
free_blk  free_blk2  read_sectors  write_sectors
     383       999           129          20287


  • How to display the I/O information of the File system (volume information)
# cat /proc/nfdd/nfdda/vol
 
Disk Number: 0                 No. of Users: 1
Device Size: 15968 sectors (512 bytes/sector)
Volume Name: /home/swpark/vol/nfdda.vol
   Log Name: /home/swpark/vol/nfdda.log
Thread Name: knfddad          Request Queue: df81d830
    gendisk: df694d80             workqueue: de182940
 
No. of function calls & transferred data:
  read_call read_sect  read_byte write_call write_sect write_byte request
        129       864     442368      20287      89948   46053376   11733
 
nfdd_meta:
      Magic: 179cd613-c0a5-4453-8924-1dc13b961bb9       type: 2
sector size: 512
 No. blocks: PHYSICAL(1000) LOGICAL(499)
      flash: small
        ftl: fmax-small

How to log

$ echo "print stat" > /proc/nfdd/nfdda/ftl.command
$ echo "print map"  > /proc/nfdd/nfdda/ftl.command
$ echo "print all"  > /proc/nfdd/nfdda/ftl.command

You can log the statistics by stat command. Command map is for writing the map information of the FTL and you can use it when you debug the device driver. all executes both commands stat and map.

If you want to write a specific message to log, write command as follows:

$ echo "echo this is message" > /proc/nfdd/nfdda/ftl.command

"# this is message" is written in the log.

How to change the strategy to select a victim in log block

This is for log block only.

$ echo "change algo UTIL" > /proc/nfdd/nfdda/ftl.command
  • UTIL : select a victim of which utilization is the largest
  • LFU, LRU : select a victim using LFU or LRU

Linux

  1. Download Ubuntu 8.04.4 LTS (Linux 2.6) - [1]
    • FlaSim을 개발한 버전이므로 이 버전의 Linux를 설치하면 FlaSim 컴파일이 잘 된다.
개인 도구
이름공간
변수
행위
둘러보기
구성원
연구
연구실
기타
도구모음
인쇄/내보내기