linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Faster ext2_clear_inode()
@ 2007-07-09  4:11 Alexey Dobriyan
  2007-07-09  8:34 ` Jörn Engel
  0 siblings, 1 reply; 7+ messages in thread
From: Alexey Dobriyan @ 2007-07-09  4:11 UTC (permalink / raw)
  To: akpm; +Cc: linux-ext4, linux-fsdevel

If CONFIG_EXT2_FS_POSIX_ACL is not configured, ext2_clear_inode() will be empty
function. However, there still will be call and immediate return which can be
avoided.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 fs/ext2/super.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -184,9 +184,9 @@ static void destroy_inodecache(void)
 	kmem_cache_destroy(ext2_inode_cachep);
 }
 
+#ifdef CONFIG_EXT2_FS_POSIX_ACL
 static void ext2_clear_inode(struct inode *inode)
 {
-#ifdef CONFIG_EXT2_FS_POSIX_ACL
 	struct ext2_inode_info *ei = EXT2_I(inode);
 
 	if (ei->i_acl && ei->i_acl != EXT2_ACL_NOT_CACHED) {
@@ -197,8 +197,10 @@ static void ext2_clear_inode(struct inode *inode)
 		posix_acl_release(ei->i_default_acl);
 		ei->i_default_acl = EXT2_ACL_NOT_CACHED;
 	}
-#endif
 }
+#else
+#define ext2_clear_inode NULL
+#endif
 
 static int ext2_show_options(struct seq_file *seq, struct vfsmount *vfs)
 {

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

* Re: [PATCH] Faster ext2_clear_inode()
  2007-07-09  4:11 [PATCH] Faster ext2_clear_inode() Alexey Dobriyan
@ 2007-07-09  8:34 ` Jörn Engel
  2007-07-09 18:01   ` Alexey Dobriyan
  0 siblings, 1 reply; 7+ messages in thread
From: Jörn Engel @ 2007-07-09  8:34 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: akpm, linux-ext4, linux-fsdevel

On Mon, 9 July 2007 08:11:22 +0400, Alexey Dobriyan wrote:
> 
> If CONFIG_EXT2_FS_POSIX_ACL is not configured, ext2_clear_inode() will be empty
> function. However, there still will be call and immediate return which can be
> avoided.
> [...]
> +#ifdef CONFIG_EXT2_FS_POSIX_ACL
>  static void ext2_clear_inode(struct inode *inode)
>  {
> -#ifdef CONFIG_EXT2_FS_POSIX_ACL
>  	struct ext2_inode_info *ei = EXT2_I(inode);
>  
>  	if (ei->i_acl && ei->i_acl != EXT2_ACL_NOT_CACHED) {
> @@ -197,8 +197,10 @@ static void ext2_clear_inode(struct inode *inode)
>  		posix_acl_release(ei->i_default_acl);
>  		ei->i_default_acl = EXT2_ACL_NOT_CACHED;
>  	}
> -#endif
>  }
> +#else
> +#define ext2_clear_inode NULL
> +#endif

Are you sure your patch makes a difference?  Does the resulting binary
change at all?

Jörn

-- 
Fancy algorithms are slow when n is small, and n is usually small.
Fancy algorithms have big constants. Until you know that n is
frequently going to be big, don't get fancy.
-- Rob Pike
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] Faster ext2_clear_inode()
  2007-07-09  8:34 ` Jörn Engel
@ 2007-07-09 18:01   ` Alexey Dobriyan
  2007-07-09 20:00     ` Jörn Engel
  0 siblings, 1 reply; 7+ messages in thread
From: Alexey Dobriyan @ 2007-07-09 18:01 UTC (permalink / raw)
  To: Jörn Engel; +Cc: akpm, linux-ext4, linux-fsdevel

On Mon, Jul 09, 2007 at 10:34:32AM +0200, Jörn Engel wrote:
> On Mon, 9 July 2007 08:11:22 +0400, Alexey Dobriyan wrote:
> > 
> > If CONFIG_EXT2_FS_POSIX_ACL is not configured, ext2_clear_inode() will be empty
> > function. However, there still will be call and immediate return which can be
> > avoided.
> > [...]
> > +#ifdef CONFIG_EXT2_FS_POSIX_ACL
> >  static void ext2_clear_inode(struct inode *inode)
> >  {
> > -#ifdef CONFIG_EXT2_FS_POSIX_ACL
> >  	struct ext2_inode_info *ei = EXT2_I(inode);
> >  
> >  	if (ei->i_acl && ei->i_acl != EXT2_ACL_NOT_CACHED) {
> > @@ -197,8 +197,10 @@ static void ext2_clear_inode(struct inode *inode)
> >  		posix_acl_release(ei->i_default_acl);
> >  		ei->i_default_acl = EXT2_ACL_NOT_CACHED;
> >  	}
> > -#endif
> >  }
> > +#else
> > +#define ext2_clear_inode NULL
> > +#endif
> 
> Are you sure your patch makes a difference?  Does the resulting binary
> change at all?

Yes. Note that ext2_clear_inode() is referenced from ext2_sops, so even
empty, it leaves traces in resulting kernel.

-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] Faster ext2_clear_inode()
  2007-07-09 18:01   ` Alexey Dobriyan
@ 2007-07-09 20:00     ` Jörn Engel
  2007-07-09 22:02       ` Dave Kleikamp
  2007-07-20  0:31       ` Andrew Morton
  0 siblings, 2 replies; 7+ messages in thread
From: Jörn Engel @ 2007-07-09 20:00 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: Jörn Engel, akpm, linux-ext4, linux-fsdevel

On Mon, 9 July 2007 22:01:48 +0400, Alexey Dobriyan wrote:
> 
> Yes. Note that ext2_clear_inode() is referenced from ext2_sops, so even
> empty, it leaves traces in resulting kernel.

Is that your opinion or have you actually measured a difference?
I strongly suspect that compilers are smart enough to optimize away a
call to an empty static function.

Jörn

-- 
Fancy algorithms are slow when n is small, and n is usually small.
Fancy algorithms have big constants. Until you know that n is
frequently going to be big, don't get fancy.
-- Rob Pike

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

* Re: [PATCH] Faster ext2_clear_inode()
  2007-07-09 20:00     ` Jörn Engel
@ 2007-07-09 22:02       ` Dave Kleikamp
  2007-07-09 22:12         ` Jörn Engel
  2007-07-20  0:31       ` Andrew Morton
  1 sibling, 1 reply; 7+ messages in thread
From: Dave Kleikamp @ 2007-07-09 22:02 UTC (permalink / raw)
  To: Jörn Engel; +Cc: Alexey Dobriyan, akpm, linux-ext4, linux-fsdevel

On Mon, 2007-07-09 at 22:00 +0200, Jörn Engel wrote:
> On Mon, 9 July 2007 22:01:48 +0400, Alexey Dobriyan wrote:
> > 
> > Yes. Note that ext2_clear_inode() is referenced from ext2_sops, so even
> > empty, it leaves traces in resulting kernel.
> 
> Is that your opinion or have you actually measured a difference?
> I strongly suspect that compilers are smart enough to optimize away a
> call to an empty static function.

It's not a direct call to a static function.  It is called as a
super_ops method.  I don't think the overhead is very significant, but
it doesn't look like it could do any harm.

-- 
David Kleikamp
IBM Linux Technology Center

-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] Faster ext2_clear_inode()
  2007-07-09 22:02       ` Dave Kleikamp
@ 2007-07-09 22:12         ` Jörn Engel
  0 siblings, 0 replies; 7+ messages in thread
From: Jörn Engel @ 2007-07-09 22:12 UTC (permalink / raw)
  To: Dave Kleikamp
  Cc: Jörn Engel, Alexey Dobriyan, akpm, linux-ext4, linux-fsdevel

On Mon, 9 July 2007 17:02:20 -0500, Dave Kleikamp wrote:
> 
> It's not a direct call to a static function.  It is called as a
> super_ops method.  I don't think the overhead is very significant, but
> it doesn't look like it could do any harm.

Ah, I missed that fact.  Yep, looks fine to me.

Jörn

-- 
Joern's library part 7:
http://www.usenix.org/publications/library/proceedings/neworl/full_papers/mckusick.a

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

* Re: [PATCH] Faster ext2_clear_inode()
  2007-07-09 20:00     ` Jörn Engel
  2007-07-09 22:02       ` Dave Kleikamp
@ 2007-07-20  0:31       ` Andrew Morton
  1 sibling, 0 replies; 7+ messages in thread
From: Andrew Morton @ 2007-07-20  0:31 UTC (permalink / raw)
  To: Jörn Engel; +Cc: Alexey Dobriyan, linux-ext4, linux-fsdevel

On Mon, 9 Jul 2007 22:00:03 +0200
Jörn Engel <joern@logfs.org> wrote:

> On Mon, 9 July 2007 22:01:48 +0400, Alexey Dobriyan wrote:
> > 
> > Yes. Note that ext2_clear_inode() is referenced from ext2_sops, so even
> > empty, it leaves traces in resulting kernel.
> 
> Is that your opinion or have you actually measured a difference?
> I strongly suspect that compilers are smart enough to optimize away a
> call to an empty static function.
> 

It saves a big 16 bytes of text here.

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

end of thread, other threads:[~2007-07-20  0:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-09  4:11 [PATCH] Faster ext2_clear_inode() Alexey Dobriyan
2007-07-09  8:34 ` Jörn Engel
2007-07-09 18:01   ` Alexey Dobriyan
2007-07-09 20:00     ` Jörn Engel
2007-07-09 22:02       ` Dave Kleikamp
2007-07-09 22:12         ` Jörn Engel
2007-07-20  0:31       ` Andrew Morton

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