linux/fs/nfs
Boaz Harrosh 5318a29c19 pnfs-obj: Uglify objio_segment allocation for the sake of the principle :-(
At some past instance Linus Trovalds wrote:
> From: Linus Torvalds <torvalds@linux-foundation.org>
> commit a84a79e4d3 upstream.
>
> The size is always valid, but variable-length arrays generate worse code
> for no good reason (unless the function happens to be inlined and the
> compiler sees the length for the simple constant it is).
>
> Also, there seems to be some code generation problem on POWER, where
> Henrik Bakken reports that register r28 can get corrupted under some
> subtle circumstances (interrupt happening at the wrong time?).  That all
> indicates some seriously broken compiler issues, but since variable
> length arrays are bad regardless, there's little point in trying to
> chase it down.
>
> "Just don't do that, then".

Since then any use of "variable length arrays" has become blasphemous.
Even in perfectly good, beautiful, perfectly safe code like the one
below where the variable length arrays are only used as a sizeof()
parameter, for type-safe dynamic structure allocations. GCC is not
executing any stack allocation code.

I have produced a small file which defines two functions main1(unsigned numdevs)
and main2(unsigned numdevs). main1 uses code as before with call to malloc
and main2 uses code as of after this patch. I compiled it as:
	gcc -O2 -S see_asm.c
and here is what I get:

<see_asm.s>
main1:
.LFB7:
	.cfi_startproc
	mov	%edi, %edi
	leaq	4(%rdi,%rdi), %rdi
	salq	$3, %rdi
	jmp	malloc
	.cfi_endproc
.LFE7:
	.size	main1, .-main1
	.p2align 4,,15
	.globl	main2
	.type	main2, @function
main2:
.LFB8:
	.cfi_startproc
	mov	%edi, %edi
	addq	$2, %rdi
	salq	$4, %rdi
	jmp	malloc
	.cfi_endproc
.LFE8:
	.size	main2, .-main2
	.section	.text.startup,"ax",@progbits
	.p2align 4,,15
</see_asm.s>

*Exact* same code !!!

So please seriously consider not accepting this patch and leave the
perfectly good code intact.

CC: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-03-13 23:47:59 -04:00
..
blocklayout NFS: null dereference in dev_remove() 2012-03-13 15:33:08 -04:00
objlayout pnfs-obj: Uglify objio_segment allocation for the sake of the principle :-( 2012-03-13 23:47:59 -04:00
Kconfig NFSv4: Send implementation id with exchange_id 2012-03-01 17:10:21 -05:00
Makefile pnfsblock: add blocklayout Kconfig option, Makefile, and stubs 2011-07-31 12:18:15 -04:00
cache_lib.c NFS: remove RPC PipeFS mount point references from NFS cache routines 2012-01-31 18:20:26 -05:00
cache_lib.h NFS: DNS resolver PipeFS notifier introduced 2012-01-31 18:20:26 -05:00
callback.c NFS: Fix a number of sparse warnings 2012-03-11 15:14:16 -04:00
callback.h NFSv4.1: Convert slotid from u8 to u32 2012-02-15 00:19:43 -05:00
callback_proc.c NFSv4: Further clean-ups of delegation stateid validation 2012-03-06 10:32:44 -05:00
callback_xdr.c NFSv4: Rate limit the state manager warning messages 2012-03-12 18:15:22 -04:00
client.c NFS: Only define some function when v4.1 is enabled 2012-03-12 12:51:40 -04:00
delegation.c NFS: Fix a number of sparse warnings 2012-03-11 15:14:16 -04:00
delegation.h NFSv4.0: Re-establish the callback channel on NFS4ERR_CB_PATHDOWN 2012-03-10 11:54:36 -05:00
dir.c NFS: Make nfs_cache_array.size a signed integer 2012-03-02 15:36:13 -05:00
direct.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
dns_resolve.c NFS: Fix a number of sparse warnings 2012-03-11 15:14:16 -04:00
dns_resolve.h NFS: DNS resolver cache per network namespace context introduced 2012-01-31 18:20:26 -05:00
file.c NFS: Ensure that mmapped pages remain stable during writeback 2012-01-31 19:28:08 -05:00
fscache-index.c NFS: Use the inode->i_version to cache NFSv4 change attribute information 2011-10-18 09:14:34 -07:00
fscache.c FS-Cache: Add a helper to bulk uncache pages on an inode 2011-07-07 13:21:56 -07:00
fscache.h
getroot.c Merge branch 'nfs-for-2.6.39' into nfs-for-next 2011-03-24 17:03:14 -04:00
idmap.c NFS: Check return value from rpc_queue_upcall() 2012-03-12 12:51:42 -04:00
inode.c NFS: remove nfs_inode radix tree 2012-03-10 17:14:10 -05:00
internal.h NFS: remove nfs_inode radix tree 2012-03-10 17:14:10 -05:00
iostat.h
mount_clnt.c SUNRPC: constify the rpc_program 2012-01-31 19:28:20 -05:00
namespace.c nfs: Clean up debugging in nfs_follow_mountpoint() 2012-02-16 15:05:16 -05:00
netns.h NFS: replace global bl_wq with per-net one 2012-03-11 10:57:35 -04:00
nfs2xdr.c SUNRPC: constify the rpc_program 2012-01-31 19:28:20 -05:00
nfs3acl.c NFS: Fix a number of sparse warnings 2012-03-11 15:14:16 -04:00
nfs3proc.c Freezer / sunrpc / NFS: don't allow TASK_KILLABLE sleeps to block the freezer 2011-12-06 22:12:27 +01:00
nfs3xdr.c SUNRPC: constify the rpc_program 2012-01-31 19:28:20 -05:00
nfs4_fs.h NFSv4: Clean up nfs4_select_rw_stateid() 2012-03-08 22:38:55 -05:00
nfs4filelayout.c NFS: Fix a number of sparse warnings 2012-03-11 15:14:16 -04:00
nfs4filelayout.h NFS: remove nfs_inode radix tree 2012-03-10 17:14:10 -05:00
nfs4filelayoutdev.c NFS: Fix a number of sparse warnings 2012-03-11 15:14:16 -04:00
nfs4namespace.c SUNRPC: Use RCU to dereference the rpc_clnt.cl_xprt field 2012-03-02 15:36:38 -05:00
nfs4proc.c NFSv4: Rate limit the state manager warning messages 2012-03-12 18:15:22 -04:00
nfs4renewd.c NFSv4: The NFSv4.0 client must send RENEW calls if it holds a delegation 2011-08-24 15:07:37 -04:00
nfs4state.c NFSv4: Rate limit the state manager warning messages 2012-03-12 18:15:22 -04:00
nfs4xdr.c NFSv4: Clean up nfs4_select_rw_stateid() 2012-03-08 22:38:55 -05:00
nfsroot.c NFS: Revert NFSROOT default mount options 2011-05-27 17:42:47 -04:00
pagelist.c NFS: remove nfs_inode radix tree 2012-03-10 17:14:10 -05:00
pnfs.c NFSv4: Simplify the struct nfs4_stateid 2012-03-06 10:32:47 -05:00
pnfs.h NFS: remove nfs_inode radix tree 2012-03-10 17:14:10 -05:00
pnfs_dev.c NFS: Fix a number of sparse warnings 2012-03-11 15:14:16 -04:00
proc.c Freezer / sunrpc / NFS: don't allow TASK_KILLABLE sleeps to block the freezer 2011-12-06 22:12:27 +01:00
read.c NFSv41: Add a new helper nfs4_init_sequence() 2012-01-31 19:28:06 -05:00
super.c NFS: Fix a compile issue when !CONFIG_NFS_V4_1 2012-03-05 15:27:01 -05:00
symlink.c
sysctl.c NFS: Fall back on old idmapper if request_key() fails 2012-02-06 18:48:01 -05:00
unlink.c NFS: Fix a number of sparse warnings 2012-03-11 15:14:16 -04:00
write.c NFS: remove nfs_inode radix tree 2012-03-10 17:14:10 -05:00