컴퓨터공부/Embedded

FTL정보

achivenKakao 2006. 11. 22. 01:56

EEPROM인 플래시메모리에 데이터를 쓰기 위해서는 삭제연산을 선행해야 하는데, 삭제 단위는 쓰기 단위보다 크며 수행시간이 오래 걸린다.

그래서 논리적으로 삭제연산을 감출 수 있는 플래시 변환계층(FTL)이 파일시스템과 플래시메모리 사이의 미들웨어 형태로 제안되어 사용되고 있다

플래시 변환계층은 쓰기연산 시에 파일시스템이 생성한 논리주소를 플래시메모리상의 이미 삭제연산을 수행한 영역에 대한 물리주소로 변환하는 역할을 수행한다. 빠른 주소변환을 위해 주소변환 테이블은 SRAM을 사용해 구성한다. 플래시 변환계층을 사용하면 호스트 시스템에서는 FAT와 같은 일반 자기디스크용 파일시스템을 사용해서도 플래시메모리를 효율적으로 제어할 수 있다.

 하지만 플래시 변환계층을 사용하여 삭제연산을 감춰도 플래시메모리의 쓰기속도는 다른 메모리 소자와 비교해 상대적으로 느려 여전히 쓰기 성능을 개선해야 할 필요가 있다. 또한 하드디스크와 비교해 단위 공간당 단가가수십 배 가량 높기 때문에 한정된 기억공간을 효율적으로 활용해야 할 필요성이 있다.

 이러한 두 가지 문제점을 효율적으로 개선할 수 있는 방법에는 데이터 압축기법이 있다[4, 5]. 압축기법을 활용해압축된 데이터를 전송하고 기록함으로써 플래시메모리의 쓰기 대역폭과 기억공간을 실질적으로 확장할 수 있다. 플래시 압축계층은 이러한 기능을 호스트 독립적으로 수행하는 미들웨어로 하드웨어 압축기와 쓰기버퍼로 구성한다

 플래시 변환계층과 플래시 압축계층은 서로 독립적으로 설계되었기 때문에 마이크로프로세서와 주 메모리 등과 같은 하드웨어를 중복해서 사용하는 문제가 있다. 뿐만 아니라 플래시 압축계층에서 가진 블록내부의 유효한 페이지의 개수와 같은 정보를 플래시 변환계층에서 삭제블록을 선택하는 과정에 사용한다면 보다 삭제정책의 효율성을 높일 수 있다.

 

II. 플래시 변환계층

플래시 변환계층(Flash Translation Layer, FTL)은 플래시 메모리의 삭제연산을 감추기 위한 미들웨어로 호스트 시스템의 파일시스템과 플래시메모리 사이에 위치한다. 삭제연산은 쓰기연산 시에 파일시스템이 생성한 논리주소를 플래시메모리상의 이미 삭제연산을 수행한 영역에 대한 물리주소로 변환함으로써 감춰진다. 비교적 수행시간이 오래 걸리는 삭제연산을 감추고 I/O를 하나의 단위
(atomic operation)로 처리해 하드디스크와 같은 단일 저장장치를 구성함으로써, 상단에서 일반 파일시스템을 사용해서 플래시메모리를 효율적으로 제어할 수 있다. 이는 현대의 운영체제의 기본 철학처럼 정책(policy)과 기능(mechanism)을 각각 파일시스템과 저장장치로 구분한 것으로 볼 수 있다. 기능에 해당하는 FTL은 크게 호스트시스템에서 독립된 하드웨어 형태[2, 3, 8]와 호스트시스템 내부의 디바이스드라이버 형태[14]로 구현할 수 있다.

 FTL은 주소변환 단위에 따라 크게 페이지(쓰기)단위 주소변환과 블록(삭제)단위 주소변환으로 나뉜다. 페이지단위 주소변환은 그림 1(a)와 같이 정교하게 주소를 변환하기 때문에 성능은 좋은데 반하여 주소변환 테이블의 크기가 커져 제작비용이 높아지는 단점이 있다. 반대로 블록단위 주소변환은 그림 1(b)처럼 비교적 비정교하게 주소를 변환해 주소변환 테이블의 크기는 작지만, 내부의 한 페이지에 대한 수정연산이 발생해도 전체 블록을 삭제하고 갱신해야 하는 추가비용이 있다. 뿐만 아니라 이 과정을 수행하는 도중에 폴트가 발생하면 데이터의 일관성을 깨뜨릴 수 있다.
 이러한 블록단위 주소변환 방식의 단점을 개선한 기법은 교체블록 기법은 그림 1(c)와 같이 블록 내부의 페이지에 대한 갱신요청이 발생하면 교체블록을 할당해 쓰기를 수행하고 이를 연결리스트로 구성해 향후 읽기연산 시에 이 리스트를 역순으로 검색해 가장 늦게 수정된 데이터를 제공하는 방법이다.
 마지막으로 최근에 제안된 로그블록 기법은 그림 1(d)처럼 페이지단위 주소변환과 블록단위 주소변환 기법을 병합한 형태로 비교적 큰 단위로 요청되는 순차 입출력은 블록단위로 처리하고, 작은 단위로 요청되는 임의 입출력은 페이지 단위로 로그구조 파일시스템[15, 16]과 유사하게 로그형태로 저장하는 방식이다[3]. 이를 통해 주소변환 테이블의 크기를 줄이고도 상대적으로 높은 성능을 발휘할 수 있다.

 이처럼 FTL은 주소변환 테이블을 사용해 삭제연산을 감출 수 있어 플래시메모리의 쓰기 성능을 개선하고 일반파일시스템을 사용해 제어 가능하게 할 뿐만 아니라 실시간 데이터베이스 시스템 등에서 비휘발성 주 메모리로도활용할 수 있게 한다.
 하지만 FTL을 사용해 삭제연산을 논리적으로 감춰도 플래시메모리의 쓰기속도는 다른 메모리 소자와 비교해 상대적으로 느리기 때문에 여전히 쓰기 성능을 개선해야할 필요가 있다. 뿐만 아니라 하드 디스크와 비교해 수십배 가량 단위 공간당 단가가 높기 때문에 기억공간을 효율적으로 활용해야 할 필요가 있다. 이러한 문제점을 극복하기 위해서 플래시 압축계층이 제안되었다.

 

 

Flash Translation Layers

Until recently, the majority of applications of flash for file storage have involved using the flash to emulate a block device with standard 512-byte sectors, and then using standard file systems on that emulated device.

The simplest method of achieving this is to use a simple 1:1 mapping from the emulated block device to the flash chip, and to simulate the smaller sector size for write requests by reading the whole erase block, modifying the appropriate part of the buffer, erasing and rewriting the entire block. This approach provides no wear levelling, and is extremely unsafe because of the potential for power loss between the erase and subsequent rewrite of the data. However, it is acceptable for use during development of a file system which is intended for read-only operation in production models. The mtdblock Linux driver provides this functionality, slightly optimised to prevent excessive erase cycles by gathering writes to a single erase block and only performing the erase/modify/writeback procedure when a write to a different erase block is requested.

To emulate a block device in a fashion suitable for use with a writable file system, a more sophisticated approach is required.

To provide wear levelling and reliable operation, sectors of the emulated block device are stored in varying locations on the physical medium, and a ``Translation Layer'' is used to keep track of the current location of each sector in the emulated block device. This translation layer is effectively a form of journalling file system.

The most common such translation layer is a component of the PCMCIA specification, the ``Flash Translation Layer'' [FTL]. More recently, a variant designed for use with NAND flash chips has been in widespread use in the popular DiskOnChip devices produced by M-Systems.

Unfortunately, both FTL and the newer NFTL are encumbered by patents -- not only in the United States but also, unusually, in much of Europe and Australia. M-Systems have granted a licence for FTL to be used on all PCMCIA devices, and allow NFTL to be used only on DiskOnChip devices.

Linux supports both of these translation layers, but their use is deprecated and intended for backwards compatibility only. Not only are there patent issues, but the practice of using a form of journalling file system to emulate a block device, on which a ``standard'' journalling file system is then used, is unnecessarily inefficient.

A far more efficient use of flash technology would be permitted by the use of a file system designed specifically for use on such devices, with no extra layers of translation in between. It is precisely such a filesystem which Axis Communications AB released in late 1999 under the GNU General Public License.