mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch] 2.4.19 Generate better code for nfs_sillyrename
@ 2002-08-28  7:07 Keith Owens
  2002-08-31 14:58 ` Daniel Phillips
  0 siblings, 1 reply; 2+ messages in thread
From: Keith Owens @ 2002-08-28  7:07 UTC (permalink / raw)
  To: neilb; +Cc: linux-kernel

Using strlen() generates an unnecessary inline function expansion plus
dynamic stack adjustment.  For constant strings, strlen() == sizeof()-1
and the object code is better.  Patch against 2.4.19.

diff -urp 2.4.x-xfs-linux/fs/nfs/dir.c 2.4.x-xfs-linux-kdb/fs/nfs/dir.c
--- 2.4.x-xfs-linux/fs/nfs/dir.c	Fri Aug  9 16:03:57 2002
+++ 2.4.x-xfs-linux-kdb/fs/nfs/dir.c	Wed Aug 28 16:54:44 2002
@@ -741,7 +741,7 @@ static int nfs_sillyrename(struct inode 
 	static unsigned int sillycounter;
 	const int      i_inosize  = sizeof(dir->i_ino)*2;
 	const int      countersize = sizeof(sillycounter)*2;
-	const int      slen       = strlen(".nfs") + i_inosize + countersize;
+	const int      slen       = sizeof(".nfs")-1 + i_inosize + countersize;
 	char           silly[slen+1];
 	struct qstr    qsilly;
 	struct dentry *sdentry;


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

* Re: [patch] 2.4.19 Generate better code for nfs_sillyrename
  2002-08-28  7:07 [patch] 2.4.19 Generate better code for nfs_sillyrename Keith Owens
@ 2002-08-31 14:58 ` Daniel Phillips
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Phillips @ 2002-08-31 14:58 UTC (permalink / raw)
  To: Keith Owens, neilb; +Cc: linux-kernel

On Wednesday 28 August 2002 09:07, Keith Owens wrote:
> Using strlen() generates an unnecessary inline function expansion plus
> dynamic stack adjustment.  For constant strings, strlen() == sizeof()-1
> and the object code is better.  Patch against 2.4.19.

But now the source code is worse.  Macro?

> diff -urp 2.4.x-xfs-linux/fs/nfs/dir.c 2.4.x-xfs-linux-kdb/fs/nfs/dir.c
> --- 2.4.x-xfs-linux/fs/nfs/dir.c	Fri Aug  9 16:03:57 2002
> +++ 2.4.x-xfs-linux-kdb/fs/nfs/dir.c	Wed Aug 28 16:54:44 2002
> @@ -741,7 +741,7 @@ static int nfs_sillyrename(struct inode 
>  	static unsigned int sillycounter;
>  	const int      i_inosize  = sizeof(dir->i_ino)*2;
>  	const int      countersize = sizeof(sillycounter)*2;
> -	const int      slen       = strlen(".nfs") + i_inosize + countersize;
> +	const int      slen       = sizeof(".nfs")-1 + i_inosize + countersize;
>  	char           silly[slen+1];
>  	struct qstr    qsilly;
>  	struct dentry *sdentry;

-- 
Daniel

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

end of thread, other threads:[~2002-08-31 14:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-28  7:07 [patch] 2.4.19 Generate better code for nfs_sillyrename Keith Owens
2002-08-31 14:58 ` Daniel Phillips

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

all inboxes | Powered by JetHome®