FEMU  原版 master 7e238cc
FEMU: Accurate, Scalable and Extensible NVMe SSD Emulator (FAST'18)
ftl.h
浏览该文件的文档.
1 #ifndef __FEMU_FTL_H
2 #define __FEMU_FTL_H
3 
10 #include "../nvme.h"
11 
12 #define INVALID_PPA (~(0ULL))
13 #define INVALID_LPN (~(0ULL))
14 #define UNMAPPED_PPA (~(0ULL))
15 
20 enum {
21  NAND_READ = 0,
24 
27  NAND_ERASE_LATENCY = 2000000,
28 };
29 
30 enum {
31  USER_IO = 0,
32  GC_IO = 1,
33 };
34 
35 enum {
36  SEC_FREE = 0,
38  SEC_VALID = 2,
39 
40  PG_FREE = 0,
43 };
44 
45 enum {
48 
51 
55 };
56 
57 
58 #define BLK_BITS (16)
59 #define PG_BITS (16)
60 #define SEC_BITS (8)
61 #define PL_BITS (8)
62 #define LUN_BITS (8)
63 #define CH_BITS (7)
64 
69 struct ppa {
70  union {
71  struct {
72  uint64_t blk : BLK_BITS;
73  uint64_t pg : PG_BITS;
74  uint64_t sec : SEC_BITS;
75  uint64_t pl : PL_BITS;
76  uint64_t lun : LUN_BITS;
77  uint64_t ch : CH_BITS;
78  uint64_t rsv : 1;
79  } g;
80 
81  uint64_t ppa;
82  };
83 };
84 
85 typedef int nand_sec_status_t;
86 
91 struct nand_page {
93  int nsecs;
94  int status;
95 };
96 
101 struct nand_block {
102  struct nand_page *pg;
103  int npgs;
104  int ipc;
105  int vpc;
107  int wp;
108 };
109 
114 struct nand_plane {
115  struct nand_block *blk;
116  int nblks;
117 };
118 
123 struct nand_lun {
124  struct nand_plane *pl;
125  int npls;
127  bool busy;
128  uint64_t gc_endtime;
129 };
130 
135 struct ssd_channel {
136  struct nand_lun *lun;
137  int nluns;
139  bool busy;
140  uint64_t gc_endtime;
141 };
142 
147 struct ssdparams {
148  int secsz;
154  int nchs;
156  int pg_rd_lat;
157  int pg_wr_lat;
166 
167  /* below are all calculated values */
172  int tt_secs;
177  int tt_pgs;
181  int tt_blks;
186  int tt_lines;
187 
189  int tt_pls;
191  int tt_luns;
192 };
193 
198 typedef struct line {
199  int id;
200  int ipc;
201  int vpc;
202  QTAILQ_ENTRY(line) entry;
204  size_t pos;
205 } line;
206 
212  struct line *curline;
213  int ch;
214  int lun;
215  int pg;
216  int blk;
217  int pl;
218 };
219 
224 struct line_mgmt {
225  struct line *lines;
226  /* free line list, we only need to maintain a list of blk numbers */
227  QTAILQ_HEAD(free_line_list, line) free_line_list;
229  //QTAILQ_HEAD(victim_line_list, line) victim_line_list;
230  QTAILQ_HEAD(full_line_list, line) full_line_list;
231  int tt_lines;
235 };
236 
237 struct nand_cmd {
238  int type;
239  int cmd;
240  int64_t stime;
241 };
242 
247 struct ssd {
248  char *ssdname;
249  struct ssdparams sp;
250  struct ssd_channel *ch;
251  struct ppa *maptbl;
252  uint64_t *rmap;
254  struct line_mgmt lm;
255 
256  /* lockless ring for communication with NVMe IO thread */
257  struct rte_ring **to_ftl;
258  struct rte_ring **to_poller;
260  QemuThread ftl_thread;
261 };
262 
263 void ssd_init(FemuCtrl *n);
264 
265 #ifdef FEMU_DEBUG_FTL
266 #define ftl_debug(fmt, ...) \
267  do { printf("[FEMU] FTL-Dbg: " fmt, ## __VA_ARGS__); } while (0)
268 #else
269 #define ftl_debug(fmt, ...) \
270  do { } while (0)
271 #endif
272 
273 #define ftl_err(fmt, ...) \
274  do { fprintf(stderr, "[FEMU] FTL-Err: " fmt, ## __VA_ARGS__); } while (0)
275 
276 #define ftl_log(fmt, ...) \
277  do { printf("[FEMU] FTL-Log: " fmt, ## __VA_ARGS__); } while (0)
278 
279 
280 /* FEMU assert() */
281 #ifdef FEMU_DEBUG_FTL
282 #define ftl_assert(expression) assert(expression)
283 #else
284 #define ftl_assert(expression)
285 #endif
286 
287 #endif
GC_IO
@ GC_IO
Definition: ftl.h:32
nand_block::ipc
int ipc
Definition: ftl.h:104
NvmeCmd
Definition: nvme.h:296
do_gc
static int do_gc(struct ssd *ssd, bool force)
gc函数,清理一整个line
Definition: ftl.c:865
ssd_init_nand_page
static void ssd_init_nand_page(struct nand_page *pg, struct ssdparams *spp)
Definition: ftl.c:352
SEC_FREE
@ SEC_FREE
Definition: ftl.h:36
ppa::lun
uint64_t lun
Definition: ftl.h:76
ssdparams::ch_xfer_lat
int ch_xfer_lat
Definition: ftl.h:159
nvme_rw
uint16_t nvme_rw(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
nvme读写命令
Definition: nvme-io.c:370
nand_cmd::stime
int64_t stime
Definition: ftl.h:240
ssd::ch
struct ssd_channel * ch
Definition: ftl.h:250
line_mgmt::lines
struct line * lines
Definition: ftl.h:225
NAND_ERASE_LATENCY
@ NAND_ERASE_LATENCY
Definition: ftl.h:27
nand_block::npgs
int npgs
Definition: ftl.h:103
ssdparams::pg_rd_lat
int pg_rd_lat
Definition: ftl.h:156
ssd
模拟一个ssd
Definition: ftl.h:247
ssd_channel::lun
struct nand_lun * lun
Definition: ftl.h:136
ssdparams::pg_wr_lat
int pg_wr_lat
Definition: ftl.h:157
FemuCtrl
femu相关控制参数和数据成员
Definition: nvme.h:1184
FemuCtrl::print_log
bool print_log
Definition: nvme.h:1334
ppa2pgidx
static uint64_t ppa2pgidx(struct ssd *ssd, struct ppa *ppa)
Definition: ftl.c:55
pqueue_pop
void * pqueue_pop(pqueue_t *q)
Definition: pqueue.c:172
FemuCtrl::ext_ops
FemuExtCtrlOps ext_ops
nvme到各模式ssd接口
Definition: nvme.h:1220
nand_lun::busy
bool busy
Definition: ftl.h:127
FEMU_DISABLE_LOG
@ FEMU_DISABLE_LOG
Definition: ftl.h:54
write_pointer::curline
struct line * curline
Definition: ftl.h:212
PG_BITS
#define PG_BITS
Definition: ftl.h:59
get_ch
static struct ssd_channel * get_ch(struct ssd *ssd, struct ppa *ppa)
Definition: ftl.c:498
get_pg
static struct nand_page * get_pg(struct ssd *ssd, struct ppa *ppa)
Definition: ftl.c:526
NVME_CMD_DSM
@ NVME_CMD_DSM
Definition: nvme.h:345
ssd_init_rmap
static void ssd_init_rmap(struct ssd *ssd)
Definition: ftl.c:416
pqueue_change_priority
void pqueue_change_priority(pqueue_t *q, pqueue_pri_t new_pri, void *d)
Definition: pqueue.c:147
femu_log
#define femu_log(fmt,...)
Definition: nvme.h:1514
line_mgmt::victim_line_cnt
int victim_line_cnt
Definition: ftl.h:233
ssdparams::pls_per_ch
int pls_per_ch
Definition: ftl.h:188
ssd_channel
通道
Definition: ftl.h:135
write_pointer::blk
int blk
Definition: ftl.h:216
FemuExtCtrlOps
struct FemuExtCtrlOps FemuExtCtrlOps
扩展操作接口,具体实现在各模式ssd中
get_line
static struct line * get_line(struct ssd *ssd, struct ppa *ppa)
Definition: ftl.c:521
get_next_free_line
static struct line * get_next_free_line(struct ssd *ssd)
Definition: ftl.c:184
ssd_read
static uint64_t ssd_read(struct ssd *ssd, NvmeRequest *req)
Definition: ftl.c:911
ftl_thread
static void * ftl_thread(void *arg)
ftl线程函数,不断从to_ftl中取req,处理(计算出时延)后放入to_poller
Definition: ftl.c:1015
mark_page_invalid
static void mark_page_invalid(struct ssd *ssd, struct ppa *ppa)
update SSD status about one page from PG_VALID -> PG_INVALID
Definition: ftl.c:617
ssd_init_lines
static void ssd_init_lines(struct ssd *ssd)
初始化lines,所有line加入free_line_list,而full_line_list和victim_line_pq为空
Definition: ftl.c:122
ssdparams::blks_per_lun
int blks_per_lun
Definition: ftl.h:179
ppa::sec
uint64_t sec
Definition: ftl.h:74
NAND_ERASE
@ NAND_ERASE
Definition: ftl.h:23
lba
uint64_t lba
Definition: oc12.h:2
femu_debug
#define femu_debug(fmt,...)
Definition: nvme.h:1507
nand_lun::gc_endtime
uint64_t gc_endtime
Definition: ftl.h:128
mark_block_free
static void mark_block_free(struct ssd *ssd, struct ppa *ppa)
将一个空block中所有页标记为PG_FREE
Definition: ftl.c:698
ppa::pg
uint64_t pg
Definition: ftl.h:73
NVME_SUCCESS
@ NVME_SUCCESS
Definition: nvme.h:526
NVME_ADM_CMD_FEMU_FLIP
@ NVME_ADM_CMD_FEMU_FLIP
Definition: nvme.h:335
FemuCtrl::num_poller
uint32_t num_poller
nvme poller个数(前提是multupoller_enabled开启)
Definition: nvme.h:1337
ppa::pl
uint64_t pl
Definition: ftl.h:75
pqueue_pri_t
unsigned long long pqueue_pri_t
Definition: pqueue.h:39
valid_lpn
static bool valid_lpn(struct ssd *ssd, uint64_t lpn)
Definition: ftl.c:488
ssdparams::tt_pls
int tt_pls
Definition: ftl.h:189
SEC_BITS
#define SEC_BITS
Definition: ftl.h:60
ssdparams::gc_thres_pcent_high
double gc_thres_pcent_high
Definition: ftl.h:163
PL_BITS
#define PL_BITS
Definition: ftl.h:61
set_rmap_ent
static void set_rmap_ent(struct ssd *ssd, uint64_t lpn, struct ppa *ppa)
赋值一个反向映射表项(rmap[page_no(ppa)] -> lpn)
Definition: ftl.c:85
NvmeRequest::nlb
uint16_t nlb
逻辑块个数
Definition: nvme.h:974
ppa::g
struct ppa::@4::@6 g
ssd::wp
struct write_pointer wp
Definition: ftl.h:253
ftl.h
ftl相关数据声明
line_mgmt
记录各种line的列表和数量
Definition: ftl.h:224
write_pointer::pg
int pg
Definition: ftl.h:215
NvmeNamespace
Definition: nvme.h:1065
NVME_CMD_WRITE
@ NVME_CMD_WRITE
Definition: nvme.h:340
NVME_DNR
@ NVME_DNR
Definition: nvme.h:581
ssdparams::nchs
int nchs
Definition: ftl.h:154
mark_page_valid
static void mark_page_valid(struct ssd *ssd, struct ppa *ppa)
将一个page从PG_FREE标记为PG_VALID
Definition: ftl.c:670
FEMU_ENABLE_GC_DELAY
@ FEMU_ENABLE_GC_DELAY
Definition: ftl.h:46
get_pl
static struct nand_plane * get_pl(struct ssd *ssd, struct ppa *ppa)
Definition: ftl.c:509
ssd::maptbl
struct ppa * maptbl
页映射表
Definition: ftl.h:251
femu_ring_dequeue
size_t femu_ring_dequeue(struct rte_ring *ring, void **objs, size_t count)
Definition: rte_ring.c:228
gc_read_page
static void gc_read_page(struct ssd *ssd, struct ppa *ppa)
gc产生的读page
Definition: ftl.c:724
ssd::ftl_thread
QemuThread ftl_thread
Definition: ftl.h:260
UNMAPPED_PPA
#define UNMAPPED_PPA
Definition: ftl.h:14
NAND_WRITE
@ NAND_WRITE
Definition: ftl.h:22
ssdparams::luns_per_ch
int luns_per_ch
Definition: ftl.h:153
FEMU_ENABLE_DELAY_EMU
@ FEMU_ENABLE_DELAY_EMU
Definition: ftl.h:49
should_gc_high
static bool should_gc_high(struct ssd *ssd)
gc阈值
Definition: ftl.c:32
victim_line_set_pos
static void victim_line_set_pos(void *a, size_t pos)
Definition: ftl.c:112
pqueue_init
pqueue_t * pqueue_init(size_t n, pqueue_cmp_pri_f cmppri, pqueue_get_pri_f getpri, pqueue_set_pri_f setpri, pqueue_get_pos_f getpos, pqueue_set_pos_f setpos)
Definition: pqueue.c:37
line::QTAILQ_ENTRY
QTAILQ_ENTRY(line) entry
ssd::lm
struct line_mgmt lm
Definition: ftl.h:254
ppa::ppa
uint64_t ppa
Definition: ftl.h:81
FEMU_RESET_ACCT
@ FEMU_RESET_ACCT
Definition: ftl.h:52
ssdparams::blk_er_lat
int blk_er_lat
Definition: ftl.h:158
nand_page::status
int status
Definition: ftl.h:94
ssd_advance_status
static uint64_t ssd_advance_status(struct ssd *ssd, struct ppa *ppa, struct nand_cmd *ncmd)
根据操作类型,给出模拟的时延
Definition: ftl.c:540
ssdparams::tt_luns
int tt_luns
Definition: ftl.h:191
CH_BITS
#define CH_BITS
Definition: ftl.h:63
ssd_init_params
static void ssd_init_params(struct ssdparams *spp)
设置nand大小/并行参数,做相关计算
Definition: ftl.c:300
NvmeRequest::stime
int64_t stime
io开始时间
Definition: nvme.h:987
get_rmap_ent
static uint64_t get_rmap_ent(struct ssd *ssd, struct ppa *ppa)
Definition: ftl.c:71
mark_line_free
static void mark_line_free(struct ssd *ssd, struct ppa *ppa)
将该line加入空闲line队列
Definition: ftl.c:847
ssdparams::gc_thres_lines
int gc_thres_lines
Definition: ftl.h:162
nvme_set_ctrl_name
void nvme_set_ctrl_name(FemuCtrl *n, const char *mn, const char *sn, int *dev_id)
Definition: nvme-util.c:294
line_mgmt::QTAILQ_HEAD
QTAILQ_HEAD(free_line_list, line) free_line_list
ssdparams::secs_per_pl
int secs_per_pl
Definition: ftl.h:169
FemuCtrl::nr_tt_ios
int64_t nr_tt_ios
总io数量
Definition: nvme.h:1332
PG_FREE
@ PG_FREE
Definition: ftl.h:40
ppa::blk
uint64_t blk
Definition: ftl.h:72
ftl_err
#define ftl_err(fmt,...)
Definition: ftl.h:273
nand_page::nsecs
int nsecs
Definition: ftl.h:93
ssd::ssdname
char * ssdname
Definition: ftl.h:248
nand_block::vpc
int vpc
Definition: ftl.h:105
rte_ring
Definition: rte_ring.h:127
select_victim_line
static struct line * select_victim_line(struct ssd *ssd, bool force)
为gc选择一个victim line,优先队列中出队即可
Definition: ftl.c:790
ssdparams::blks_per_line
int blks_per_line
Definition: ftl.h:185
pqueue_insert
int pqueue_insert(pqueue_t *q, void *d)
Definition: pqueue.c:122
victim_line_get_pos
static size_t victim_line_get_pos(void *a)
Definition: ftl.c:107
bb_flip
static void bb_flip(FemuCtrl *n, NvmeCmd *cmd)
blackbox自定义admin命令
Definition: bb.c:38
ppa::ch
uint64_t ch
Definition: ftl.h:77
SEC_VALID
@ SEC_VALID
Definition: ftl.h:38
nand_cmd::type
int type
Definition: ftl.h:238
ssdparams::tt_blks
int tt_blks
Definition: ftl.h:181
write_pointer::ch
int ch
Definition: ftl.h:213
mapped_ppa
static bool mapped_ppa(struct ppa *ppa)
Definition: ftl.c:493
nand_lun::npls
int npls
Definition: ftl.h:125
ssdparams::blks_per_pl
int blks_per_pl
Definition: ftl.h:151
nand_block::erase_cnt
int erase_cnt
Definition: ftl.h:106
ssd::to_poller
struct rte_ring ** to_poller
存放完成的req,交给nvme线程
Definition: ftl.h:258
ssdparams::pgs_per_ch
int pgs_per_ch
Definition: ftl.h:176
nvme_register_bbssd
int nvme_register_bbssd(FemuCtrl *n)
注册blackbox相关函数
Definition: bb.c:145
FEMU_DISABLE_DELAY_EMU
@ FEMU_DISABLE_DELAY_EMU
Definition: ftl.h:50
NAND_READ
@ NAND_READ
Definition: ftl.h:21
ssdparams::enable_gc_delay
bool enable_gc_delay
Definition: ftl.h:165
pqueue_t
Definition: pqueue.h:54
nand_lun::pl
struct nand_plane * pl
Definition: ftl.h:124
bb_nvme_rw
static uint16_t bb_nvme_rw(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
blackbox 读写命令
Definition: bb.c:94
check_params
static void check_params(struct ssdparams *spp)
Definition: ftl.c:284
ssdparams::secs_per_ch
int secs_per_ch
Definition: ftl.h:171
FEMU_DISABLE_GC_DELAY
@ FEMU_DISABLE_GC_DELAY
Definition: ftl.h:47
victim_line_set_pri
static void victim_line_set_pri(void *a, pqueue_pri_t pri)
Definition: ftl.c:102
line::vpc
int vpc
Definition: ftl.h:201
nand_plane
plane
Definition: ftl.h:114
ssd_init_nand_plane
static void ssd_init_nand_plane(struct nand_plane *pl, struct ssdparams *spp)
Definition: ftl.c:375
bb_init
static void bb_init(FemuCtrl *n, Error **errp)
Definition: bb.c:20
get_new_page
static struct ppa get_new_page(struct ssd *ssd)
获取新的page(wpp已经更新,取其指向的page地址即可)
Definition: ftl.c:269
ssd_init_maptbl
static void ssd_init_maptbl(struct ssd *ssd)
Definition: ftl.c:406
ssdparams::secs_per_line
int secs_per_line
Definition: ftl.h:183
NVME_INVALID_OPCODE
@ NVME_INVALID_OPCODE
Definition: nvme.h:527
nand_page
Definition: ftl.h:91
ssdparams::gc_thres_pcent
double gc_thres_pcent
Definition: ftl.h:161
LUN_BITS
#define LUN_BITS
Definition: ftl.h:62
check_addr
static void check_addr(int a, int max)
Definition: ftl.c:179
ssdparams::tt_lines
int tt_lines
Definition: ftl.h:186
FemuCtrl::nr_tt_late_ios
int64_t nr_tt_late_ios
没有按预计时延(超时)返回的io数量
Definition: nvme.h:1333
ssdparams::secs_per_lun
int secs_per_lun
Definition: ftl.h:170
line
line
Definition: ftl.h:198
NAND_READ_LATENCY
@ NAND_READ_LATENCY
Definition: ftl.h:25
femu_ring_enqueue
size_t femu_ring_enqueue(struct rte_ring *ring, void **objs, size_t count)
Definition: rte_ring.c:223
line
struct line line
line
ssdparams::blks_per_ch
int blks_per_ch
Definition: ftl.h:180
ssd_channel::busy
bool busy
Definition: ftl.h:139
line::pos
size_t pos
Definition: ftl.h:204
nand_block
Definition: ftl.h:101
PG_VALID
@ PG_VALID
Definition: ftl.h:42
ssdparams::gc_thres_lines_high
int gc_thres_lines_high
Definition: ftl.h:164
ssd_init_nand_lun
static void ssd_init_nand_lun(struct nand_lun *lun, struct ssdparams *spp)
Definition: ftl.c:384
FemuCtrl::ssd
struct ssd * ssd
指向模拟的ssd
Definition: nvme.h:1321
set_maptbl_ent
static void set_maptbl_ent(struct ssd *ssd, uint64_t lpn, struct ppa *ppa)
赋值一个page映射表项
Definition: ftl.c:49
nand_block::wp
int wp
Definition: ftl.h:107
nand_cmd
Definition: ftl.h:237
line_mgmt::tt_lines
int tt_lines
Definition: ftl.h:231
line_mgmt::full_line_cnt
int full_line_cnt
Definition: ftl.h:234
write_pointer::pl
int pl
Definition: ftl.h:217
NvmeCmd::cdw10
uint32_t cdw10
Definition: nvme.h:306
nand_block::pg
struct nand_page * pg
Definition: ftl.h:102
NvmeCmd::opcode
uint16_t opcode
Definition: nvme.h:297
victim_line_get_pri
static pqueue_pri_t victim_line_get_pri(void *a)
Definition: ftl.c:97
ssd::rmap
uint64_t * rmap
反向映射表, assume it's stored in OOB
Definition: ftl.h:252
ssdparams::tt_pgs
int tt_pgs
Definition: ftl.h:177
nand_lun
晶圆
Definition: ftl.h:123
FemuCtrl::to_ftl
struct rte_ring ** to_ftl
生产者:nvme poller;消费者:ftl
Definition: nvme.h:1326
FEMU_ENABLE_LOG
@ FEMU_ENABLE_LOG
Definition: ftl.h:53
should_gc
static bool should_gc(struct ssd *ssd)
空闲gc阈值
Definition: ftl.c:20
pqueue_peek
void * pqueue_peek(pqueue_t *q)
Definition: pqueue.c:186
line::ipc
int ipc
Definition: ftl.h:200
nand_sec_status_t
int nand_sec_status_t
Definition: ftl.h:85
ssdparams::secsz
int secsz
Definition: ftl.h:148
ssdparams::pgs_per_lun
int pgs_per_lun
Definition: ftl.h:175
USER_IO
@ USER_IO
Definition: ftl.h:31
ssd_channel::next_ch_avail_time
uint64_t next_ch_avail_time
Definition: ftl.h:138
NAND_PROG_LATENCY
@ NAND_PROG_LATENCY
Definition: ftl.h:26
write_pointer
wp: record next write addr
Definition: ftl.h:211
gc_write_page
**param ssd *param old_ppa *return uint64_t *static uint64_t gc_write_page(struct ssd *ssd, struct ppa *old_ppa)
gc产生的写
Definition: ftl.c:745
nand_cmd::cmd
int cmd
Definition: ftl.h:239
ssd_write
static uint64_t ssd_write(struct ssd *ssd, NvmeRequest *req)
ssd写延迟模拟
Definition: ftl.c:954
nand_plane::blk
struct nand_block * blk
Definition: ftl.h:115
FemuCtrl::to_poller
struct rte_ring ** to_poller
生产者:ftl;消费者:nvme poller
Definition: nvme.h:1327
ssdparams::pls_per_lun
int pls_per_lun
Definition: ftl.h:152
ppa::rsv
uint64_t rsv
Definition: ftl.h:78
ssd_init
void ssd_init(FemuCtrl *n)
初始化ssd参数,为ssd各层结构体分配空间,创建ftl线程
Definition: ftl.c:431
ssdparams::secs_per_pg
int secs_per_pg
Definition: ftl.h:149
ssdparams::pgs_per_blk
int pgs_per_blk
Definition: ftl.h:150
ssdparams::pgs_per_pl
int pgs_per_pl
Definition: ftl.h:174
bb_init_ctrl_str
static void bb_init_ctrl_str(FemuCtrl *n)
Definition: bb.c:10
ftl_assert
#define ftl_assert(expression)
Definition: ftl.h:284
ssd_init
void ssd_init(FemuCtrl *n)
初始化ssd参数,为ssd各层结构体分配空间,创建ftl线程
Definition: ftl.c:431
ssdparams::pgs_per_line
int pgs_per_line
Definition: ftl.h:184
ssdparams::tt_secs
int tt_secs
Definition: ftl.h:172
BLK_BITS
#define BLK_BITS
Definition: ftl.h:58
FemuExtCtrlOps::state
void * state
Definition: nvme.h:1170
ppa
describe a physical page addr
Definition: ftl.h:69
ssd_advance_write_pointer
static void ssd_advance_write_pointer(struct ssd *ssd)
写指针后移,每次写操作结束后调用
Definition: ftl.c:205
victim_line_cmp_pri
static int victim_line_cmp_pri(pqueue_pri_t next, pqueue_pri_t curr)
Definition: ftl.c:92
NVME_CMD_READ
@ NVME_CMD_READ
Definition: nvme.h:341
ftl_debug
#define ftl_debug(fmt,...)
Definition: ftl.h:269
ssdparams
ssd参数
Definition: ftl.h:147
FemuCtrl::devname
char devname[64]
Definition: nvme.h:1325
femu_ring_count
size_t femu_ring_count(struct rte_ring *ring)
Definition: rte_ring.c:218
NvmeRequest::slba
uint64_t slba
开始lba
Definition: nvme.h:972
bb_admin_cmd
static uint16_t bb_admin_cmd(FemuCtrl *n, NvmeCmd *cmd)
blackbox admin命令
Definition: bb.c:128
get_blk
static struct nand_block * get_blk(struct ssd *ssd, struct ppa *ppa)
Definition: ftl.c:515
ssdparams::secs_per_blk
int secs_per_blk
Definition: ftl.h:168
ssd_channel::nluns
int nluns
Definition: ftl.h:137
nand_plane::nblks
int nblks
Definition: ftl.h:116
nand_lun::next_lun_avail_time
uint64_t next_lun_avail_time
Definition: ftl.h:126
ssd_init_nand_blk
static void ssd_init_nand_blk(struct nand_block *blk, struct ssdparams *spp)
Definition: ftl.c:362
ssd::dataplane_started_ptr
bool * dataplane_started_ptr
Definition: ftl.h:259
get_maptbl_ent
static struct ppa get_maptbl_ent(struct ssd *ssd, uint64_t lpn)
Definition: ftl.c:37
write_pointer::lun
int lun
Definition: ftl.h:214
SEC_INVALID
@ SEC_INVALID
Definition: ftl.h:37
line_mgmt::victim_line_pq
pqueue_t * victim_line_pq
Definition: ftl.h:228
get_lun
static struct nand_lun * get_lun(struct ssd *ssd, struct ppa *ppa)
Definition: ftl.c:503
FemuCtrl::dataplane_started
bool dataplane_started
Definition: nvme.h:1273
NvmeRequest
Definition: nvme.h:967
ssd_init_write_pointer
static void ssd_init_write_pointer(struct ssd *ssd)
写指针初始化,指向0
Definition: ftl.c:160
bb_io_cmd
static uint16_t bb_io_cmd(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
blackbox io命令
Definition: bb.c:109
ssd_init_ch
static void ssd_init_ch(struct ssd_channel *ch, struct ssdparams *spp)
Definition: ftl.c:395
line::id
int id
Definition: ftl.h:199
line_mgmt::free_line_cnt
int free_line_cnt
Definition: ftl.h:232
ssd::sp
struct ssdparams sp
Definition: ftl.h:249
nand_page::sec
nand_sec_status_t * sec
Definition: ftl.h:92
ssd::to_ftl
struct rte_ring ** to_ftl
无锁ring队列,用于接收nvme下传的req
Definition: ftl.h:257
INVALID_LPN
#define INVALID_LPN
Definition: ftl.h:13
PG_INVALID
@ PG_INVALID
Definition: ftl.h:41
clean_one_block
static void clean_one_block(struct ssd *ssd, struct ppa *ppa)
gc清理一个block,将有效页转移
Definition: ftl.c:819
ssd_channel::gc_endtime
uint64_t gc_endtime
Definition: ftl.h:140
valid_ppa
static bool valid_ppa(struct ssd *ssd, struct ppa *ppa)
判断ppa地址是否越界
Definition: ftl.c:470