public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] make xfs stats Kconfigurable
@ 2007-08-18 20:04 Eric Sandeen
  2007-08-19 17:21 ` [PATCH V2] " Eric Sandeen
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Sandeen @ 2007-08-18 20:04 UTC (permalink / raw)
  To: xfs-oss

Hey guys, what do you think, is it worth doing this for when
space is tight:

xfs stats are already optional based on CONFIG_PROC_FS, and there
is already a (never-set) macro XFS_STATS_OFF which can turn them
off.  Making it a configurable option, if I turn them off I can
get a little stack savings on x86, gcc 4.1:

xfs_attr_list		-8
xfs_bmap_rtalloc	-16
xfs_bmap_search_extents	-8
xfs_buf_find		+8 (not sure why)
xfs_iflush		-4
xfs_imap		-12
xfs_log_reserve		-4
xfs_log_sync		-8

It'd reduce the size of the binary a bit too.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>

Index: linux-2.6.22.i386/fs/xfs/Kconfig
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/Kconfig
+++ linux-2.6.22.i386/fs/xfs/Kconfig
@@ -59,6 +59,17 @@ config XFS_POSIX_ACL
 
 	  If you don't know what Access Control Lists are, say N.
 
+	config XFS_STATS
+	bool "XFS statistics"
+	depends on XFS_FS && PROC_FS
+	help
+	  If you say Y here xfs will gather detailed statistics during
+	  its operation, and present them in /proc/fs/xfs/stat and
+	  (CONFIG_XFS_QUOTA is enabled) /proc/fs/xfs/xqmstat.  Disabling
+	  this will make the compiled code and stack usage slightly smaller.
+
+	  If unsure, say Y.
+
 config XFS_RT
 	bool "XFS Realtime subvolume support"
 	depends on XFS_FS
Index: linux-2.6.22.i386/fs/xfs/Makefile-linux-2.6
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/Makefile-linux-2.6
+++ linux-2.6.22.i386/fs/xfs/Makefile-linux-2.6
@@ -35,12 +35,12 @@ xfs-$(CONFIG_XFS_QUOTA)		+= $(addprefix 
 				   xfs_qm.o)
 
 ifeq ($(CONFIG_XFS_QUOTA),y)
-xfs-$(CONFIG_PROC_FS)		+= quota/xfs_qm_stats.o
+xfs-$(CONFIG_XFS_STAT)		+= quota/xfs_qm_stats.o
 endif
 
 xfs-$(CONFIG_XFS_RT)		+= xfs_rtalloc.o
 xfs-$(CONFIG_XFS_POSIX_ACL)	+= xfs_acl.o
-xfs-$(CONFIG_PROC_FS)		+= $(XFS_LINUX)/xfs_stats.o
+xfs-$(CONFIG_XFS_STATS)		+= $(XFS_LINUX)/xfs_stats.o
 xfs-$(CONFIG_SYSCTL)		+= $(XFS_LINUX)/xfs_sysctl.o
 xfs-$(CONFIG_COMPAT)		+= $(XFS_LINUX)/xfs_ioctl32.o
 
Index: linux-2.6.22.i386/fs/xfs/linux-2.6/xfs_stats.h
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/linux-2.6/xfs_stats.h
+++ linux-2.6.22.i386/fs/xfs/linux-2.6/xfs_stats.h
@@ -19,7 +19,7 @@
 #define __XFS_STATS_H__
 
 
-#if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF)
+#if defined(CONFIG_XFS_STATS)
 
 #include <linux/percpu.h>
 
@@ -137,8 +137,7 @@ DECLARE_PER_CPU(struct xfsstats, xfsstat
 extern void xfs_init_procfs(void);
 extern void xfs_cleanup_procfs(void);
 
-
-#else	/* !CONFIG_PROC_FS */
+#else	/* !CONFIG_XFS_STATS */
 
 # define XFS_STATS_INC(count)
 # define XFS_STATS_DEC(count)
@@ -147,6 +146,6 @@ extern void xfs_cleanup_procfs(void);
 static __inline void xfs_init_procfs(void) { };
 static __inline void xfs_cleanup_procfs(void) { };
 
-#endif	/* !CONFIG_PROC_FS */
+#endif /* !CONFIG_XFS_STATS */
 
 #endif /* __XFS_STATS_H__ */
Index: linux-2.6.22.i386/fs/xfs/linux-2.6/xfs_sysctl.c
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/linux-2.6/xfs_sysctl.c
+++ linux-2.6.22.i386/fs/xfs/linux-2.6/xfs_sysctl.c
@@ -21,7 +21,7 @@
 
 static struct ctl_table_header *xfs_table_header;
 
-#ifdef CONFIG_PROC_FS
+#ifdef CONFIG_XFS_STATS
 STATIC int
 xfs_stats_clear_proc_handler(
 	ctl_table	*ctl,
@@ -52,7 +52,7 @@ xfs_stats_clear_proc_handler(
 
 	return ret;
 }
-#endif /* CONFIG_PROC_FS */
+#endif /* CONFIG_XFS_STATS */
 
 static ctl_table xfs_table[] = {
 	{
@@ -222,7 +222,7 @@ static ctl_table xfs_table[] = {
 		.extra2		= &xfs_params.fstrm_timer.max,
 	},
 	/* please keep this the last entry */
-#ifdef CONFIG_PROC_FS
+#ifdef CONFIG_XFS_STATS
 	{
 		.ctl_name	= XFS_STATS_CLEAR,
 		.procname	= "stats_clear",
Index: linux-2.6.22.i386/fs/xfs/quota/xfs_qm_stats.h
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/quota/xfs_qm_stats.h
+++ linux-2.6.22.i386/fs/xfs/quota/xfs_qm_stats.h
@@ -18,7 +18,7 @@
 #ifndef __XFS_QM_STATS_H__
 #define __XFS_QM_STATS_H__
 
-#if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF)
+#ifdef CONFIG_XFS_STATS
 
 /*
  * XQM global statistics

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

* [PATCH V2] make xfs stats Kconfigurable
  2007-08-18 20:04 [PATCH] make xfs stats Kconfigurable Eric Sandeen
@ 2007-08-19 17:21 ` Eric Sandeen
  2007-08-19 18:34   ` Eric Sandeen
  2007-08-19 19:10   ` Christoph Hellwig
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Sandeen @ 2007-08-19 17:21 UTC (permalink / raw)
  To: xfs-oss

Oops, typo in Makefile (CONFIG_XFS_STAT vs _STATS).

----


xfs stats are already optional based on CONFIG_PROC_FS, and there
is already a (never-set) macro XFS_STATS_OFF which can turn them
off.  Making it a configurable option, if I turn them off I can
get a little stack savings on x86, gcc 4.1:

xfs_attr_list		-8
xfs_bmap_rtalloc	-16
xfs_bmap_search_extents	-8
xfs_buf_find		+8 (not sure why)
xfs_iflush		-4
xfs_imap		-12
xfs_log_reserve		-4
xfs_log_sync		-8

It'd reduce the size of the binary a bit too.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>

Index: linux-2.6.22.i386/fs/xfs/Kconfig
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/Kconfig
+++ linux-2.6.22.i386/fs/xfs/Kconfig
@@ -59,6 +59,17 @@ config XFS_POSIX_ACL
 
 	  If you don't know what Access Control Lists are, say N.
 
+	config XFS_STATS
+	bool "XFS statistics"
+	depends on XFS_FS && PROC_FS
+	help
+	  If you say Y here xfs will gather detailed statistics during
+	  its operation, and present them in /proc/fs/xfs/stat and
+	  (CONFIG_XFS_QUOTA is enabled) /proc/fs/xfs/xqmstat.  Disabling
+	  this will make the compiled code and stack usage slightly smaller.
+
+	  If unsure, say Y.
+
 config XFS_RT
 	bool "XFS Realtime subvolume support"
 	depends on XFS_FS
Index: linux-2.6.22.i386/fs/xfs/Makefile-linux-2.6
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/Makefile-linux-2.6
+++ linux-2.6.22.i386/fs/xfs/Makefile-linux-2.6
@@ -35,12 +35,12 @@ xfs-$(CONFIG_XFS_QUOTA)		+= $(addprefix 
 				   xfs_qm.o)
 
 ifeq ($(CONFIG_XFS_QUOTA),y)
-xfs-$(CONFIG_PROC_FS)		+= quota/xfs_qm_stats.o
+xfs-$(CONFIG_XFS_STATS)		+= quota/xfs_qm_stats.o
 endif
 
 xfs-$(CONFIG_XFS_RT)		+= xfs_rtalloc.o
 xfs-$(CONFIG_XFS_POSIX_ACL)	+= xfs_acl.o
-xfs-$(CONFIG_PROC_FS)		+= $(XFS_LINUX)/xfs_stats.o
+xfs-$(CONFIG_XFS_STATS)		+= $(XFS_LINUX)/xfs_stats.o
 xfs-$(CONFIG_SYSCTL)		+= $(XFS_LINUX)/xfs_sysctl.o
 xfs-$(CONFIG_COMPAT)		+= $(XFS_LINUX)/xfs_ioctl32.o
 
Index: linux-2.6.22.i386/fs/xfs/linux-2.6/xfs_stats.h
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/linux-2.6/xfs_stats.h
+++ linux-2.6.22.i386/fs/xfs/linux-2.6/xfs_stats.h
@@ -19,7 +19,7 @@
 #define __XFS_STATS_H__
 
 
-#if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF)
+#if defined(CONFIG_XFS_STATS)
 
 #include <linux/percpu.h>
 
@@ -137,8 +137,7 @@ DECLARE_PER_CPU(struct xfsstats, xfsstat
 extern void xfs_init_procfs(void);
 extern void xfs_cleanup_procfs(void);
 
-
-#else	/* !CONFIG_PROC_FS */
+#else	/* !CONFIG_XFS_STATS */
 
 # define XFS_STATS_INC(count)
 # define XFS_STATS_DEC(count)
@@ -147,6 +146,6 @@ extern void xfs_cleanup_procfs(void);
 static __inline void xfs_init_procfs(void) { };
 static __inline void xfs_cleanup_procfs(void) { };
 
-#endif	/* !CONFIG_PROC_FS */
+#endif /* !CONFIG_XFS_STATS */
 
 #endif /* __XFS_STATS_H__ */
Index: linux-2.6.22.i386/fs/xfs/linux-2.6/xfs_sysctl.c
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/linux-2.6/xfs_sysctl.c
+++ linux-2.6.22.i386/fs/xfs/linux-2.6/xfs_sysctl.c
@@ -21,7 +21,7 @@
 
 static struct ctl_table_header *xfs_table_header;
 
-#ifdef CONFIG_PROC_FS
+#ifdef CONFIG_XFS_STATS
 STATIC int
 xfs_stats_clear_proc_handler(
 	ctl_table	*ctl,
@@ -52,7 +52,7 @@ xfs_stats_clear_proc_handler(
 
 	return ret;
 }
-#endif /* CONFIG_PROC_FS */
+#endif /* CONFIG_XFS_STATS */
 
 static ctl_table xfs_table[] = {
 	{
@@ -222,7 +222,7 @@ static ctl_table xfs_table[] = {
 		.extra2		= &xfs_params.fstrm_timer.max,
 	},
 	/* please keep this the last entry */
-#ifdef CONFIG_PROC_FS
+#ifdef CONFIG_XFS_STATS
 	{
 		.ctl_name	= XFS_STATS_CLEAR,
 		.procname	= "stats_clear",
Index: linux-2.6.22.i386/fs/xfs/quota/xfs_qm_stats.h
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/quota/xfs_qm_stats.h
+++ linux-2.6.22.i386/fs/xfs/quota/xfs_qm_stats.h
@@ -18,7 +18,7 @@
 #ifndef __XFS_QM_STATS_H__
 #define __XFS_QM_STATS_H__
 
-#if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF)
+#ifdef CONFIG_XFS_STATS
 
 /*
  * XQM global statistics

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

* Re: [PATCH V2] make xfs stats Kconfigurable
  2007-08-19 17:21 ` [PATCH V2] " Eric Sandeen
@ 2007-08-19 18:34   ` Eric Sandeen
  2007-08-19 19:10   ` Christoph Hellwig
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Sandeen @ 2007-08-19 18:34 UTC (permalink / raw)
  To: xfs-oss

Eric Sandeen wrote:
> Oops, typo in Makefile (CONFIG_XFS_STAT vs _STATS).
> 
> ----
> 
> 
> xfs stats are already optional based on CONFIG_PROC_FS, and there
> is already a (never-set) macro XFS_STATS_OFF which can turn them
> off.  Making it a configurable option, if I turn them off I can
> get a little stack savings on x86, gcc 4.1:

This causes feature -q in xfsqa to report no quotas, because
/proc/fs/xfs/xqm isn't present, but I think that check should just be
removed...?

-Eric

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

* Re: [PATCH V2] make xfs stats Kconfigurable
  2007-08-19 17:21 ` [PATCH V2] " Eric Sandeen
  2007-08-19 18:34   ` Eric Sandeen
@ 2007-08-19 19:10   ` Christoph Hellwig
  2007-08-19 19:13     ` Eric Sandeen
  1 sibling, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2007-08-19 19:10 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

On Sun, Aug 19, 2007 at 12:21:09PM -0500, Eric Sandeen wrote:
> Oops, typo in Makefile (CONFIG_XFS_STAT vs _STATS).
> 
> ----
> 
> 
> xfs stats are already optional based on CONFIG_PROC_FS, and there
> is already a (never-set) macro XFS_STATS_OFF which can turn them
> off.  Making it a configurable option, if I turn them off I can
> get a little stack savings on x86, gcc 4.1:

Why would we want to disable the statistics?

> +	config XFS_STATS

Everywhere else the config statement is not indented, so it probably
shouldn't be here either.

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

* Re: [PATCH V2] make xfs stats Kconfigurable
  2007-08-19 19:10   ` Christoph Hellwig
@ 2007-08-19 19:13     ` Eric Sandeen
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Sandeen @ 2007-08-19 19:13 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs-oss

Christoph Hellwig wrote:
> On Sun, Aug 19, 2007 at 12:21:09PM -0500, Eric Sandeen wrote:
>> Oops, typo in Makefile (CONFIG_XFS_STAT vs _STATS).
>>
>> ----
>>
>>
>> xfs stats are already optional based on CONFIG_PROC_FS, and there
>> is already a (never-set) macro XFS_STATS_OFF which can turn them
>> off.  Making it a configurable option, if I turn them off I can
>> get a little stack savings on x86, gcc 4.1:
> 
> Why would we want to disable the statistics?

To save a little stack space.  :)  *shrug*

This one's not so critical.  FWIW, JFS has configurable stats, and I
think an upcoming jbd patch adds (config-optional) stats.

OTOH when are stats really used outside of sgi?  Though I suppose
occasionally they'd be useful in field debugging.

*shrug* this one may not be worth it; I won't be heartbroken if it
doesn't go in... it helps a tiny bit on the stack side.

-Eric

>> +	config XFS_STATS
> 
> Everywhere else the config statement is not indented, so it probably
> shouldn't be here either.
> 

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

end of thread, other threads:[~2007-08-19 19:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-18 20:04 [PATCH] make xfs stats Kconfigurable Eric Sandeen
2007-08-19 17:21 ` [PATCH V2] " Eric Sandeen
2007-08-19 18:34   ` Eric Sandeen
2007-08-19 19:10   ` Christoph Hellwig
2007-08-19 19:13     ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox