From 5c24b2c48288d6078feca4e662547fc1b30eb4dd Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 19 Oct 2005 14:08:47 +0200 Subject: [PATCH] [PATCH] fio: kill unused functions (mark others static) --- fio.c | 73 ++++++++++++++++++++--------------------------------------- 1 file changed, 25 insertions(+), 48 deletions(-) diff --git a/fio.c b/fio.c index f9c001b..9056882 100644 --- a/fio.c +++ b/fio.c @@ -162,7 +162,7 @@ static struct thread_data *threads; static sem_t startup_sem; -void sig_handler(int sig) +static void sig_handler(int sig) { int i; @@ -173,7 +173,7 @@ void sig_handler(int sig) } } -int init_random_state(struct thread_data *td) +static int init_random_state(struct thread_data *td) { unsigned long seed = 123; @@ -201,7 +201,7 @@ int init_random_state(struct thread_data *td) return 0; } -void shutdown_stat_file(struct thread_data *td) +static void shutdown_stat_file(struct thread_data *td) { if (td->stat_fd != -1) { fsync(td->stat_fd); @@ -209,7 +209,7 @@ void shutdown_stat_file(struct thread_data *td) } } -int init_stat_file(struct thread_data *td) +static int init_stat_file(struct thread_data *td) { char n[256]; @@ -226,7 +226,7 @@ int init_stat_file(struct thread_data *td) return 0; } -unsigned long utime_since(struct timeval *s, struct timeval *e) +static unsigned long utime_since(struct timeval *s, struct timeval *e) { double sec, usec; @@ -242,7 +242,7 @@ unsigned long utime_since(struct timeval *s, struct timeval *e) return sec + usec; } -unsigned long mtime_since(struct timeval *s, struct timeval *e) +static unsigned long mtime_since(struct timeval *s, struct timeval *e) { double sec, usec; @@ -259,25 +259,7 @@ unsigned long mtime_since(struct timeval *s, struct timeval *e) return sec + usec; } -unsigned long time_since(struct timeval *s, struct timeval *e) -{ - double sec, usec, ret; - - sec = e->tv_sec - s->tv_sec; - usec = e->tv_usec - s->tv_usec; - if (sec > 0 && usec < 0) { - sec--; - usec += 1000000; - } - - ret = sec + usec / (double) 1000000; - if (ret < 0) - ret = 0; - - return (unsigned long) ret; -} - -unsigned long get_next_offset(struct thread_data *td) +static unsigned long get_next_offset(struct thread_data *td) { unsigned long b; long r; @@ -293,7 +275,7 @@ unsigned long get_next_offset(struct thread_data *td) return b * td->bs; } -void add_stat_sample(struct thread_data *td, unsigned long msec) +static void add_stat_sample(struct thread_data *td, unsigned long msec) { char sample[256]; @@ -320,7 +302,7 @@ void add_stat_sample(struct thread_data *td, unsigned long msec) #endif } -void usec_sleep(int usec) +static void usec_sleep(int usec) { struct timespec req = { .tv_sec = 0, .tv_nsec = usec * 1000 }; struct timespec rem; @@ -335,7 +317,7 @@ void usec_sleep(int usec) } while (1); } -void rate_throttle(struct thread_data *td, unsigned long time_spent) +static void rate_throttle(struct thread_data *td, unsigned long time_spent) { if (!td->rate) return; @@ -355,7 +337,7 @@ void rate_throttle(struct thread_data *td, unsigned long time_spent) } } -int check_min_rate(struct thread_data *td, struct timeval *now) +static int check_min_rate(struct thread_data *td, struct timeval *now) { unsigned long spent = mtime_since(&td->start, now); unsigned long rate; @@ -388,7 +370,7 @@ int check_min_rate(struct thread_data *td, struct timeval *now) #define should_fsync(td) ((td)->ddir == DDIR_WRITE && !(td)->odirect) -void do_thread_io(struct thread_data *td) +static void do_thread_io(struct thread_data *td) { struct timeval s, e; char *buffer, *ptr; @@ -465,7 +447,7 @@ void do_thread_io(struct thread_data *td) free(ptr); } -void *thread_main(int shm_id, int offset, char *argv[]) +static void *thread_main(int shm_id, int offset, char *argv[]) { struct thread_data *td; void *data; @@ -544,12 +526,12 @@ err: return NULL; } -void free_shm(void) +static void free_shm(void) { shmdt(threads); } -void show_thread_status(struct thread_data *td) +static void show_thread_status(struct thread_data *td) { int prio, prio_class; unsigned long bw = 0; @@ -563,12 +545,7 @@ void show_thread_status(struct thread_data *td) printf("thread%d (%s): err=%2d, prio=%1d/%1d maxl=%5lumsec, io=%6luMiB, bw=%6luKiB/sec\n", td->thread_number, td->ddir == DDIR_READ ? " read": "write", td->error, prio_class, prio, td->max_latency, td->io_blocks * td->bs >> 20, bw); } -void usage(char *progname) -{ - printf("%s: <-s 0/1> <-b kb> <-t sec> <-w 0/1> <-c r,w,r...> file0... fileN\n", progname); -} - -int setup_rate(struct thread_data *td) +static int setup_rate(struct thread_data *td) { int nr_reads_per_sec; @@ -586,7 +563,7 @@ int setup_rate(struct thread_data *td) return 0; } -struct thread_data *get_new_job(void) +static struct thread_data *get_new_job(void) { struct thread_data *td; @@ -616,8 +593,8 @@ static void put_job(struct thread_data *td) thread_number--; } -int add_job(struct thread_data *td, const char *filename, int prioclass, - int prio) +static int add_job(struct thread_data *td, const char *filename, int prioclass, + int prio) { strcpy(td->file_name, filename); td->stat_fd = -1; @@ -644,7 +621,7 @@ static void fill_cpu_mask(cpu_set_t cpumask, int cpu) } } -void fill_option(const char *input, char *output) +static void fill_option(const char *input, char *output) { int i; @@ -665,7 +642,7 @@ void fill_option(const char *input, char *output) * rw= * direct= */ -void parse_jobs_cmd(int argc, char *argv[], int index) +static void parse_jobs_cmd(int argc, char *argv[], int index) { struct thread_data *td; unsigned int prio, prioclass, cpu; @@ -800,7 +777,7 @@ void parse_jobs_cmd(int argc, char *argv[], int index) free(filename); } -int check_int(char *p, char *name, unsigned int *val) +static int check_int(char *p, char *name, unsigned int *val) { char str[128]; @@ -815,7 +792,7 @@ int check_int(char *p, char *name, unsigned int *val) return 1; } -int is_empty(char *line) +static int is_empty(char *line) { unsigned int i; @@ -826,7 +803,7 @@ int is_empty(char *line) return 1; } -int parse_jobs_ini(char *file) +static int parse_jobs_ini(char *file) { unsigned int prioclass, prio, cpu; struct thread_data *td; @@ -933,7 +910,7 @@ int parse_jobs_ini(char *file) return 0; } -int parse_options(int argc, char *argv[]) +static int parse_options(int argc, char *argv[]) { int i; -- 2.25.1