-
Notifications
You must be signed in to change notification settings - Fork 0
/
ssd_ftl.cpp
88 lines (70 loc) · 1.98 KB
/
ssd_ftl.cpp
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
79
80
81
82
83
84
85
86
87
88
/* Copyright 2009, 2010 Brendan Tauras */
/* ssd_ftl.cpp is part of FlashSim. */
/* FlashSim 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 of the License, or
* any later version. */
/* FlashSim 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 FlashSim. If not, see <http://www.gnu.org/licenses/>. */
/****************************************************************************/
/* Ftl class
* Brendan Tauras 2009-11-04
*
* This class is a stub class for the user to use as a template for implementing
* his/her FTL scheme. A few functions to gather information from lower-level
* hardware are added to assist writing a FTL scheme. The Ftl class should
* rely on the Garbage_collector and Wear_leveler classes for modularity and
* simplicity. */
#include <new>
#include <assert.h>
#include <stdio.h>
#include "ssd.h"
using namespace ssd;
Ftl::Ftl(Controller &controller):
controller(controller),
garbage(*this),
wear(*this)
{
return;
}
Ftl::~Ftl(void)
{
return;
}
enum status Ftl::read(Event &event)
{
return SUCCESS;
}
enum status Ftl::write(Event &event)
{
return SUCCESS;
}
enum status Ftl::erase(Event &event)
{
return SUCCESS;
}
enum status Ftl::merge(Event &event)
{
return SUCCESS;
}
void Ftl::garbage_collect(Event &event)
{
(void) garbage.collect(event);
}
ssd::ulong Ftl::get_erases_remaining(const Address &address) const
{
return controller.get_erases_remaining(address);
}
void Ftl::get_least_worn(Address &address) const
{
controller.get_least_worn(address);
return;
}
enum page_state Ftl::get_state(const Address &address) const
{
return controller.get_state(address);
}