-
Notifications
You must be signed in to change notification settings - Fork 54
/
conv_ftl.h
78 lines (62 loc) · 1.74 KB
/
conv_ftl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// SPDX-License-Identifier: GPL-2.0-only
#ifndef _NVMEVIRT_CONV_FTL_H
#define _NVMEVIRT_CONV_FTL_H
#include <linux/types.h>
#include "pqueue/pqueue.h"
#include "ssd_config.h"
#include "ssd.h"
struct convparams {
uint32_t gc_thres_lines;
uint32_t gc_thres_lines_high;
bool enable_gc_delay;
double op_area_pcent;
int pba_pcent; /* (physical space / logical space) * 100*/
};
struct line {
int id; /* line id, the same as corresponding block id */
int ipc; /* invalid page count in this line */
int vpc; /* valid page count in this line */
struct list_head entry;
/* position in the priority queue for victim lines */
size_t pos;
};
/* wp: record next write addr */
struct write_pointer {
struct line *curline;
uint32_t ch;
uint32_t lun;
uint32_t pg;
uint32_t blk;
uint32_t pl;
};
struct line_mgmt {
struct line *lines;
/* free line list, we only need to maintain a list of blk numbers */
struct list_head free_line_list;
pqueue_t *victim_line_pq;
struct list_head full_line_list;
uint32_t tt_lines;
uint32_t free_line_cnt;
uint32_t victim_line_cnt;
uint32_t full_line_cnt;
};
struct write_flow_control {
uint32_t write_credits;
uint32_t credits_to_refill;
};
struct conv_ftl {
struct ssd *ssd;
struct convparams cp;
struct ppa *maptbl; /* page level mapping table */
uint64_t *rmap; /* reverse mapptbl, assume it's stored in OOB */
struct write_pointer wp;
struct write_pointer gc_wp;
struct line_mgmt lm;
struct write_flow_control wfc;
};
void conv_init_namespace(struct nvmev_ns *ns, uint32_t id, uint64_t size, void *mapped_addr,
uint32_t cpu_nr_dispatcher);
void conv_remove_namespace(struct nvmev_ns *ns);
bool conv_proc_nvme_io_cmd(struct nvmev_ns *ns, struct nvmev_request *req,
struct nvmev_result *ret);
#endif