Skip to content

Commit

Permalink
Merge pull request #4 from fadhilimamk/fadhil_raid
Browse files Browse the repository at this point in the history
Finish RAID0 controller simulator above SSDSim instances
  • Loading branch information
fadhilkurnia authored Apr 1, 2019
2 parents 877e289 + 6f7b0a5 commit e6dba6f
Show file tree
Hide file tree
Showing 11 changed files with 740 additions and 60 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
.vscode
ssd
*.0
*.o
*~
*.trace
.DS_Store
.idea
cmake-build-debug
cmake-build-debug
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test.o: flash.h initialize.h pagemap.h
gcc -c -g test.c
ssd: ssd.o avlTree.o flash.o initialize.o pagemap.o raid.o
cc -g -o ssd ssd.o avlTree.o flash.o initialize.o pagemap.o raid.o
rm *.o
# rm *.o
ssd.o: flash.h initialize.h pagemap.h raid.h
gcc -c -g ssd.c
flash.o: pagemap.h
Expand Down
12 changes: 5 additions & 7 deletions flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ struct sub_request * creat_sub_request(struct ssd_info * ssd,unsigned int lpn,in
free(sub);
sub=NULL;
printf("\nERROR ! Unexpected command.\n");
exit(100);
return NULL;
}

Expand Down Expand Up @@ -774,7 +775,8 @@ struct sub_request * find_read_sub_request(struct ssd_info * ssd, unsigned int c
}
else
{
printf("Error! Can't find the sub request.");
printf("Error! Can't find the sub request. {begin_time=%lld ope=%u}\n", sub->begin_time, sub->operation);
getchar();
}
}
}
Expand Down Expand Up @@ -905,7 +907,6 @@ Status services_2_r_cmd_trans_and_complete(struct ssd_info * ssd)
for(i=0;i<ssd->parameter->channel_number;i++) /*这个循环处理不需要channel的时间(读命令已经到达chip,chip由ready变为busy),当读请求完成时,将其从channel的队列中取出*/
{
sub=ssd->channel_head[i].subs_r_head;

while(sub!=NULL)
{
if(sub->current_state==SR_R_C_A_TRANSFER) /*读命令发送完毕,将对应的die置为busy,同时修改sub的状态; 这个部分专门处理读请求由当前状态为传命令变为die开始busy,die开始busy不需要channel为空,所以单独列出*/
Expand All @@ -918,7 +919,6 @@ Status services_2_r_cmd_trans_and_complete(struct ssd_info * ssd)
}
else if((sub->current_state==SR_COMPLETE)||((sub->next_state==SR_COMPLETE)&&(sub->next_state_predict_time<=ssd->current_time)))
{
printf("yap this state\n");
if(sub!=ssd->channel_head[i].subs_r_head) /*if the request is completed, we delete it from read queue */
{
p->next_node=sub->next_node;
Expand Down Expand Up @@ -951,7 +951,7 @@ Status services_2_r_cmd_trans_and_complete(struct ssd_info * ssd)
Status services_2_r_data_trans(struct ssd_info * ssd,unsigned int channel,unsigned int * channel_busy_flag, unsigned int * change_current_time_flag)
{
int chip=0;
unsigned int die=0,plane=0,address_ppn=0,die1=0;
unsigned int die=0,plane=0,address_ppn=0,die1=0,sub_plane;
struct sub_request * sub=NULL, * p=NULL,*sub1=NULL;
struct sub_request * sub_twoplane_one=NULL, * sub_twoplane_two=NULL;
struct sub_request * sub_interleave_one=NULL, * sub_interleave_two=NULL;
Expand Down Expand Up @@ -984,7 +984,7 @@ Status services_2_r_data_trans(struct ssd_info * ssd,unsigned int channel,unsign
if ((ssd->parameter->advanced_commands&AD_TWOPLANE_READ)==AD_TWOPLANE_READ) /*有可能产生了two plane操作,在这种情况下,将同一个die上的两个plane的数据依次传出*/
{
sub_twoplane_one=sub;
sub_twoplane_two=NULL;
sub_twoplane_two=NULL;
/*为了保证找到的sub_twoplane_two与sub_twoplane_one不同,令add_reg_ppn=-1*/
ssd->channel_head[channel].chip_head[chip].die_head[die].plane_head[sub->location->plane].add_reg_ppn=-1;
sub_twoplane_two=find_read_sub_request(ssd,channel,chip,die); /*在相同的channel,chip,die中寻找另外一个读子请求*/
Expand Down Expand Up @@ -1638,8 +1638,6 @@ struct ssd_info *process(struct ssd_info *ssd)
}

sub=ssd->channel_head[i].subs_r_head; /*先处理读请求*/

// TODO: Fadhil, why this function change the flag into 1
services_2_r_wait(ssd,i,&flag,&chg_cur_time_flag); /*处理处于等待状态的读子请求 | Handling read child requests in wait state*/

if((flag==0)&&(ssd->channel_head[i].subs_r_head!=NULL)) /*if there are no new read request and data is ready in some dies, send these data to controller and response this request*/
Expand Down
2 changes: 2 additions & 0 deletions initialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@ struct request{

struct sub_request *subs; //链接到属于该请求的所有子请求
struct request *next_node; //指向下一个请求结构体

struct raid_sub_request *subreq_on_raid;
};


Expand Down
2 changes: 1 addition & 1 deletion pagemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ int delete_gc_node(struct ssd_info *ssd, unsigned int channel,struct gc_operatio
double free_page_percent = gc_node->x_free_percentage;

if (end_time != start_time) {
printf("%d \t %d \t %d \t %d \t%6.2f %8u %16lld %16lld %16lld\n", channel, gc_node->chip, gc_node->die, gc_node->plane, free_page_percent, moved_page, start_time, end_time, end_time-start_time);
printf("gc-disk-%d: %d \t %d \t %d \t %d \t%6.2f %8u %16lld %16lld %16lld\n", ssd->diskid, channel, gc_node->chip, gc_node->die, gc_node->plane, free_page_percent, moved_page, start_time, end_time, end_time-start_time);
fprintf(ssd->outfile_gc, "%d \t %d \t %d \t %d \t%6.2f %8u %16lld %16lld %16lld\n", channel, gc_node->chip, gc_node->die, gc_node->plane, free_page_percent, moved_page, start_time, end_time, end_time-start_time);
fflush(ssd->outfile_gc);
ssd->num_gc++;
Expand Down
Empty file modified processing/cdf
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion processing/cdf_raid
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,4 @@ def plot_graph(main_graph, disk_graph, iolog_file, ndisk, nogc = False):
return

if __name__ == "__main__":
main(sys.argv[1:])
main(sys.argv[1:])
Loading

0 comments on commit e6dba6f

Please sign in to comment.