linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iscsi: Kconfig option for debug prints.
@ 2009-01-12 15:33 Boaz Harrosh
  2009-01-12 15:38 ` Boaz Harrosh
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Boaz Harrosh @ 2009-01-12 15:33 UTC (permalink / raw)
  To: Mike Christie, open-iscsi; +Cc: linux-scsi


Remove the dark ages /* define debug_print */ in code, to use
a Kconfig option. With a system like Kconfig, in code, commented out,
configuration options are slavery and hard work.
(version control, manual edit ... need I say more)

I've used an "int" config bit-mask so more areas of code can be
selected with one Koption, but mainly so that allmodconfig will
not turn it on.

bit-1 - will turn on prints for libiscsi.
bit-2 - will turn on prints for libiscsi_tcp & iscsi_tcp.

More iscsi drivers should use more bits.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 drivers/scsi/Kconfig        |   15 +++++++++++++++
 drivers/scsi/iscsi_tcp.c    |    7 -------
 drivers/scsi/iscsi_tcp.h    |    6 ++++++
 drivers/scsi/libiscsi_tcp.c |    7 -------
 include/scsi/libiscsi.h     |    3 +--
 5 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index d25d21e..6ef42f6 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -352,6 +352,21 @@ config ISCSI_TCP
 
 	 http://open-iscsi.org
 
+config ISCSI_DEBUG
+	int "ISCSI debug prints"
+	depends on SCSI_ISCSI_ATTRS
+	default 0
+	help
+	  This is a bit-mask that turns some debug printing to Kernel's
+	  Messages file. Each bit turns on another area of the code:
+	  1 - Turn on prints from iscsi libraries.
+	  2 - Turns on prints from iscsi_tcp operations.
+	  Note to programmers: Use more bits in this bit-mask for other iscsi
+	  drivers.
+	  If you found a problem with ISCSI, please turn this on to
+	  help us debug the problem. Send the Messages file plus problem
+	  description to open-iscsi@googlegroups.com mailing-list
+
 source "drivers/scsi/cxgb3i/Kconfig"
 
 config SGIWD93_SCSI
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index a566aa9..af092a8 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -48,13 +48,6 @@ MODULE_AUTHOR("Mike Christie <michaelc@cs.wisc.edu>, "
 	      "Alex Aizman <itn780@yahoo.com>");
 MODULE_DESCRIPTION("iSCSI/TCP data-path");
 MODULE_LICENSE("GPL");
-#undef DEBUG_TCP
-
-#ifdef DEBUG_TCP
-#define debug_tcp(fmt...) printk(KERN_INFO "tcp: " fmt)
-#else
-#define debug_tcp(fmt...)
-#endif
 
 static struct scsi_transport_template *iscsi_sw_tcp_scsi_transport;
 static struct scsi_host_template iscsi_sw_tcp_sht;
diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h
index ca6b7bc..1341b02 100644
--- a/drivers/scsi/iscsi_tcp.h
+++ b/drivers/scsi/iscsi_tcp.h
@@ -25,6 +25,12 @@
 #include <scsi/libiscsi.h>
 #include <scsi/libiscsi_tcp.h>
 
+#if (CONFIG_ISCSI_DEBUG & 2)
+#define debug_tcp(fmt...) printk(KERN_INFO "tcp: " fmt)
+#else
+#define debug_tcp(fmt...)
+#endif
+
 struct socket;
 struct iscsi_tcp_conn;
 
diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c
index 12354c5..4c9f827 100644
--- a/drivers/scsi/libiscsi_tcp.c
+++ b/drivers/scsi/libiscsi_tcp.c
@@ -49,13 +49,6 @@ MODULE_AUTHOR("Mike Christie <michaelc@cs.wisc.edu>, "
 	      "Alex Aizman <itn780@yahoo.com>");
 MODULE_DESCRIPTION("iSCSI/TCP data-path");
 MODULE_LICENSE("GPL");
-#undef DEBUG_TCP
-
-#ifdef DEBUG_TCP
-#define debug_tcp(fmt...) printk(KERN_INFO "tcp: " fmt)
-#else
-#define debug_tcp(fmt...)
-#endif
 
 static int iscsi_tcp_hdr_recv_done(struct iscsi_tcp_conn *tcp_conn,
 				   struct iscsi_segment *segment);
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 7360e19..2421c2a 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -45,8 +45,7 @@ struct iscsi_session;
 struct iscsi_nopin;
 struct device;
 
-/* #define DEBUG_SCSI */
-#ifdef DEBUG_SCSI
+#if (CONFIG_ISCSI_DEBUG & 1)
 #define debug_scsi(fmt...) printk(KERN_INFO "iscsi: " fmt)
 #else
 #define debug_scsi(fmt...)
-- 
1.6.0.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] iscsi: Kconfig option for debug prints.
  2009-01-12 15:33 [PATCH] iscsi: Kconfig option for debug prints Boaz Harrosh
@ 2009-01-12 15:38 ` Boaz Harrosh
  2009-01-12 15:59   ` Mike Christie
       [not found] ` <496B62B8.3030402-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
  2009-01-12 16:58 ` Randy Dunlap
  2 siblings, 1 reply; 8+ messages in thread
From: Boaz Harrosh @ 2009-01-12 15:38 UTC (permalink / raw)
  To: Mike Christie; +Cc: open-iscsi, linux-scsi

Boaz Harrosh wrote:
> 
> Remove the dark ages /* define debug_print */ in code, to use
> a Kconfig option. With a system like Kconfig, in code, commented out,
> configuration options are slavery and hard work.
> (version control, manual edit ... need I say more)
> 
> I've used an "int" config bit-mask so more areas of code can be
> selected with one Koption, but mainly so that allmodconfig will
> not turn it on.
> 
> bit-1 - will turn on prints for libiscsi.
> bit-2 - will turn on prints for libiscsi_tcp & iscsi_tcp.
> 
> More iscsi drivers should use more bits.
> 
> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
> ---
>  drivers/scsi/Kconfig        |   15 +++++++++++++++
>  drivers/scsi/iscsi_tcp.c    |    7 -------
>  drivers/scsi/iscsi_tcp.h    |    6 ++++++
>  drivers/scsi/libiscsi_tcp.c |    7 -------
>  include/scsi/libiscsi.h     |    3 +--
>  5 files changed, 22 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig

Mike hi.

These are over latest Linus. Sorry I mixed up the branches.
If they don't apply to your tree any more, I'll rebase.

I'm sending these because for too many times I submit some code
with iscsi sources edits, because I forget to remove the edits
for enabling prints. Please consider for inclusion.

Thanks
Boaz

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] iscsi: Kconfig option for debug prints.
       [not found] ` <496B62B8.3030402-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
@ 2009-01-12 15:39   ` Ulrich Windl
  2009-01-12 15:43     ` Boaz Harrosh
  0 siblings, 1 reply; 8+ messages in thread
From: Ulrich Windl @ 2009-01-12 15:39 UTC (permalink / raw)
  To: open-iscsi-/JYPxA39Uh5TLH3MbocFFw; +Cc: linux-scsi


On 12 Jan 2009 at 17:33, Boaz Harrosh wrote:

> --- a/drivers/scsi/iscsi_tcp.h
> +++ b/drivers/scsi/iscsi_tcp.h
> @@ -25,6 +25,12 @@
>  #include <scsi/libiscsi.h>
>  #include <scsi/libiscsi_tcp.h>
>  
> +#if (CONFIG_ISCSI_DEBUG & 2)
> +#define debug_tcp(fmt...) printk(KERN_INFO "tcp: " fmt)
> +#else
> +#define debug_tcp(fmt...)
> +#endif
> +

Hi!

Let me say that I feel that "tcp:" should be something like "iSCSI-TCP:", just to 
point out that it's related to iSCSI.

Regards,
Ulrich

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] iscsi: Kconfig option for debug prints.
  2009-01-12 15:39   ` Ulrich Windl
@ 2009-01-12 15:43     ` Boaz Harrosh
  0 siblings, 0 replies; 8+ messages in thread
From: Boaz Harrosh @ 2009-01-12 15:43 UTC (permalink / raw)
  To: open-iscsi; +Cc: linux-scsi

Ulrich Windl wrote:
> On 12 Jan 2009 at 17:33, Boaz Harrosh wrote:
> 
>> --- a/drivers/scsi/iscsi_tcp.h
>> +++ b/drivers/scsi/iscsi_tcp.h
>> @@ -25,6 +25,12 @@
>>  #include <scsi/libiscsi.h>
>>  #include <scsi/libiscsi_tcp.h>
>>  
>> +#if (CONFIG_ISCSI_DEBUG & 2)
>> +#define debug_tcp(fmt...) printk(KERN_INFO "tcp: " fmt)
>> +#else
>> +#define debug_tcp(fmt...)
>> +#endif
>> +
> 
> Hi!
> 
> Let me say that I feel that "tcp:" should be something like "iSCSI-TCP:", just to 
> point out that it's related to iSCSI.
> 
> Regards,
> Ulrich
> 
> 

This is unrelated to this patch. If so, it should be in another, additional patch.
I think we don't need to bother because these are in headers private to iscsi and
should never be included by any other code.

But Mike if you want I can send search-replace patch for debug_tcp/debug_scsi macros.
What do you prefer?

Thanks
Boaz

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] iscsi: Kconfig option for debug prints.
  2009-01-12 15:38 ` Boaz Harrosh
@ 2009-01-12 15:59   ` Mike Christie
       [not found]     ` <496B68F8.3070103-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Christie @ 2009-01-12 15:59 UTC (permalink / raw)
  To: open-iscsi; +Cc: linux-scsi

[-- Attachment #1: Type: text/plain, Size: 1797 bytes --]

Boaz Harrosh wrote:
> Boaz Harrosh wrote:
>> Remove the dark ages /* define debug_print */ in code, to use
>> a Kconfig option. With a system like Kconfig, in code, commented out,
>> configuration options are slavery and hard work.
>> (version control, manual edit ... need I say more)
>>
>> I've used an "int" config bit-mask so more areas of code can be
>> selected with one Koption, but mainly so that allmodconfig will
>> not turn it on.
>>
>> bit-1 - will turn on prints for libiscsi.
>> bit-2 - will turn on prints for libiscsi_tcp & iscsi_tcp.
>>
>> More iscsi drivers should use more bits.
>>
>> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
>> ---
>>  drivers/scsi/Kconfig        |   15 +++++++++++++++
>>  drivers/scsi/iscsi_tcp.c    |    7 -------
>>  drivers/scsi/iscsi_tcp.h    |    6 ++++++
>>  drivers/scsi/libiscsi_tcp.c |    7 -------
>>  include/scsi/libiscsi.h     |    3 +--
>>  5 files changed, 22 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
> 
> Mike hi.
> 
> These are over latest Linus. Sorry I mixed up the branches.
> If they don't apply to your tree any more, I'll rebase.
> 

It applies ok.

> I'm sending these because for too many times I submit some code
> with iscsi sources edits, because I forget to remove the edits
> for enabling prints. Please consider for inclusion.
> 

What about compile time vs load time? Olaf had the attached patch which 
does it at module load time. It is nicer for users, but I was just 
worried about maybe there being a perf change with all the new ifs? I 
was waiting to do some testing to see if there was and change, but did 
not get around to it. Is that too paranoid (probably other factors like 
our crappy locking will slow us down more than some ifs for printks right)?

[-- Attachment #2: [PATCH 04_21 - retry] Make iscsi debugging a module option.eml --]
[-- Type: message/rfc822, Size: 6691 bytes --]

From: Olaf Kirch <olaf.kirch@oracle.com>
To: open-iscsi@googlegroups.com
Subject: [PATCH 04/21 - retry] Make iscsi debugging a module option
Date: Fri, 22 Jun 2007 16:42:04 +0200
Message-ID: <200706221442.l5MEg40x025590@verein.lst.de>


Make iscsi debugging a module option

This patch adds a debug module parameter to both
libiscsi and iscsi_tcp, allowing to toggle debug
at runtime via /sys/modules/$name/parameters/debug

Signed-off-by: olaf.kirch@oracle.com
---
 drivers/scsi/Kconfig     |    9 +++++++++
 drivers/scsi/iscsi_tcp.c |   13 +++++++++----
 drivers/scsi/libiscsi.c  |   10 ++++++++++
 include/scsi/libiscsi.h  |   11 +++++++----
 4 files changed, 35 insertions(+), 8 deletions(-)

Index: iscsi-2.6/drivers/scsi/iscsi_tcp.c
===================================================================
--- iscsi-2.6.orig/drivers/scsi/iscsi_tcp.c
+++ iscsi-2.6/drivers/scsi/iscsi_tcp.c
@@ -48,13 +48,18 @@ MODULE_AUTHOR("Dmitry Yusupov <dmitry_yu
 	      "Alex Aizman <itn780@yahoo.com>");
 MODULE_DESCRIPTION("iSCSI/TCP data-path");
 MODULE_LICENSE("GPL");
-#undef DEBUG_TCP
 #define DEBUG_ASSERT
 
-#ifdef DEBUG_TCP
-#define debug_tcp(fmt...) printk(KERN_INFO "tcp: " fmt)
+#ifdef CONFIG_SCSI_ISCSI_DEBUG
+static int iscsi_tcp_debug = 0;
+#define debug_tcp(fmt...) do { \
+		if (unlikely(iscsi_tcp_debug)) \
+			printk(KERN_INFO "tcp: " fmt); \
+	} while (0)
+
+module_param_named(debug, iscsi_tcp_debug, int, S_IRUGO | S_IWUSR);
 #else
-#define debug_tcp(fmt...)
+#define debug_tcp(fmt...) do { } while (0)
 #endif
 
 #ifndef DEBUG_ASSERT
Index: iscsi-2.6/drivers/scsi/libiscsi.c
===================================================================
--- iscsi-2.6.orig/drivers/scsi/libiscsi.c
+++ iscsi-2.6/drivers/scsi/libiscsi.c
@@ -37,6 +37,16 @@
 #include <scsi/scsi_transport_iscsi.h>
 #include <scsi/libiscsi.h>
 
+/* Debug flag for libiscsi - needs to be
+ * exported so other iscsi modules can make use
+ * of the debug_scsi() macro */
+#ifdef CONFIG_SCSI_ISCSI_DEBUG
+int libiscsi_debug = 0;
+EXPORT_SYMBOL_GPL(libiscsi_debug);
+
+module_param_named(debug, libiscsi_debug, int, S_IRUGO | S_IWUSR);
+#endif
+
 struct iscsi_session *
 class_to_transport_session(struct iscsi_cls_session *cls_session)
 {
Index: iscsi-2.6/include/scsi/libiscsi.h
===================================================================
--- iscsi-2.6.orig/include/scsi/libiscsi.h
+++ iscsi-2.6/include/scsi/libiscsi.h
@@ -41,11 +41,14 @@ struct iscsi_cls_conn;
 struct iscsi_session;
 struct iscsi_nopin;
 
-/* #define DEBUG_SCSI */
-#ifdef DEBUG_SCSI
-#define debug_scsi(fmt...) printk(KERN_INFO "iscsi: " fmt)
+#ifdef CONFIG_SCSI_ISCSI_DEBUG
+extern int	libiscsi_debug;
+#define debug_scsi(fmt...) do { \
+		if (unlikely(libiscsi_debug)) \
+			printk(KERN_INFO "iscsi: " fmt); \
+	} while (0)
 #else
-#define debug_scsi(fmt...)
+#define debug_scsi(fmt...) do { } while (0)
 #endif
 
 #define ISCSI_DEF_XMIT_CMDS_MAX	128	/* must be power of 2 */
Index: iscsi-2.6/drivers/scsi/Kconfig
===================================================================
--- iscsi-2.6.orig/drivers/scsi/Kconfig
+++ iscsi-2.6/drivers/scsi/Kconfig
@@ -312,6 +312,15 @@ config ISCSI_TCP
 
 	 http://linux-iscsi.sf.net
 
+config SCSI_ISCSI_DEBUG
+	bool "Support iSCSI debugging"
+	depends on ISCSI_TCP
+	default n
+	help
+	 Say Y here to compile debugging support into libiscsi and
+	 iscsi_tcp. Debugging will not be enable by default, but
+	 can be switched on and off via module options.
+
 config SGIWD93_SCSI
 	tristate "SGI WD93C93 SCSI Driver"
 	depends on SGI_IP22 && SCSI

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to open-iscsi-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~----------~----~----~----~------~----~------~--~---



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] iscsi: Kconfig option for debug prints.
  2009-01-12 15:33 [PATCH] iscsi: Kconfig option for debug prints Boaz Harrosh
  2009-01-12 15:38 ` Boaz Harrosh
       [not found] ` <496B62B8.3030402-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
@ 2009-01-12 16:58 ` Randy Dunlap
  2009-01-12 17:12   ` Boaz Harrosh
  2 siblings, 1 reply; 8+ messages in thread
From: Randy Dunlap @ 2009-01-12 16:58 UTC (permalink / raw)
  To: Boaz Harrosh; +Cc: Mike Christie, open-iscsi, linux-scsi

Boaz Harrosh wrote:
> Remove the dark ages /* define debug_print */ in code, to use
> a Kconfig option. With a system like Kconfig, in code, commented out,
> configuration options are slavery and hard work.
> (version control, manual edit ... need I say more)
> 
> I've used an "int" config bit-mask so more areas of code can be
> selected with one Koption, but mainly so that allmodconfig will
> not turn it on.
> 
> bit-1 - will turn on prints for libiscsi.
> bit-2 - will turn on prints for libiscsi_tcp & iscsi_tcp.
> 
> More iscsi drivers should use more bits.
> 
> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
> ---
>  drivers/scsi/Kconfig        |   15 +++++++++++++++
>  drivers/scsi/iscsi_tcp.c    |    7 -------
>  drivers/scsi/iscsi_tcp.h    |    6 ++++++
>  drivers/scsi/libiscsi_tcp.c |    7 -------
>  include/scsi/libiscsi.h     |    3 +--
>  5 files changed, 22 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
> index d25d21e..6ef42f6 100644
> --- a/drivers/scsi/Kconfig
> +++ b/drivers/scsi/Kconfig
> @@ -352,6 +352,21 @@ config ISCSI_TCP
>  
>  	 http://open-iscsi.org
>  
> +config ISCSI_DEBUG
> +	int "ISCSI debug prints"
> +	depends on SCSI_ISCSI_ATTRS
> +	default 0
> +	help
> +	  This is a bit-mask that turns some debug printing to Kernel's
> +	  Messages file. Each bit turns on another area of the code:
> +	  1 - Turn on prints from iscsi libraries.
> +	  2 - Turns on prints from iscsi_tcp operations.

Is this bit 1, bit 2, or value 1, value 2?  Not clear to me.
If it's bit numbers, what about bit 0?


> +	  Note to programmers: Use more bits in this bit-mask for other iscsi
> +	  drivers.
> +	  If you found a problem with ISCSI, please turn this on to
> +	  help us debug the problem. Send the Messages file plus problem
> +	  description to open-iscsi@googlegroups.com mailing-list
> +
>  source "drivers/scsi/cxgb3i/Kconfig"
>  
>  config SGIWD93_SCSI
> diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
> index a566aa9..af092a8 100644
> --- a/drivers/scsi/iscsi_tcp.c
> +++ b/drivers/scsi/iscsi_tcp.c
> @@ -48,13 +48,6 @@ MODULE_AUTHOR("Mike Christie <michaelc@cs.wisc.edu>, "
>  	      "Alex Aizman <itn780@yahoo.com>");
>  MODULE_DESCRIPTION("iSCSI/TCP data-path");
>  MODULE_LICENSE("GPL");
> -#undef DEBUG_TCP
> -
> -#ifdef DEBUG_TCP
> -#define debug_tcp(fmt...) printk(KERN_INFO "tcp: " fmt)
> -#else
> -#define debug_tcp(fmt...)
> -#endif
>  
>  static struct scsi_transport_template *iscsi_sw_tcp_scsi_transport;
>  static struct scsi_host_template iscsi_sw_tcp_sht;
> diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h
> index ca6b7bc..1341b02 100644
> --- a/drivers/scsi/iscsi_tcp.h
> +++ b/drivers/scsi/iscsi_tcp.h
> @@ -25,6 +25,12 @@
>  #include <scsi/libiscsi.h>
>  #include <scsi/libiscsi_tcp.h>
>  
> +#if (CONFIG_ISCSI_DEBUG & 2)
> +#define debug_tcp(fmt...) printk(KERN_INFO "tcp: " fmt)
> +#else
> +#define debug_tcp(fmt...)
> +#endif
> +
>  struct socket;
>  struct iscsi_tcp_conn;
>  
> diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c
> index 12354c5..4c9f827 100644
> --- a/drivers/scsi/libiscsi_tcp.c
> +++ b/drivers/scsi/libiscsi_tcp.c
> @@ -49,13 +49,6 @@ MODULE_AUTHOR("Mike Christie <michaelc@cs.wisc.edu>, "
>  	      "Alex Aizman <itn780@yahoo.com>");
>  MODULE_DESCRIPTION("iSCSI/TCP data-path");
>  MODULE_LICENSE("GPL");
> -#undef DEBUG_TCP
> -
> -#ifdef DEBUG_TCP
> -#define debug_tcp(fmt...) printk(KERN_INFO "tcp: " fmt)
> -#else
> -#define debug_tcp(fmt...)
> -#endif
>  
>  static int iscsi_tcp_hdr_recv_done(struct iscsi_tcp_conn *tcp_conn,
>  				   struct iscsi_segment *segment);
> diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
> index 7360e19..2421c2a 100644
> --- a/include/scsi/libiscsi.h
> +++ b/include/scsi/libiscsi.h
> @@ -45,8 +45,7 @@ struct iscsi_session;
>  struct iscsi_nopin;
>  struct device;
>  
> -/* #define DEBUG_SCSI */
> -#ifdef DEBUG_SCSI
> +#if (CONFIG_ISCSI_DEBUG & 1)
>  #define debug_scsi(fmt...) printk(KERN_INFO "iscsi: " fmt)
>  #else
>  #define debug_scsi(fmt...)


-- 
~Randy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] iscsi: Kconfig option for debug prints.
       [not found]     ` <496B68F8.3070103-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
@ 2009-01-12 17:10       ` Boaz Harrosh
  0 siblings, 0 replies; 8+ messages in thread
From: Boaz Harrosh @ 2009-01-12 17:10 UTC (permalink / raw)
  To: open-iscsi-/JYPxA39Uh5TLH3MbocFFw, Mike Christie; +Cc: linux-scsi


Mike Christie wrote:
> Boaz Harrosh wrote:
>> Boaz Harrosh wrote:
>>> Remove the dark ages /* define debug_print */ in code, to use
>>> a Kconfig option. With a system like Kconfig, in code, commented out,
>>> configuration options are slavery and hard work.
>>> (version control, manual edit ... need I say more)
>>>
>>> I've used an "int" config bit-mask so more areas of code can be
>>> selected with one Koption, but mainly so that allmodconfig will
>>> not turn it on.
>>>
>>> bit-1 - will turn on prints for libiscsi.
>>> bit-2 - will turn on prints for libiscsi_tcp & iscsi_tcp.
>>>
>>> More iscsi drivers should use more bits.
>>>
>>> Signed-off-by: Boaz Harrosh <bharrosh-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
>>> ---
>>>  drivers/scsi/Kconfig        |   15 +++++++++++++++
>>>  drivers/scsi/iscsi_tcp.c    |    7 -------
>>>  drivers/scsi/iscsi_tcp.h    |    6 ++++++
>>>  drivers/scsi/libiscsi_tcp.c |    7 -------
>>>  include/scsi/libiscsi.h     |    3 +--
>>>  5 files changed, 22 insertions(+), 16 deletions(-)
>>>
>>> diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
>> Mike hi.
>>
>> These are over latest Linus. Sorry I mixed up the branches.
>> If they don't apply to your tree any more, I'll rebase.
>>
> 
> It applies ok.
> 
>> I'm sending these because for too many times I submit some code
>> with iscsi sources edits, because I forget to remove the edits
>> for enabling prints. Please consider for inclusion.
>>
> 
> What about compile time vs load time? Olaf had the attached patch which 
> does it at module load time. It is nicer for users, but I was just 
> worried about maybe there being a perf change with all the new ifs? I 
> was waiting to do some testing to see if there was and change, but did 
> not get around to it. Is that too paranoid (probably other factors like 
> our crappy locking will slow us down more than some ifs for printks right)?
> 

I don't think the performance matters because in his patch it is
still commented out by a config SCSI_ISCSI_DEBUG set to n. So people
can run as today. Though maybe make it an "int" option and not
"bool" because this way allmodconfig will not turn it on. Note
that all distros use allmodeconfig.

And if it is already an "int" it can be a bit-mask which is the default
for a single iscsi module-param which also acts as a bit-mask for all iscsi
drivers. Each driver has a bit.

Sure a module-param could be nice, but if we decide on the final API
we can do a config only now, and add run-time later.

[And for me personally a config option is just good enough. Though I admit
 that for a sysadmin run-time can be very nice]

But please let's do something. Current situation just keeps biting me on
the a.. At just the times when I don't pay attention.

Tell me what you decide and I'll freshen up which ever patch
you want. (Olaf patch has problems, mainly with code placements and
that we added libiscsi_tcp.c, and my above proposition)

Thanks Mike
Boaz

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] iscsi: Kconfig option for debug prints.
  2009-01-12 16:58 ` Randy Dunlap
@ 2009-01-12 17:12   ` Boaz Harrosh
  0 siblings, 0 replies; 8+ messages in thread
From: Boaz Harrosh @ 2009-01-12 17:12 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Mike Christie, open-iscsi, linux-scsi

Randy Dunlap wrote:
> Boaz Harrosh wrote:
>> Remove the dark ages /* define debug_print */ in code, to use
>> a Kconfig option. With a system like Kconfig, in code, commented out,
>> configuration options are slavery and hard work.
>> (version control, manual edit ... need I say more)
>>
>> I've used an "int" config bit-mask so more areas of code can be
>> selected with one Koption, but mainly so that allmodconfig will
>> not turn it on.
>>
>> bit-1 - will turn on prints for libiscsi.
>> bit-2 - will turn on prints for libiscsi_tcp & iscsi_tcp.
>>
>> More iscsi drivers should use more bits.
>>
>> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
>> ---
>>  drivers/scsi/Kconfig        |   15 +++++++++++++++
>>  drivers/scsi/iscsi_tcp.c    |    7 -------
>>  drivers/scsi/iscsi_tcp.h    |    6 ++++++
>>  drivers/scsi/libiscsi_tcp.c |    7 -------
>>  include/scsi/libiscsi.h     |    3 +--
>>  5 files changed, 22 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
>> index d25d21e..6ef42f6 100644
>> --- a/drivers/scsi/Kconfig
>> +++ b/drivers/scsi/Kconfig
>> @@ -352,6 +352,21 @@ config ISCSI_TCP
>>  
>>  	 http://open-iscsi.org
>>  
>> +config ISCSI_DEBUG
>> +	int "ISCSI debug prints"
>> +	depends on SCSI_ISCSI_ATTRS
>> +	default 0
>> +	help
>> +	  This is a bit-mask that turns some debug printing to Kernel's
>> +	  Messages file. Each bit turns on another area of the code:
>> +	  1 - Turn on prints from iscsi libraries.
>> +	  2 - Turns on prints from iscsi_tcp operations.
> 
> Is this bit 1, bit 2, or value 1, value 2?  Not clear to me.
> If it's bit numbers, what about bit 0?
> 
> 
Yes you are right! Not clear at all I will fix it

<snip>

Boaz

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-01-12 17:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-12 15:33 [PATCH] iscsi: Kconfig option for debug prints Boaz Harrosh
2009-01-12 15:38 ` Boaz Harrosh
2009-01-12 15:59   ` Mike Christie
     [not found]     ` <496B68F8.3070103-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
2009-01-12 17:10       ` Boaz Harrosh
     [not found] ` <496B62B8.3030402-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
2009-01-12 15:39   ` Ulrich Windl
2009-01-12 15:43     ` Boaz Harrosh
2009-01-12 16:58 ` Randy Dunlap
2009-01-12 17:12   ` Boaz Harrosh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).