Whamcloud - gitweb
LU-9859 libcfs: change libcfs_log_* functions to inline 81/44581/3
authorJames Simmons <jsimmons@infradead.org>
Tue, 10 Aug 2021 18:05:31 +0000 (14:05 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 11 Sep 2021 06:21:04 +0000 (06:21 +0000)
The functions libcfs_log_return() and libcfs_log_goto() don't
exist in the native Linux client. We still need them for the
special OpenSFS debugging but we can change those functions
to simple inline routines since they are just wrappers
around libcfs_debug_msg().

Test-Parameters: trivial
Change-Id: I0e2b40feb18f9f1a1ffbda39756ab64308ea6439
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/44581
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Aurelien Degremont <degremoa@amazon.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/libcfs_debug.h
libcfs/libcfs/debug.c

index 19466e9..662d290 100644 (file)
@@ -212,10 +212,32 @@ static inline int cfs_cdebug_show(unsigned int mask, unsigned int subsystem)
 #define LCONSOLE_EMERG(format, ...) \
        CDEBUG(D_CONSOLE | D_EMERG, format, ## __VA_ARGS__)
 
+int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata,
+                    const char *format1, ...)
+       __printf(2, 3);
+
+/* other external symbols that tracefile provides: */
+int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,
+                            const char *knl_buffer, char *append);
+
+#define LIBCFS_DEBUG_FILE_PATH_DEFAULT "/tmp/lustre-log"
+
 #if defined(CDEBUG_ENTRY_EXIT)
 
-void libcfs_log_goto(struct libcfs_debug_msg_data *goto_data,
-                    const char *label, long rc);
+static inline long libcfs_log_return(struct libcfs_debug_msg_data *msgdata, long rc)
+{
+       libcfs_debug_msg(msgdata, "Process leaving (rc=%lu : %ld : %lx)\n",
+                        rc, rc, rc);
+       return rc;
+}
+
+static inline void libcfs_log_goto(struct libcfs_debug_msg_data *msgdata,
+                                  const char *label, long rc)
+{
+       libcfs_debug_msg(msgdata,
+                        "Process leaving via %s (rc=%lu : %ld : %#lx)\n",
+                        label, rc, rc, rc);
+}
 
 # define GOTO(label, rc)                                                     \
 do {                                                                         \
@@ -229,8 +251,6 @@ do {                                                                              \
        goto label;                                                           \
 } while (0)
 
-
-long libcfs_log_return(struct libcfs_debug_msg_data *, long rc);
 # if BITS_PER_LONG > 32
 #  define RETURN(rc)                                                         \
 do {                                                                         \
@@ -285,16 +305,6 @@ do {                                                                       \
        return;                                                         \
 } while (0)
 
-int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata,
-                    const char *format1, ...)
-       __printf(2, 3);
-
-/* other external symbols that tracefile provides: */
-int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,
-                            const char *knl_buffer, char *append);
-
-#define LIBCFS_DEBUG_FILE_PATH_DEFAULT "/tmp/lustre-log"
-
 void cfs_debug_init(void);
 
 #endif /* __LIBCFS_DEBUG_H__ */
index 10e3eee..32090f2 100644 (file)
@@ -730,19 +730,3 @@ int libcfs_debug_mark_buffer(const char *text)
 
 #undef DEBUG_SUBSYSTEM
 #define DEBUG_SUBSYSTEM S_LNET
-
-long libcfs_log_return(struct libcfs_debug_msg_data *msgdata, long rc)
-{
-       libcfs_debug_msg(msgdata, "Process leaving (rc=%lu : %ld : %lx)\n",
-                        rc, rc, rc);
-       return rc;
-}
-EXPORT_SYMBOL(libcfs_log_return);
-
-void libcfs_log_goto(struct libcfs_debug_msg_data *msgdata, const char *label,
-                    long rc)
-{
-       libcfs_debug_msg(msgdata, "Process leaving via %s (rc=%lu : %ld"
-                        " : %#lx)\n", label, rc, rc, rc);
-}
-EXPORT_SYMBOL(libcfs_log_goto);