diff options
Diffstat (limited to 'libglusterfs/src')
| -rw-r--r-- | libglusterfs/src/common-utils.c | 37 | ||||
| -rw-r--r-- | libglusterfs/src/common-utils.h | 3 | 
2 files changed, 40 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 3a2e557c62b..606dda9b9a5 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -3391,3 +3391,40 @@ gf_backtrace_save (char *buf)          gf_log (THIS->name, GF_LOG_WARNING, "Failed to save the backtrace.");          return NULL;  } + +gf_loglevel_t +fop_log_level (glusterfs_fop_t fop, int op_errno) +{ +        /* if gfid doesn't exist ESTALE comes */ +        if (op_errno == ENOENT || op_errno == ESTALE) +                return GF_LOG_DEBUG; + +        if ((fop == GF_FOP_ENTRYLK) || +            (fop == GF_FOP_FENTRYLK) || +            (fop == GF_FOP_FINODELK) || +            (fop == GF_FOP_INODELK) || +            (fop == GF_FOP_LK)) { +                /* +                 * if non-blocking lock fails EAGAIN comes +                 * if locks xlator is not loaded ENOSYS comes +                 */ +                if (op_errno == EAGAIN || op_errno == ENOSYS) +                        return GF_LOG_DEBUG; +        } + +        if ((fop == GF_FOP_GETXATTR) || +            (fop == GF_FOP_FGETXATTR)) { +                if (op_errno == ENOTSUP || op_errno == ENODATA) +                        return GF_LOG_DEBUG; +        } + +        if ((fop == GF_FOP_SETXATTR) || +            (fop == GF_FOP_FSETXATTR) || +            (fop == GF_FOP_REMOVEXATTR) || +            (fop == GF_FOP_FREMOVEXATTR)) { +                if (op_errno == ENOTSUP) +                        return GF_LOG_DEBUG; +        } + +        return GF_LOG_ERROR; +} diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index a669e741e9a..0d5abb42ec2 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -650,4 +650,7 @@ gf_backtrace_save (char *buf);  void  gf_backtrace_done (char *buf); + +gf_loglevel_t +fop_log_level (glusterfs_fop_t fop, int op_errno);  #endif /* _COMMON_UTILS_H */  | 
