diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2020-08-18 12:50:23 +0300 |
---|---|---|
committer | Amar Tumballi <amar@kadalu.io> | 2020-08-21 14:05:13 +0000 |
commit | 9bca9a0b42f888cb88cedc848d471dd32a6f62d0 (patch) | |
tree | f4e71119bdf00a3e002f31880bc3272db281e0d8 /xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.h | |
parent | e9fbaeaf5aefa73dce1833890764130c561a5e8a (diff) |
features/bit-rot: simplify and cleanup internal time management
Since this xlator measures time intervals in seconds, gettimeofday() may
be replaced with simpler gf_time(). Adjust comments and style as well.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Change-Id: I2e5900ccb5da2478656d80e5f570487e3ba70966
Updates: #1002
Diffstat (limited to 'xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.h')
-rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.h b/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.h index 24128b90a66..f022aa831eb 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.h +++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.h @@ -15,20 +15,22 @@ #include <sys/time.h> #include <pthread.h> +#include <glusterfs/common-utils.h> + struct br_scrub_stats { - uint64_t scrubbed_files; /* Total number of scrubbed file */ + uint64_t scrubbed_files; /* Total number of scrubbed files. */ - uint64_t unsigned_files; /* Total number of unsigned file */ + uint64_t unsigned_files; /* Total number of unsigned files. */ - uint64_t scrub_duration; /* Duration of last scrub */ + uint64_t scrub_duration; /* Duration of last scrub. */ - char last_scrub_time[1024]; /*last scrub completion time */ + char last_scrub_time[GF_TIMESTR_SIZE]; /* Last scrub completion time. */ - struct timeval scrub_start_tv; /* Scrubbing starting time*/ + time_t scrub_start_time; /* Scrubbing starting time. */ - struct timeval scrub_end_tv; /* Scrubbing finishing time */ + time_t scrub_end_time; /* Scrubbing finishing time. */ - int8_t scrub_running; /* Scrub running or not */ + int8_t scrub_running; /* Whether scrub running or not. */ pthread_mutex_t lock; }; @@ -40,9 +42,9 @@ br_inc_unsigned_file_count(br_scrub_stats_t *scrub_stat); void br_inc_scrubbed_file(br_scrub_stats_t *scrub_stat); void -br_update_scrub_start_time(br_scrub_stats_t *scrub_stat, struct timeval *tv); +br_update_scrub_start_time(br_scrub_stats_t *scrub_stat, time_t time); void br_update_scrub_finish_time(br_scrub_stats_t *scrub_stat, char *timestr, - struct timeval *tv); + time_t time); #endif /* __BIT_ROT_SCRUB_STATUS_H__ */ |