From: Christophe ThiƩry Date: Thu, 19 Jan 2012 16:10:30 +0000 (+0100) Subject: Fix SIMIX_post_io. For now SIMIX_req_file_read makes a Surf sleep action. X-Git-Tag: exp_20120216~119^2~69 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/4dcdf4c43798ec5cfd6393c51768330cf5dfeb1d Fix SIMIX_post_io. For now SIMIX_req_file_read makes a Surf sleep action. --- diff --git a/src/simix/io_private.h b/src/simix/io_private.h index bccaf05bcb..84556a6e6b 100644 --- a/src/simix/io_private.h +++ b/src/simix/io_private.h @@ -12,7 +12,7 @@ void SIMIX_pre_file_read(smx_req_t req); smx_action_t SIMIX_file_read(smx_process_t process, char* name); -void SIMIX_post_file_read(smx_action_t action); +void SIMIX_post_io(smx_action_t action); void SIMIX_io_destroy(smx_action_t action); void SIMIX_io_finish(smx_action_t action); diff --git a/src/simix/private.h b/src/simix/private.h index 6a9bb77808..2897aeb03e 100644 --- a/src/simix/private.h +++ b/src/simix/private.h @@ -127,8 +127,8 @@ typedef struct s_smx_action { } synchro; struct { - smx_host_t host; /* The host that is sleeping */ - surf_action_t surf_io; + smx_host_t host; + surf_action_t surf_io; } io; }; diff --git a/src/simix/smx_io.c b/src/simix/smx_io.c index f535e9c067..1d16e715f0 100644 --- a/src/simix/smx_io.c +++ b/src/simix/smx_io.c @@ -42,7 +42,7 @@ smx_action_t SIMIX_file_read(smx_process_t process, char* name) action->io.host = host; // TODO in surf model disk??? // action->io.surf_io = surf_workstation_model->extension.disk.read(host->host, name), - action->io.surf_io = surf_workstation_model->extension.workstation.sleep(host->host, 1.0); + action->io.surf_io = surf_workstation_model->extension.workstation.sleep(host->host, 1.0); surf_workstation_model->action_data_set(action->io.surf_io, action); XBT_DEBUG("Create io action %p", action); @@ -50,13 +50,10 @@ smx_action_t SIMIX_file_read(smx_process_t process, char* name) return action; } -void SIMIX_post_file_read(smx_action_t action) +void SIMIX_post_io(smx_action_t action) { - smx_req_t req; - - while ((req = xbt_fifo_shift(action->request_list))) { + switch (surf_workstation_model->action_state_get(action->io.surf_io)) { - switch(surf_workstation_model->action_state_get(action->io.surf_io)){ case SURF_ACTION_FAILED: action->state = SIMIX_FAILED; break; @@ -68,11 +65,9 @@ void SIMIX_post_file_read(smx_action_t action) default: THROW_IMPOSSIBLE; break; - } } - /* If there are requests associated with the action, then answer them */ - if (xbt_fifo_size(action->request_list)) - SIMIX_io_finish(action); + + SIMIX_io_finish(action); } void SIMIX_io_destroy(smx_action_t action) diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index bf04014bc7..86422fd2cb 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -284,8 +284,8 @@ void SIMIX_process_kill(smx_process_t process) { break; case SIMIX_ACTION_IO: - SIMIX_io_destroy(process->waiting_action); - break; + SIMIX_io_destroy(process->waiting_action); + break; } } diff --git a/src/simix/smx_smurf.c b/src/simix/smx_smurf.c index 2b77bb1f3a..6f243b5b22 100644 --- a/src/simix/smx_smurf.c +++ b/src/simix/smx_smurf.c @@ -517,6 +517,7 @@ void SIMIX_request_post(smx_action_t action) break; case SIMIX_ACTION_IO: + SIMIX_post_io(action); break; } }