Re: [PATCH] befs: Don't pass huge structs by value.

From: Geert Uytterhoeven
Date: Sun Dec 26 2010 - 03:48:53 EST


On Sat, Dec 25, 2010 at 20:27, Jesper Juhl <jj@xxxxxxxxxxxxx> wrote:
> '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 seems to me that it would be better to pass a pointer, no?
> This patch changes the function to take a pointer to the large struct.
>
> Signed-off-by: Jesper Juhl <jj@xxxxxxxxxxxxx>
> ---
> Âendian.h  |  16 ++++++++--------
> Âlinuxvfs.c | Â Â2 +-
> Â2 files changed, 9 insertions(+), 9 deletions(-)
>
> ÂCompile tested only. I have no way to test this.
>
> diff --git a/fs/befs/endian.h b/fs/befs/endian.h
> index 6cb84d8..a99caa0 100644
> --- a/fs/befs/endian.h
> +++ b/fs/befs/endian.h
> @@ -102,22 +102,22 @@ cpu_to_fsrun(const struct super_block *sb, befs_block_run n)
> Â}
>
> Âstatic inline befs_data_stream
> -fsds_to_cpu(const struct super_block *sb, befs_disk_data_stream n)
> +fsds_to_cpu(const struct super_block *sb, befs_disk_data_stream *n)

Please make befs_disk_data_stream const, so people don't accidentally modify it.

Gr{oetje,eeting}s,

            Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
             Â Â -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/