diff --git a/f3read.c b/f3read.c index 065a970..7537b2e 100644 --- a/f3read.c +++ b/f3read.c @@ -192,7 +192,7 @@ static ssize_t read_all(int fd, char *buf, size_t count) } static ssize_t check_chunk(int fd, uint64_t *p_expected_offset, - size_t chunk_size, struct file_stats *stats) + uint64_t chunk_size, struct file_stats *stats) { char buf[MAX_BUFFER_SIZE]; ssize_t tot_bytes_read = 0; diff --git a/f3write.c b/f3write.c index b7e1a4a..20e30dc 100644 --- a/f3write.c +++ b/f3write.c @@ -203,7 +203,7 @@ static int create_and_fill_file(const char *path, long number, size_t size, remaining = size; start_measurement(fw); while (remaining > 0) { - size_t write_size = get_rem_chunk_size(fw); + uint64_t write_size = get_rem_chunk_size(fw); if (write_size > remaining) write_size = remaining; saved_errno = write_chunk(fd, write_size, &offset); diff --git a/libflow.c b/libflow.c index 7177c35..89ac5cf 100644 --- a/libflow.c +++ b/libflow.c @@ -244,7 +244,7 @@ static inline uint64_t diff_timeval_us(const struct timeval *t1, t2->tv_usec - t1->tv_usec; } -int measure(int fd, struct flow *fw, ssize_t processed) +int measure(int fd, struct flow *fw, long processed) { ldiv_t result = ldiv(processed, fw->block_size); struct timeval t2; diff --git a/libflow.h b/libflow.h index cc3ca98..8dee7d9 100644 --- a/libflow.h +++ b/libflow.h @@ -63,7 +63,7 @@ void init_flow(struct flow *fw, uint64_t total_size, flow_func_flush_chunk_t func_flush_chunk); void start_measurement(struct flow *fw); -int measure(int fd, struct flow *fw, ssize_t processed); +int measure(int fd, struct flow *fw, long processed); int end_measurement(int fd, struct flow *fw); static inline int has_enough_measurements(const struct flow *fw) @@ -84,12 +84,10 @@ static inline double get_avg_speed(struct flow *fw) return get_avg_speed_given_time(fw, fw->measured_time_ms); } -static inline size_t get_rem_chunk_size(struct flow *fw) +static inline uint64_t get_rem_chunk_size(struct flow *fw) { - ssize_t ret = (fw->blocks_per_delay - fw->processed_blocks) * - fw->block_size; - assert(ret > 0); - return ret; + assert(fw->blocks_per_delay > fw->processed_blocks); + return (fw->blocks_per_delay - fw->processed_blocks) * fw->block_size; } #define MAX_BUFFER_SIZE (1<<21) /* 2MB */