job.cc (fstransform-0.9.3-src) | : | job.cc (fstransform-0.9.4) | ||
---|---|---|---|---|
skipping to change at line 46 | skipping to change at line 46 | |||
# include <cstdlib> // for malloc(), free(), getenv() | # include <cstdlib> // for malloc(), free(), getenv() | |||
#endif | #endif | |||
#if defined(FT_HAVE_STRING_H) | #if defined(FT_HAVE_STRING_H) | |||
# include <string.h> // for memcpy() | # include <string.h> // for memcpy() | |||
#elif defined(FT_HAVE_CSTRING) | #elif defined(FT_HAVE_CSTRING) | |||
# include <cstring> // for memcpy() | # include <cstring> // for memcpy() | |||
#endif | #endif | |||
#include "args.hh" // for FC_JOB_ID_AUTODETECT | #include "args.hh" // for FC_JOB_ID_AUTODETECT | |||
#include "job.hh" // for fr_job | #include "job.hh" // for fr_job | |||
#include "io/util.hh" // for ff_mkdir() | #include "io/util_dir.hh" // for ff_mkdir() | |||
FT_NAMESPACE_BEGIN | FT_NAMESPACE_BEGIN | |||
/** default constructor */ | /** default constructor */ | |||
fr_job::fr_job() | fr_job::fr_job() | |||
: this_dir(), this_log_file(NULL), this_log_appender(NULL), | : this_dir(), this_log_file(NULL), this_log_appender(NULL), | |||
this_id(FC_JOB_ID_AUTODETECT), this_clear(FC_CLEAR_AUTODETECT), | this_id(FC_JOB_ID_AUTODETECT), this_clear(FC_CLEAR_AUTODETECT), | |||
this_force_run(false), this_simulate_run(false), this_resume_job(false), thi s_ask_questions(true) | this_force_run(false), this_simulate_run(false), this_resume_job(false), thi s_ask_questions(false) | |||
{ | { | |||
for (ft_size i = 0; i < FC_STORAGE_SIZE_N; i++) | for (ft_size i = 0; i < FC_STORAGE_SIZE_N; i++) | |||
this_storage_size[i] = 0; | this_storage_size[i] = 0; | |||
} | } | |||
/** destructor. calls quit() */ | /** destructor. calls quit() */ | |||
fr_job::~fr_job() | fr_job::~fr_job() | |||
{ | { | |||
quit(); | quit(); | |||
} | } | |||
skipping to change at line 101 | skipping to change at line 101 | |||
if (this_resume_job) | if (this_resume_job) | |||
/* force job_id */ | /* force job_id */ | |||
job_min = args.job_id, job_max = args.job_id + 1; | job_min = args.job_id, job_max = args.job_id + 1; | |||
path = this_dir.c_str(); | path = this_dir.c_str(); | |||
for (i = job_min; i != job_max; i++) { | for (i = job_min; i != job_max; i++) { | |||
// 1 + 3*sizeof(ft_uint) chars are enough to safely print (ft_uint) | // 1 + 3*sizeof(ft_uint) chars are enough to safely print (ft_uint) | |||
this_dir.resize(len + 2 + 3*sizeof(ft_uint)); | this_dir.resize(len + 2 + 3*sizeof(ft_uint)); | |||
sprintf(& this_dir[len], "%"FT_ULL, (ft_ull) i); | sprintf(& this_dir[len], "%" FT_ULL , (ft_ull) i); | |||
this_dir.resize(len + strlen(& this_dir[len])); | this_dir.resize(len + strlen(& this_dir[len])); | |||
path = this_dir.c_str(); | path = this_dir.c_str(); | |||
if (!this_resume_job) | if (!this_resume_job) | |||
err = FT_IO_NS ff_mkdir(path); | err = FT_IO_NS ff_mkdir(path); | |||
if (err == 0 && (err = init_log()) == 0) { | if (err == 0 && (err = init_log()) == 0) { | |||
ff_log(FC_NOTICE, 0, "fsremap: %s job %"FT_ULL", persistence data an d logs are in '%s'", | ff_log(FC_NOTICE, 0, "fsremap: %s job %" FT_ULL ", persistence data and logs are in '%s'", | |||
this_resume_job ? "resuming" : "starting", (ft_ull)i, path); | this_resume_job ? "resuming" : "starting", (ft_ull)i, path); | |||
if (!this_resume_job) { | if (!this_resume_job && !this_simulate_run && args.io_kind != FC_IO_ SELF_TEST) { | |||
ff_log(FC_NOTICE, 0, "if this job is interrupted, for example by a power failure,"); | ff_log(FC_NOTICE, 0, "if this job is interrupted, for example by a power failure,"); | |||
ff_log(FC_NOTICE, 0, "you CAN RESUME it with: %s%s -q --resume-j ob=%"FT_ULL" -- %s", | ff_log(FC_NOTICE, 0, "you CAN RESUME it with: %s%s -q --resume-j ob=%" FT_ULL " -- %s", | |||
args.program_name, this_simulate_run ? " -n" : "", (ft_ul l)i, args.io_args[0]); | args.program_name, this_simulate_run ? " -n" : "", (ft_ul l)i, args.io_args[0]); | |||
} | } | |||
break; | break; | |||
} | } | |||
} | } | |||
if (i == job_max) { | if (i == job_max) { | |||
if (this_resume_job) | if (this_resume_job) | |||
err = ff_log(FC_ERROR, err, "failed to resume job id %"FT_ULL " from directory '%s'", (ft_ull) args.job_id, path); | err = ff_log(FC_ERROR, err, "failed to resume job id %" FT_ULL " fr om directory '%s'", (ft_ull) args.job_id, path); | |||
else | else | |||
err = ff_log(FC_ERROR, err, "failed to locate a free job id, tried r ange %"FT_ULL"...%"FT_ULL, (ft_ull) job_min, (ft_ull) (job_max-1)); | err = ff_log(FC_ERROR, err, "failed to locate a free job id, tried r ange %" FT_ULL "...%" FT_ULL , (ft_ull) job_min, (ft_ull) (job_max-1)); | |||
} | } | |||
if (err != 0) { | if (err != 0) { | |||
quit(); | quit(); | |||
return err; | return err; | |||
} | } | |||
for (ft_size l = 0; l < FC_STORAGE_SIZE_N; l++) | for (ft_size l = 0; l < FC_STORAGE_SIZE_N; l++) | |||
this_storage_size[l] = args.storage_size[l]; | this_storage_size[l] = args.storage_size[l]; | |||
this_id = i; | this_id = i; | |||
this_clear = args.job_clear; | this_clear = args.job_clear; | |||
End of changes. 8 change blocks. | ||||
8 lines changed or deleted | 8 lines changed or added |