Recent changes (master)
The following changes since commit ae156be6aadb7b4ca6db8584cf5c9e957df916ed:
configure: cleanup strsep() test case (2015-08-18 11:26:00 -0700)
are available in the git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to c6d140fb8c0cf58d61bbd42ea5382f42d3b8fa20:
Fix aux_path for verify state saving (2015-08-21 11:09:03 -0700)
----------------------------------------------------------------
Jens Axboe (4):
README: update for trigger options
Add --aux-path support
parse: only print option mismatch help, if the distance is close enough Fix aux_path for verify state saving
README | 5 +++++ backend.c | 14 +++----------- client.c | 10 ++++++++-- fio.h | 1 + init.c | 15 ++++++++++++++- options.c | 2 +- parse.c | 13 +++++++++++++ parse.h | 1 + verify.c | 20 +++++++++++++++----- verify.h | 2 +- 10 files changed, 62 insertions(+), 21 deletions(-)
---
Diff of recent changes:
README +5 -0
@@ -179,6 +179,11 @@ $ fio (option=system,percpu) or run unit work calibration only (option=calibrate). --inflate-log=log Inflate and output compressed log + --trigger-file=file Execute trigger cmd when file exists + --trigger-timeout=t Execute trigger af this time + --trigger=cmd Set this command as local trigger + --trigger-remote=cmd Set this command as remote trigger + --aux-path=path Use this path for fio state generated files Any parameters following the options will be assumed to be job files,
backend.c +3 -11
@@ -1638,16 +1638,8 @@ static void *thread_main(void *data) td->ts.io_bytes[DDIR_TRIM ] = td->io_bytes[DDIR_TRIM ];if (td->o.verify_state_save && !(td->flags &TD_F_VSTATE_SAVED ) && - (td->o.verify !=VERIFY_NONE &&td_write (td))) { -struct all_io_list *state; -size_t sz; - - state =get_all_io_list (td->thread_number, &sz); -if (state) { -__verify_save_state (state,"local" ); -free (state); - } - } + (td->o.verify !=VERIFY_NONE &&td_write (td))) +verify_save_state (td->thread_number);fio_unpin_memory (td);
@@ -1897,7 +1889,7 @@ void check_trigger_file(void)if (nr_clients)fio_clients_send_trigger (trigger_remote_cmd);else { -verify_save_state (); +verify_save_state (IO_LIST_ALL );fio_terminate_threads (TERMINATE_ALL );exec_trigger (trigger_cmd); }
client.c +8 -2
@@ -1497,9 +1497,15 @@ int fio_handle_client(struct fio_client *client)break ;case FIO_NET_CMD_VTRIGGER : {struct all_io_list *pdu = (struct all_io_list *) cmd->payload; -char buf[64 ]; +char buf[128 ]; +int off =0 ; -__verify_save_state (pdu,server_name (client, buf,sizeof (buf))); +if (aux_path) { +strcpy (buf, aux_path); + off =strlen (buf); + } + +__verify_save_state (pdu,server_name (client, &buf[off],sizeof (buf) - off));exec_trigger (trigger_cmd);break ; }
fio.h +1 -0
@@ -434,6 +434,7 @@ extern char *trigger_file;extern char *trigger_cmd;extern char *trigger_remote_cmd;extern long long trigger_timeout; +extern char *aux_path;extern struct thread_data *threads;
init.c +14 -1
@@ -69,6 +69,8 @@ long long trigger_timeout = 0;char *trigger_cmd =NULL ;char *trigger_remote_cmd =NULL ; +char *aux_path =NULL ; +static int prev_group_jobs;unsigned long fio_debug =0 ;
@@ -267,6 +269,11 @@ static struct option l_opts[FIO_NR_OPTIONS] = { .val = 'J', }, { + .name = (char *) "aux-path", + .has_arg = required_argument, + .val = 'K', + }, + { .name = NULL, }, };
@@ -1793,6 +1800,7 @@ static void usage(const char *name)printf (" --trigger-timeout=t\tExecute trigger af this time\n" );printf (" --trigger=cmd\t\tSet this command as local trigger\n" );printf (" --trigger-remote=cmd\tSet this command as remote trigger\n" ); +printf (" --aux-path=path\tUse this path for fio state generated files\n" );printf ("\nFio was written by Jens Axboe <[email protected]>" );printf ("\n Jens Axboe <[email protected]>" );printf ("\n Jens Axboe <[email protected]>\n" );
@@ -1990,7 +1998,7 @@ static void show_closest_option(const char *name) i++; } -if (best_option !=-1 ) +if (best_option !=-1 &&string_distance_ok (name, best_distance))log_err ("Did you mean %s?\n" , l_opts[best_option].name); }
@@ -2383,6 +2391,11 @@ int parse_cmd_line(int argc, char *argv[], int client_type)free (trigger_remote_cmd); trigger_remote_cmd =strdup (optarg);break ; +case 'K' : +if (aux_path) +free (aux_path); + aux_path =strdup (optarg); +break ;case 'B' :if (check_str_time (optarg, &trigger_timeout,1 )) {log_err ("fio: failed parsing time %s\n" , optarg);
options.c +1 -1
@@ -4093,7 +4093,7 @@ static void show_closest_option(const char *opt) i++; } -if (best_option !=-1 ) +if (best_option !=-1 &&string_distance_ok (name, best_distance))log_err ("Did you mean %s?\n" , fio_options[best_option].name);free (name);
parse.c +13 -0
@@ -1061,6 +1061,19 @@ int string_distance(const char *s1, const char *s2)return i; } +/* +* Make a guess of whether the distance from 's1' is significant enough +* to warrant printing the guess. We set this to a 1/2 match. +*/ +int string_distance_ok (const char *opt,int distance) +{ +size_t len; + + len =strlen (opt); + len = (len +1 ) /2 ; +return distance <= len; +} +static struct fio_option *find_child (struct fio_option *options,struct fio_option *o) {
parse.h +1 -0
@@ -97,6 +97,7 @@ extern int check_str_time(const char *p, long long *val, int);extern int str_to_float (const char *str,double *val,int is_time);extern int string_distance (const char *s1,const char *s2); +extern int string_distance_ok (const char *s1,int dist);/* * Handlers for the options
verify.c +15 -5
@@ -231,8 +231,11 @@ static void dump_buf(char *buf, unsigned int len, unsigned long long offset, ptr =strdup (f->file_name); - fname[DUMP_BUF_SZ -1 ] ='\0' ; -strncpy (fname,basename (ptr),DUMP_BUF_SZ -1 ); +memset (fname,0 ,sizeof (fname)); +if (aux_path) +sprintf (fname,"%s%s" , aux_path,FIO_OS_PATH_SEPARATOR ); + +strncpy (fname +strlen (fname),basename (ptr), buf_left -1 ); buf_left -=strlen (fname);if (buf_left <=0 ) {
@@ -1477,14 +1480,21 @@ void __verify_save_state(struct all_io_list *state, const char *prefix) } } -void verify_save_state (void ) +void verify_save_state (int mask) {struct all_io_list *state;size_t sz; - state =get_all_io_list (IO_LIST_ALL , &sz); + state =get_all_io_list (mask, &sz);if (state) { -__verify_save_state (state,"local" ); +char prefix[PATH_MAX ]; + +if (aux_path) +sprintf (prefix,"%s%slocal" , aux_path,FIO_OS_PATH_SEPARATOR ); +else +strcpy (prefix,"local" ); + +__verify_save_state (state, prefix);free (state); } }
verify.h +1 -1
@@ -145,7 +145,7 @@ struct verify_state_hdr {#define IO_LIST_ALL 0xffffffffextern struct all_io_list *get_all_io_list (int ,size_t *);extern void __verify_save_state (struct all_io_list *,const char *); -extern void verify_save_state (void ); +extern void verify_save_state (int mask);extern int verify_load_state (struct thread_data *,const char *);extern void verify_free_state (struct thread_data *);extern int verify_state_should_stop (struct thread_data *,struct io_u *);