🌟 Memory Computing and Computer Architecture Lab
NVMeVirt Weekly Study
- 논문 리뷰로 알아보는 DFTL(참고)
Paper Review : DFTL(Demand-based Flash Translation Layer)
⏳ DFTL: A Flash Translation Layer Employing Demand-based Selective Caching of Page-level Address MappingsAayush Gupta, Youngjae Kim, Bhuvan UrgaonkarDepartment of Computer Science and Engineering, the Pennsylvania State University- SSD 기본 개념 (참
wifiaircat.tistory.com
한 번의 DFTL 구현 시도가 있었는데 싹 지우고 처음부터 시작...


모듈을 올릴 때마다 -1 값의 kernel thread가 생겨서 서버를 reboot해야 했다.
잘못된 kernel thread는 `rmmod` 명령어로 제거가 안 되더라.
NVMeVirt가 아무래도 에뮬레이터이다 보니 코드가 잘못되면 모듈이 잘못 올라가고
다른 사용자에게도 문제가 미치는 경우가 많아서 더 조심스럽게 접근해야 할 것 같다.
그래서
conv_ftl.c와 conv_ftl.h 파일을 복제해서 dftl용 파일을 만들었다.
dftl_ftl.c와 dftl_ftl.h끼리 이어주고 기존에 conv_ftl.h를 포함하던 파일 헤더 수정
마지막으로
Kbuild 파일에서도 컴파일 대상을 dftl_ftl로 바꿔주면 끝이다.
이렇게 하면 다른 프로젝트 코드와 섞이는 것도 방지하고 원본 보존을 할 수 있다.
진작 이렇게 했어야 한다는 생각이 들긴 하는데 이제라도 했으니 다행... \_へ(´-`;)
- 구조체 수정 : conv_ftl.h
Add Cache Mapping Table(CMT) entry structure
: 기본으로 쓰이는 `conv_ftl` 구조체에 `struct cmt_entry *cmt` 와 `int cmtsize` 추가
여기서 나오는 cmtsize는 valid한 cmt_entry의 개수이기도 하다.
/* new structure */
struct cmt_entry {
uint64_t lpn;
struct ppa ppa;
uint64_t last_access;
bool dirty;
bool valid;
};
struct conv_ftl {
struct ssd *ssd;
struct convparams cp;
struct cmt_entry *cmt; /* page level cache table */
int cmtsize; /* = nr of vaild cmt entry */
struct ppa *maptbl; /* page level mapping table */
uint64_t *rmap;
struct write_pointer wp;
struct write_pointer gc_wp;
struct line_mgmt lm;
struct write_flow_control wfc;
};
- 초기화 및 해제 함수 : conv_ftl.c
maptbl의 initialization과 free 함수를 참고한다.
1. 초기화 함수 : `init_cmt`
static void init_cmt(struct conv_ftl *conv_ftl) {
int i;
struct ssdparams *spp = &conv_ftl->ssd->sp;
conv_ftl->cmt = vmalloc(sizeof(struct cmt_entry) * CMT_SIZE);
conv_ftl->cmtsize = 0;
for (i = 0; i < CMT_SIZE; i++) {
conv_ftl->cmt[i].ppa.ppa = UNMAPPED_PPA;
conv_ftl->cmt[i].dirty = false;
conv_ftl->cmt[i].valid = false;
}
}
기존 maptbl 초기화 함수와 같은 방식으로 ppa를 모두 UNMAPPED_PPA로.
- Call site of this func : `conv_init_ftl`
2. Free 함수 : `remove_cmt`
static void remove_cmt(struct conv_ftl *conv_ftl)
{
conv_ftl->cmtsize = 0;
vfree(conv_ftl->cmt);
}
remove도 maptbl과 같은 방식으로 vfree로 해제해준다.
이게 불리는 거면 모듈을 제거할 때라서 cmtsize를 0으로 바꾸는 코드가
딱히 필요하지는 않을 것 같은데... 그래도 이게 좋을 것 같아서 추가했다.
- Call site of this func : `conv_remove_ftl`
이렇게 쉬운 겉가지 부분 작업이 끝났다...
이제부터가 DFTL의 본격적 구현. read와 write 경로에 대한 것이다...!
'My Laboratory' 카테고리의 다른 글
| Doc Review : 소프트웨어(s/w) 에러정정코드(ecc)를 이용한 낸드 플래시에서의 데이터 입출력 방법 및 그 방법을 이용한 임베디드 시스템 (0) | 2025.09.24 |
|---|---|
| [NVMeVirt] implementation of DFTL #2 : read (1) | 2025.09.10 |
| Paper Review : NVMeVirt: A Versatile Software-defined Virtual NVMe Device (0) | 2025.08.08 |
| Paper Review : DFTL(Demand-based Flash Translation Layer) (3) | 2025.07.28 |
| OSTEP Review : 44장 Flash-based SSDs (0) | 2025.02.23 |