Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

befs: don't pass huge structs by value

'struct befs_disk_data_stream' is huge (~144 bytes) and it's being passed
by value in fs/befs/endian.h::cpu_to_fsrun().

It would be better to pass a pointer.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Cc: Will Dyson <will_dyson@pobox.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Jesper Juhl and committed by
Linus Torvalds
e0e3d32b 25f959d6

+9 -9
+8 -8
fs/befs/endian.h
··· 102 102 } 103 103 104 104 static inline befs_data_stream 105 - fsds_to_cpu(const struct super_block *sb, befs_disk_data_stream n) 105 + fsds_to_cpu(const struct super_block *sb, const befs_disk_data_stream *n) 106 106 { 107 107 befs_data_stream data; 108 108 int i; 109 109 110 110 for (i = 0; i < BEFS_NUM_DIRECT_BLOCKS; ++i) 111 - data.direct[i] = fsrun_to_cpu(sb, n.direct[i]); 111 + data.direct[i] = fsrun_to_cpu(sb, n->direct[i]); 112 112 113 - data.max_direct_range = fs64_to_cpu(sb, n.max_direct_range); 114 - data.indirect = fsrun_to_cpu(sb, n.indirect); 115 - data.max_indirect_range = fs64_to_cpu(sb, n.max_indirect_range); 116 - data.double_indirect = fsrun_to_cpu(sb, n.double_indirect); 113 + data.max_direct_range = fs64_to_cpu(sb, n->max_direct_range); 114 + data.indirect = fsrun_to_cpu(sb, n->indirect); 115 + data.max_indirect_range = fs64_to_cpu(sb, n->max_indirect_range); 116 + data.double_indirect = fsrun_to_cpu(sb, n->double_indirect); 117 117 data.max_double_indirect_range = fs64_to_cpu(sb, 118 - n. 118 + n-> 119 119 max_double_indirect_range); 120 - data.size = fs64_to_cpu(sb, n.size); 120 + data.size = fs64_to_cpu(sb, n->size); 121 121 122 122 return data; 123 123 }
+1 -1
fs/befs/linuxvfs.c
··· 390 390 int num_blks; 391 391 392 392 befs_ino->i_data.ds = 393 - fsds_to_cpu(sb, raw_inode->data.datastream); 393 + fsds_to_cpu(sb, &raw_inode->data.datastream); 394 394 395 395 num_blks = befs_count_blocks(sb, &befs_ino->i_data.ds); 396 396 inode->i_blocks =