forked from meeeejin/rw-rbuf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgarbage_collection.h
72 lines (61 loc) · 2.57 KB
/
garbage_collection.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
//////////////////////////////////////////////////////////////////////////////////
// garbage_collection.h for Cosmos+ OpenSSD
// Copyright (c) 2017 Hanyang University ENC Lab.
// Contributed by Yong Ho Song <yhsong@enc.hanyang.ac.kr>
// Jaewook Kwak <jwkwak@enc.hanyang.ac.kr>
//
// This file is part of Cosmos+ OpenSSD.
//
// Cosmos+ OpenSSD is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// Cosmos+ OpenSSD is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Cosmos+ OpenSSD; see the file COPYING.
// If not, see <http://www.gnu.org/licenses/>.
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// Company: ENC Lab. <http://enc.hanyang.ac.kr>
// Engineer: Jaewook Kwak <jwkwak@enc.hanyang.ac.kr>
//
// Project Name: Cosmos+ OpenSSD
// Design Name: Cosmos+ Firmware
// Module Name: Garbage Collector
// File Name: garbage_collection.h
//
// Version: v1.0.0
//
// Description:
// - define parameters, data structure and functions of garbage collector
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// Revision History:
//
// * v1.0.0
// - First draft
//////////////////////////////////////////////////////////////////////////////////
#ifndef GARBAGE_COLLECTION_H_
#define GARBAGE_COLLECTION_H_
#include "ftl_config.h"
typedef struct _GC_VICTIM_LIST_ENTRY {
unsigned int headBlock : 16;
unsigned int tailBlock : 16;
} GC_VICTIM_LIST_ENTRY, *P_GC_VICTIM_LIST_ENTRY;
typedef struct _GC_VICTIM_MAP {
GC_VICTIM_LIST_ENTRY gcVictimList[USER_DIES][SLICES_PER_BLOCK + 1];
} GC_VICTIM_MAP, *P_GC_VICTIM_MAP;
void InitGcVictimMap();
void GarbageCollection(unsigned int dieNo);
void PutToGcVictimList(unsigned int dieNo, unsigned int blockNo, unsigned int invalidSliceCnt);
unsigned int GetFromGcVictimList(unsigned int dieNo);
void SelectiveGetFromGcVictimList(unsigned int dieNo, unsigned int blockNo);
extern P_GC_VICTIM_MAP gcVictimMapPtr;
extern unsigned int gcTriggered;
extern unsigned int copyCnt;
#endif /* GARBAGE_COLLECTION_H_ */