linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: Remove compilation warnings in fs/ext4/mballoc.c
@ 2008-10-16 10:03 Manish Katiyar
  2008-10-16 15:12 ` Theodore Tso
  0 siblings, 1 reply; 2+ messages in thread
From: Manish Katiyar @ 2008-10-16 10:03 UTC (permalink / raw)
  To: Theodore Tso, ext4; +Cc: mkatiyar

Hi Ted,

Below patch fixes the following compilation warnings
fs/ext4/mballoc.c:2717: warning: unused variable 'proc'
fs/ext4/mballoc.c:2715: warning: unused variable 'mode'

I think a cleaner fix would be to call these functions only when
CONFIG_PROC_FS is set and cleanup EXT4_PROC_HANDLER to be always
defined . Also since s_proc in sb only makes sense when procfs is
configured should that also be ifdef'd in the structure itself ??
Let me know if these cleanup can be done in a better way (or the way
you would prefer :-) . I can do this.


Signed-off-by: Manish Katiyar <mkatiyar@gmail.com>
---
 fs/ext4/mballoc.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index b580714..c88b5ab 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2712,12 +2712,14 @@ ext4_mb_free_committed_blocks(struct super_block *sb)

 static int ext4_mb_init_per_dev_proc(struct super_block *sb)
 {
+#ifdef CONFIG_PROC_FS
 	mode_t mode = S_IFREG | S_IRUGO | S_IWUSR;
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	struct proc_dir_entry *proc;

 	if (sbi->s_proc == NULL)
 		return -EINVAL;
+#endif

 	EXT4_PROC_HANDLER(EXT4_MB_STATS_NAME, mb_stats);
 	EXT4_PROC_HANDLER(EXT4_MB_MAX_TO_SCAN_NAME, mb_max_to_scan);
@@ -2739,10 +2741,12 @@ err_out:

 static int ext4_mb_destroy_per_dev_proc(struct super_block *sb)
 {
+#ifdef CONFIG_PROC_FS
 	struct ext4_sb_info *sbi = EXT4_SB(sb);

 	if (sbi->s_proc == NULL)
 		return -EINVAL;
+#endif

 	remove_proc_entry(EXT4_MB_GROUP_PREALLOC, sbi->s_proc);
 	remove_proc_entry(EXT4_MB_STREAM_REQ, sbi->s_proc);
-- 
1.5.4.3


Thanks -
Manish

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

* Re: [PATCH] ext4: Remove compilation warnings in fs/ext4/mballoc.c
  2008-10-16 10:03 [PATCH] ext4: Remove compilation warnings in fs/ext4/mballoc.c Manish Katiyar
@ 2008-10-16 15:12 ` Theodore Tso
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Tso @ 2008-10-16 15:12 UTC (permalink / raw)
  To: Manish Katiyar; +Cc: ext4

On Thu, Oct 16, 2008 at 03:33:02PM +0530, Manish Katiyar wrote:
> I think a cleaner fix would be to call these functions only when
> CONFIG_PROC_FS is set and cleanup EXT4_PROC_HANDLER to be always
> defined . Also since s_proc in sb only makes sense when procfs is
> configured should that also be ifdef'd in the structure itself ??
> Let me know if these cleanup can be done in a better way (or the way
> you would prefer :-) . I can do this.

What I put into the patch queue comments out all of
ext4_mb_init_per_dev_proc() and ext4_mb_destroy_per_dev_proc() if
CONFIG_PROC_FS is not defined.  This not the common case, (even "make
allnoconfig" leaves CONFIG_PROC_FS defined), so don't think it's worth
messing with #ifdef'ing the structure, and adding to add even more
#ifdef's into the code.  For a similar reason it's not worth it to add
#ifdef's to the call sites of these functions.  It just clutters the
code more, and gcc should be able to optimize out a call to an empty
static function anyway.

						- Ted

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

end of thread, other threads:[~2008-10-16 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-16 10:03 [PATCH] ext4: Remove compilation warnings in fs/ext4/mballoc.c Manish Katiyar
2008-10-16 15:12 ` Theodore Tso

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).