diff mbox

[3/3] cifs: Enable Kconfig control of CIFS_DEBUG

Message ID 5f5c9196b44908026a27333ef31dd4ebf4314de2.1354217746.git.joe@perches.com (mailing list archive)
State New, archived
Headers show

Commit Message

Joe Perches Nov. 29, 2012, 7:37 p.m. UTC
Rather than havign a permanently enabled #define, allow
control over it.

This can reduce the size of the module by ~100KB which
could be useful for embedded systems.

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/cifs/Kconfig      |   10 +++++++++-
 fs/cifs/cifs_debug.h |    5 ++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

Comments

Jeff Layton Nov. 30, 2012, 11:56 a.m. UTC | #1
On Thu, 29 Nov 2012 11:37:20 -0800
Joe Perches <joe@perches.com> wrote:

> Rather than havign a permanently enabled #define, allow
> control over it.
> 
> This can reduce the size of the module by ~100KB which
> could be useful for embedded systems.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  fs/cifs/Kconfig      |   10 +++++++++-
>  fs/cifs/cifs_debug.h |    5 ++++-
>  2 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/cifs/Kconfig b/fs/cifs/Kconfig
> index 2075ddf..21ff76c 100644
> --- a/fs/cifs/Kconfig
> +++ b/fs/cifs/Kconfig
> @@ -122,9 +122,17 @@ config CIFS_ACL
>  	    Allows fetching CIFS/NTFS ACL from the server.  The DACL blob
>  	    is handed over to the application/caller.
>  
> +config CIFS_DEBUG
> +	bool "Enable CIFS debugging routines"
> +	default y
> +	depends on CIFS
> +	help
> +	   Enabling this option adds helpful debugging messages to
> +	   the cifs code which increases the size of the cifs module.
> +	   If unsure, say Y.
>  config CIFS_DEBUG2
>  	bool "Enable additional CIFS debugging routines"
> -	depends on CIFS
> +	depends on CIFS_DEBUG
>  	help
>  	   Enabling this option adds a few more debugging routines
>  	   to the cifs code which slightly increases the size of
> diff --git a/fs/cifs/cifs_debug.h b/fs/cifs/cifs_debug.h
> index 4d12fe4..6867a7f 100644
> --- a/fs/cifs/cifs_debug.h
> +++ b/fs/cifs/cifs_debug.h
> @@ -18,7 +18,10 @@
>   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
>   *
>  */
> -#define CIFS_DEBUG		/* BB temporary */
> +
> +#ifdef CONFIG_CIFS_DEBUG
> +#define CIFS_DEBUG
> +#endif
>  
>  #ifndef _H_CIFS_DEBUG
>  #define _H_CIFS_DEBUG

Looks fine, but I'd probably prefer to just get rid of CIFS_DEBUG
altogether here and replace it with CONFIG_CIFS_DEBUG.

While you're at it, /proc/fs/cifs/cifsFYI should probably not be
present when CONFIG_CIFS_DEBUG isn't set. Perhaps we should also
disable traceSMB and its related functions too in that case?
Joe Perches Nov. 30, 2012, 2:57 p.m. UTC | #2
On Fri, 2012-11-30 at 06:56 -0500, Jeff Layton wrote:
> On Thu, 29 Nov 2012 11:37:20 -0800
> Joe Perches <joe@perches.com> wrote:
> 
> > Rather than havign a permanently enabled #define, allow
> > control over it.
> > 
> > This can reduce the size of the module by ~100KB which
> > could be useful for embedded systems.
[]
> > diff --git a/fs/cifs/cifs_debug.h b/fs/cifs/cifs_debug.h
> > index 4d12fe4..6867a7f 100644
> > --- a/fs/cifs/cifs_debug.h
> > +++ b/fs/cifs/cifs_debug.h
> > @@ -18,7 +18,10 @@
> >   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> >   *
> >  */
> > -#define CIFS_DEBUG		/* BB temporary */
> > +
> > +#ifdef CONFIG_CIFS_DEBUG
> > +#define CIFS_DEBUG
> > +#endif
> >  
> >  #ifndef _H_CIFS_DEBUG
> >  #define _H_CIFS_DEBUG
> 
> Looks fine, but I'd probably prefer to just get rid of CIFS_DEBUG
> altogether here and replace it with CONFIG_CIFS_DEBUG.

I wasn't sure if there was other code anywhere else that depends
on CIFS_DEBUG.  There isn't any in the kernel source tree.  If not,
then you are right, it should be just CONFIG_CIFS_DEBUG.

> While you're at it, /proc/fs/cifs/cifsFYI should probably not be
> present when CONFIG_CIFS_DEBUG isn't set. Perhaps we should also
> disable traceSMB and its related functions too in that case?

That could be considered a kernel api change.
If people agree to delete it, I'd be OK with it.

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jeff Layton Nov. 30, 2012, 3:07 p.m. UTC | #3
On Fri, 30 Nov 2012 06:57:40 -0800
Joe Perches <joe@perches.com> wrote:

> On Fri, 2012-11-30 at 06:56 -0500, Jeff Layton wrote:
> > On Thu, 29 Nov 2012 11:37:20 -0800
> > Joe Perches <joe@perches.com> wrote:
> > 
> > > Rather than havign a permanently enabled #define, allow
> > > control over it.
> > > 
> > > This can reduce the size of the module by ~100KB which
> > > could be useful for embedded systems.
> []
> > > diff --git a/fs/cifs/cifs_debug.h b/fs/cifs/cifs_debug.h
> > > index 4d12fe4..6867a7f 100644
> > > --- a/fs/cifs/cifs_debug.h
> > > +++ b/fs/cifs/cifs_debug.h
> > > @@ -18,7 +18,10 @@
> > >   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> > >   *
> > >  */
> > > -#define CIFS_DEBUG		/* BB temporary */
> > > +
> > > +#ifdef CONFIG_CIFS_DEBUG
> > > +#define CIFS_DEBUG
> > > +#endif
> > >  
> > >  #ifndef _H_CIFS_DEBUG
> > >  #define _H_CIFS_DEBUG
> > 
> > Looks fine, but I'd probably prefer to just get rid of CIFS_DEBUG
> > altogether here and replace it with CONFIG_CIFS_DEBUG.
> 
> I wasn't sure if there was other code anywhere else that depends
> on CIFS_DEBUG.  There isn't any in the kernel source tree.  If not,
> then you are right, it should be just CONFIG_CIFS_DEBUG.
> 

There shouldn't be. None of this stuff is exposed to userspace, AFAIK.
I think it's ok to just make that CONFIG_CIFS_DEBUG.

> > While you're at it, /proc/fs/cifs/cifsFYI should probably not be
> > present when CONFIG_CIFS_DEBUG isn't set. Perhaps we should also
> > disable traceSMB and its related functions too in that case?
> 
> That could be considered a kernel api change.
> If people agree to delete it, I'd be OK with it.
> 

If you compile with CONFIG_CIFS_DEBUG turned off, then the cifsFYI file
will be a knob that's not hooked up to anything. I think it's best not
to present it at all in that case.

traceSMB is a little harder to make the case for. Theoretically, it'll
still work after your changes, but I'm not sure it makes sense to leave
that knob around since it's technically a flag for debugging. You're
probably fine not to worry about that one. I'll look at that at some
point in the future.

Thanks,
Steve French Nov. 30, 2012, 3:42 p.m. UTC | #4
On Fri, Nov 30, 2012 at 9:07 AM, Jeff Layton <jlayton@redhat.com> wrote:
> On Fri, 30 Nov 2012 06:57:40 -0800
> Joe Perches <joe@perches.com> wrote:
>
>> On Fri, 2012-11-30 at 06:56 -0500, Jeff Layton wrote:
>> > On Thu, 29 Nov 2012 11:37:20 -0800
>> > Joe Perches <joe@perches.com> wrote:
>> >
>> > > Rather than havign a permanently enabled #define, allow
>> > > control over it.
>> > >
>> > > This can reduce the size of the module by ~100KB which
>> > > could be useful for embedded systems.
>> []
>> > > diff --git a/fs/cifs/cifs_debug.h b/fs/cifs/cifs_debug.h
>> > > index 4d12fe4..6867a7f 100644
>> > > --- a/fs/cifs/cifs_debug.h
>> > > +++ b/fs/cifs/cifs_debug.h
>> > > @@ -18,7 +18,10 @@
>> > >   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
>> > >   *
>> > >  */
>> > > -#define CIFS_DEBUG               /* BB temporary */
>> > > +
>> > > +#ifdef CONFIG_CIFS_DEBUG
>> > > +#define CIFS_DEBUG
>> > > +#endif
>> > >
>> > >  #ifndef _H_CIFS_DEBUG
>> > >  #define _H_CIFS_DEBUG
>> >
>> > Looks fine, but I'd probably prefer to just get rid of CIFS_DEBUG
>> > altogether here and replace it with CONFIG_CIFS_DEBUG.
>>
>> I wasn't sure if there was other code anywhere else that depends
>> on CIFS_DEBUG.  There isn't any in the kernel source tree.  If not,
>> then you are right, it should be just CONFIG_CIFS_DEBUG.
>>
>
> There shouldn't be. None of this stuff is exposed to userspace, AFAIK.
> I think it's ok to just make that CONFIG_CIFS_DEBUG.
>
>> > While you're at it, /proc/fs/cifs/cifsFYI should probably not be
>> > present when CONFIG_CIFS_DEBUG isn't set. Perhaps we should also
>> > disable traceSMB and its related functions too in that case?
>>
>> That could be considered a kernel api change.
>> If people agree to delete it, I'd be OK with it.
>>
>
> If you compile with CONFIG_CIFS_DEBUG turned off, then the cifsFYI file
> will be a knob that's not hooked up to anything. I think it's best not
> to present it at all in that case.
>
> traceSMB is a little harder to make the case for. Theoretically, it'll
> still work after your changes, but I'm not sure it makes sense to leave
> that knob around since it's technically a flag for debugging. You're
> probably fine not to worry about that one. I'll look at that at some
> point in the future.

I think it is fine to leave the traceSMB around with debug config flag
off - it is not strongly related to cERROR and cFYI and is small.
diff mbox

Patch

diff --git a/fs/cifs/Kconfig b/fs/cifs/Kconfig
index 2075ddf..21ff76c 100644
--- a/fs/cifs/Kconfig
+++ b/fs/cifs/Kconfig
@@ -122,9 +122,17 @@  config CIFS_ACL
 	    Allows fetching CIFS/NTFS ACL from the server.  The DACL blob
 	    is handed over to the application/caller.
 
+config CIFS_DEBUG
+	bool "Enable CIFS debugging routines"
+	default y
+	depends on CIFS
+	help
+	   Enabling this option adds helpful debugging messages to
+	   the cifs code which increases the size of the cifs module.
+	   If unsure, say Y.
 config CIFS_DEBUG2
 	bool "Enable additional CIFS debugging routines"
-	depends on CIFS
+	depends on CIFS_DEBUG
 	help
 	   Enabling this option adds a few more debugging routines
 	   to the cifs code which slightly increases the size of
diff --git a/fs/cifs/cifs_debug.h b/fs/cifs/cifs_debug.h
index 4d12fe4..6867a7f 100644
--- a/fs/cifs/cifs_debug.h
+++ b/fs/cifs/cifs_debug.h
@@ -18,7 +18,10 @@ 
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  *
 */
-#define CIFS_DEBUG		/* BB temporary */
+
+#ifdef CONFIG_CIFS_DEBUG
+#define CIFS_DEBUG
+#endif
 
 #ifndef _H_CIFS_DEBUG
 #define _H_CIFS_DEBUG