Skip to content

Commit 2070db4

Browse files
Fix double accounting in erases.
1 parent ad5ed0d commit 2070db4

File tree

9 files changed

+40
-7
lines changed

9 files changed

+40
-7
lines changed

FTLs/bast_ftl.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,3 +406,9 @@ void FtlImpl_Bast::update_map_block(Event &event)
406406
controller.stats.numFTLWrite++;
407407
}
408408

409+
410+
void FtlImpl_Bast::print_ftl_statistics()
411+
{
412+
Block_manager::instance()->print_statistics();
413+
}
414+

FTLs/bdftl_ftl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,5 +456,6 @@ void FtlImpl_BDftl::print_ftl_statistics()
456456
}
457457

458458
printf(" Blocks optimal: %i\n", numOptimal);
459+
Block_manager::instance()->print_statistics();
459460
}
460461

FTLs/dftl_ftl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,8 @@ void FtlImpl_Dftl::cleanup_block(Event &event, Block *block)
215215
}
216216

217217
}
218+
219+
void FtlImpl_Dftl::print_ftl_statistics()
220+
{
221+
Block_manager::instance()->print_statistics();
222+
}

FTLs/fast_ftl.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,3 +596,9 @@ void FtlImpl_Fast::update_map_block(Event &event)
596596
controller.stats.numFTLWrite++;
597597
}
598598

599+
600+
void FtlImpl_Fast::print_ftl_statistics()
601+
{
602+
Block_manager::instance()->print_statistics();
603+
}
604+

run_ufliptrace.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ int main(int argc, char **argv){
7070
printf("Writes %i pages for startup out of %i total pages.\n", preIO, SSD_SIZE * PACKAGE_SIZE * DIE_SIZE * PLANE_SIZE * BLOCK_SIZE);
7171

7272
// srand(1);
73-
// for (int i=0; i<preIO;i++)
73+
// for (int i=0; i<preIO*3;i++)
7474
// {
7575
// long int r = random()%deviceSize;
76-
// double d = ssd.event_arrive(WRITE, i, 1, i*1000);
76+
// double d = ssd.event_arrive(WRITE, r, 1, (double)i*1000.0);
7777
// //double d = ssd.event_arrive(WRITE, i, 1, i*1000);
7878
// afterFormatStartTime += 1000;
7979
//
@@ -102,6 +102,8 @@ int main(int argc, char **argv){
102102
double timeMultiplier = 10000;
103103

104104

105+
long writeEvent = 0;
106+
long readEvent = 0;
105107
for (int i=0; i<files.size();i++)
106108
{
107109
char *filename = NULL;
@@ -146,6 +148,7 @@ int main(int argc, char **argv){
146148
for (int i=0;i<ioSize;i++)
147149
{
148150
local_loop_time += ssd.event_arrive(READ, ((vaddr+(i*(int)multiplier))/addressDivisor)%deviceSize, 1, ((start_time+arrive_time)*timeMultiplier)+local_loop_time);
151+
readEvent++;
149152
}
150153

151154

@@ -155,6 +158,7 @@ int main(int argc, char **argv){
155158
for (int i=0;i<ioSize;i++)
156159
{
157160
local_loop_time += ssd.event_arrive(WRITE, ((vaddr+(i*(int)multiplier))/addressDivisor)%deviceSize, 1, ((start_time+arrive_time)*timeMultiplier)+local_loop_time);
161+
writeEvent++;
158162
}
159163

160164

@@ -166,6 +170,12 @@ int main(int argc, char **argv){
166170
fclose(trace);
167171
}
168172

173+
printf("Pre write done------------------------------\n");
174+
ssd.print_ftl_statistics();
175+
printf("Num read %li write %li\n", readEvent, writeEvent);
176+
getchar();
177+
178+
169179
FILE *logFile = NULL;
170180
if ((logFile = fopen("output.log", "w")) == NULL)
171181
{

ssd.conf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ BUS_TABLE_SIZE 512
3838

3939
# Ssd class:
4040
# number of Packages per Ssd (size)
41-
SSD_SIZE 6
41+
SSD_SIZE 4
4242

4343
# Package class:
4444
# number of Dies per Package (size)
@@ -74,8 +74,7 @@ BLOCK_ERASE_DELAY 2000
7474
# Size of pages (in bytes)
7575
PAGE_READ_DELAY 25
7676
PAGE_WRITE_DELAY 300
77-
PAGE_ENABLE_DATA 0
78-
PAGE_SIZE 2048
77+
PAGE_ENABLE_DATA 2048
7978

8079
# MAPPING
8180
# Specify reservation of

ssd.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,8 @@ class FtlImpl_Bast : public FtlParent
793793

794794
void update_map_block(Event &event);
795795

796+
void print_ftl_statistics();
797+
796798
int addressShift;
797799
int addressSize;
798800
};
@@ -821,6 +823,8 @@ class FtlImpl_Fast : public FtlParent
821823

822824
void update_map_block(Event &event);
823825

826+
void print_ftl_statistics();
827+
824828
long sequential_logicalblock_address;
825829
Address sequential_address;
826830
uint sequential_offset;
@@ -907,6 +911,7 @@ class FtlImpl_Dftl : public FtlImpl_DftlParent
907911
enum status write(Event &event);
908912
enum status trim(Event &event);
909913
void cleanup_block(Event &event, Block *block);
914+
void print_ftl_statistics();
910915
};
911916

912917
class FtlImpl_BDftl : public FtlImpl_DftlParent

ssd_block.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ enum status Block::_erase(Event &event)
156156
Block_manager::instance()->update_block(this);
157157
}
158158

159-
event.incr_time_taken(erase_delay);
160-
161159
return SUCCESS;
162160
}
163161

ssd_bm.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ void Block_manager::print_statistics()
139139
printf("Data blocks: %lu\n", data_active);
140140
printf("Free blocks: %lu\n", (max_blocks - (simpleCurrentFree/BLOCK_SIZE)) + free_list.size());
141141
printf("Invalid blocks: %lu\n", invalid_list.size());
142+
printf("Free2 blocks: %lu\n", (int)invalid_list.size() + (int)log_active + (int)data_active - (int)free_list.size());
142143
printf("-----------------\n");
144+
145+
143146
}
144147

145148
void Block_manager::invalidate(Address address, block_type type)

0 commit comments

Comments
 (0)