diff options
author | Atin Mukherjee <amukherj@redhat.com> | 2019-04-02 10:45:15 +0530 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2019-04-08 14:15:36 +0000 |
commit | 3687004516e0fc42f1c21f38407d4def7298d6cd (patch) | |
tree | afa7c354f6a7e309d698dec33a4b4ede1cf14274 | |
parent | 1fba86169b0850c3fcd02e56d0ddbba3efe9ae78 (diff) |
logging: Fix GF_LOG_OCCASSIONALLY API
GF_LOG_OCCASSIONALLY doesn't log on the first instance rather at every
42nd iterations which isn't effective as in some cases we might not have
the code flow hitting the same log for as many as 42 times and we'd end
up suppressing the log.
Fixes: bz#1695391
Change-Id: Iee293281d25a652b64df111d59b13de4efce06fa
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
(cherry picked from commit d0d3e10d44366c68fc153e48b229e72a4aa26e61)
-rw-r--r-- | libglusterfs/src/logging.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libglusterfs/src/logging.h b/libglusterfs/src/logging.h index 859050d568b..64ebdcc54b8 100644 --- a/libglusterfs/src/logging.h +++ b/libglusterfs/src/logging.h @@ -300,7 +300,7 @@ _gf_log_eh(const char *function, const char *fmt, ...) /* Log once in GF_UNIVERSAL_ANSWER times */ #define GF_LOG_OCCASIONALLY(var, args...) \ - if (!(var++ % GF_UNIVERSAL_ANSWER)) { \ + if (var++ == 0 || !((var - 1) % GF_UNIVERSAL_ANSWER)) { \ gf_log(args); \ } |