]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
tcm_fc: Avoid debug overhead when not debugging
authorMark Rustad <mark.d.rustad@intel.com>
Wed, 1 Aug 2012 21:51:53 +0000 (14:51 -0700)
committerNicholas Bellinger <nab@linux-iscsi.org>
Fri, 17 Aug 2012 00:33:46 +0000 (17:33 -0700)
Stop doing a pile of work related to debugging messages when
the ft_debug_logging flag is not set. Use unlikely to add the
check in a way that the check can be inlined without inlining the
whole thing.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/tcm_fc/tcm_fc.h
drivers/target/tcm_fc/tfc_cmd.c

index c5eb3c33c3dbed83db4b647c07619e44f320659f..eea69358ced3a5c8eec138eb403b2347905c801e 100644 (file)
@@ -131,6 +131,7 @@ extern struct list_head ft_lport_list;
 extern struct mutex ft_lport_lock;
 extern struct fc4_prov ft_prov;
 extern struct target_fabric_configfs *ft_configfs;
+extern unsigned int ft_debug_logging;
 
 /*
  * Fabric methods.
index b9cb5006177e22166732032468bf8d0a733299f8..823e6922249d07e3122973ebdb370cd4994704a0 100644 (file)
@@ -48,7 +48,7 @@
 /*
  * Dump cmd state for debugging.
  */
-void ft_dump_cmd(struct ft_cmd *cmd, const char *caller)
+static void _ft_dump_cmd(struct ft_cmd *cmd, const char *caller)
 {
        struct fc_exch *ep;
        struct fc_seq *sp;
@@ -80,6 +80,12 @@ void ft_dump_cmd(struct ft_cmd *cmd, const char *caller)
        }
 }
 
+void ft_dump_cmd(struct ft_cmd *cmd, const char *caller)
+{
+       if (unlikely(ft_debug_logging))
+               _ft_dump_cmd(cmd, caller);
+}
+
 static void ft_free_cmd(struct ft_cmd *cmd)
 {
        struct fc_frame *fp;