All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cifs: make const array static, makes object smaller
@ 2020-10-20 14:19 ` Colin King
  0 siblings, 0 replies; 6+ messages in thread
From: Colin King @ 2020-10-20 14:19 UTC (permalink / raw)
  To: Steve French, linux-cifs, samba-technical; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Don't populate const array smb3_create_tag_posix on the stack but
instead make it static. Makes the object code smaller by 50 bytes.

Before:
   text	   data	    bss	    dec	    hex	filename
 150184	  47167	      0	 197351	  302e7	fs/cifs/smb2pdu.o

After:
    text	   data	    bss	    dec	    hex	filename
 150070	  47231	      0	 197301	  302b5	fs/cifs/smb2pdu.o

(gcc version 10.2.0)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/cifs/smb2pdu.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index d504bc296349..be8696abd871 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1971,9 +1971,11 @@ smb2_parse_contexts(struct TCP_Server_Info *server,
 	unsigned int next;
 	unsigned int remaining;
 	char *name;
-	const char smb3_create_tag_posix[] = {0x93, 0xAD, 0x25, 0x50, 0x9C,
-					0xB4, 0x11, 0xE7, 0xB4, 0x23, 0x83,
-					0xDE, 0x96, 0x8B, 0xCD, 0x7C};
+	static const char smb3_create_tag_posix[] = {
+		0x93, 0xAD, 0x25, 0x50, 0x9C,
+		0xB4, 0x11, 0xE7, 0xB4, 0x23, 0x83,
+		0xDE, 0x96, 0x8B, 0xCD, 0x7C
+	};
 
 	*oplock = 0;
 	data_offset = (char *)rsp + le32_to_cpu(rsp->CreateContextsOffset);
-- 
2.27.0


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

* [PATCH] cifs: make const array static, makes object smaller
@ 2020-10-20 14:19 ` Colin King
  0 siblings, 0 replies; 6+ messages in thread
From: Colin King @ 2020-10-20 14:19 UTC (permalink / raw)
  To: Steve French, linux-cifs, samba-technical; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Don't populate const array smb3_create_tag_posix on the stack but
instead make it static. Makes the object code smaller by 50 bytes.

Before:
   text	   data	    bss	    dec	    hex	filename
 150184	  47167	      0	 197351	  302e7	fs/cifs/smb2pdu.o

After:
    text	   data	    bss	    dec	    hex	filename
 150070	  47231	      0	 197301	  302b5	fs/cifs/smb2pdu.o

(gcc version 10.2.0)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/cifs/smb2pdu.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index d504bc296349..be8696abd871 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1971,9 +1971,11 @@ smb2_parse_contexts(struct TCP_Server_Info *server,
 	unsigned int next;
 	unsigned int remaining;
 	char *name;
-	const char smb3_create_tag_posix[] = {0x93, 0xAD, 0x25, 0x50, 0x9C,
-					0xB4, 0x11, 0xE7, 0xB4, 0x23, 0x83,
-					0xDE, 0x96, 0x8B, 0xCD, 0x7C};
+	static const char smb3_create_tag_posix[] = {
+		0x93, 0xAD, 0x25, 0x50, 0x9C,
+		0xB4, 0x11, 0xE7, 0xB4, 0x23, 0x83,
+		0xDE, 0x96, 0x8B, 0xCD, 0x7C
+	};
 
 	*oplock = 0;
 	data_offset = (char *)rsp + le32_to_cpu(rsp->CreateContextsOffset);
-- 
2.27.0

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

* Re: [PATCH] cifs: make const array static, makes object smaller
  2020-10-20 14:19 ` Colin King
@ 2020-10-20 14:29   ` Aurélien Aptel
  -1 siblings, 0 replies; 6+ messages in thread
From: Aurélien Aptel @ 2020-10-20 14:29 UTC (permalink / raw)
  To: Colin King, Steve French, linux-cifs, samba-technical
  Cc: kernel-janitors, linux-kernel


Reviewed-by: Aurelien Aptel <aaptel@suse.com>

-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)


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

* Re: [PATCH] cifs: make const array static, makes object smaller
@ 2020-10-20 14:29   ` Aurélien Aptel
  0 siblings, 0 replies; 6+ messages in thread
From: Aurélien Aptel @ 2020-10-20 14:29 UTC (permalink / raw)
  To: Colin King, Steve French, linux-cifs, samba-technical
  Cc: kernel-janitors, linux-kernel


Reviewed-by: Aurelien Aptel <aaptel@suse.com>

-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)

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

* Re: [PATCH] cifs: make const array static, makes object smaller
  2020-10-20 14:19 ` Colin King
@ 2020-10-20 16:55   ` Steve French
  -1 siblings, 0 replies; 6+ messages in thread
From: Steve French @ 2020-10-20 16:55 UTC (permalink / raw)
  To: Colin King, Aurélien Aptel
  Cc: Steve French, CIFS, samba-technical, kernel-janitors, LKML

added Aurelien's Reviewed-by and merged into cifs-2.6.git for-next

On Tue, Oct 20, 2020 at 9:22 AM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> Don't populate const array smb3_create_tag_posix on the stack but
> instead make it static. Makes the object code smaller by 50 bytes.
>
> Before:
>    text    data     bss     dec     hex filename
>  150184   47167       0  197351   302e7 fs/cifs/smb2pdu.o
>
> After:
>     text           data     bss     dec     hex filename
>  150070   47231       0  197301   302b5 fs/cifs/smb2pdu.o
>
> (gcc version 10.2.0)
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  fs/cifs/smb2pdu.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> index d504bc296349..be8696abd871 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -1971,9 +1971,11 @@ smb2_parse_contexts(struct TCP_Server_Info *server,
>         unsigned int next;
>         unsigned int remaining;
>         char *name;
> -       const char smb3_create_tag_posix[] = {0x93, 0xAD, 0x25, 0x50, 0x9C,
> -                                       0xB4, 0x11, 0xE7, 0xB4, 0x23, 0x83,
> -                                       0xDE, 0x96, 0x8B, 0xCD, 0x7C};
> +       static const char smb3_create_tag_posix[] = {
> +               0x93, 0xAD, 0x25, 0x50, 0x9C,
> +               0xB4, 0x11, 0xE7, 0xB4, 0x23, 0x83,
> +               0xDE, 0x96, 0x8B, 0xCD, 0x7C
> +       };
>
>         *oplock = 0;
>         data_offset = (char *)rsp + le32_to_cpu(rsp->CreateContextsOffset);
> --
> 2.27.0
>


-- 
Thanks,

Steve

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

* Re: [PATCH] cifs: make const array static, makes object smaller
@ 2020-10-20 16:55   ` Steve French
  0 siblings, 0 replies; 6+ messages in thread
From: Steve French @ 2020-10-20 16:55 UTC (permalink / raw)
  To: Colin King, Aurélien Aptel
  Cc: Steve French, CIFS, samba-technical, kernel-janitors, LKML

added Aurelien's Reviewed-by and merged into cifs-2.6.git for-next

On Tue, Oct 20, 2020 at 9:22 AM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> Don't populate const array smb3_create_tag_posix on the stack but
> instead make it static. Makes the object code smaller by 50 bytes.
>
> Before:
>    text    data     bss     dec     hex filename
>  150184   47167       0  197351   302e7 fs/cifs/smb2pdu.o
>
> After:
>     text           data     bss     dec     hex filename
>  150070   47231       0  197301   302b5 fs/cifs/smb2pdu.o
>
> (gcc version 10.2.0)
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  fs/cifs/smb2pdu.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> index d504bc296349..be8696abd871 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -1971,9 +1971,11 @@ smb2_parse_contexts(struct TCP_Server_Info *server,
>         unsigned int next;
>         unsigned int remaining;
>         char *name;
> -       const char smb3_create_tag_posix[] = {0x93, 0xAD, 0x25, 0x50, 0x9C,
> -                                       0xB4, 0x11, 0xE7, 0xB4, 0x23, 0x83,
> -                                       0xDE, 0x96, 0x8B, 0xCD, 0x7C};
> +       static const char smb3_create_tag_posix[] = {
> +               0x93, 0xAD, 0x25, 0x50, 0x9C,
> +               0xB4, 0x11, 0xE7, 0xB4, 0x23, 0x83,
> +               0xDE, 0x96, 0x8B, 0xCD, 0x7C
> +       };
>
>         *oplock = 0;
>         data_offset = (char *)rsp + le32_to_cpu(rsp->CreateContextsOffset);
> --
> 2.27.0
>


-- 
Thanks,

Steve

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

end of thread, other threads:[~2020-10-20 16:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-20 14:19 [PATCH] cifs: make const array static, makes object smaller Colin King
2020-10-20 14:19 ` Colin King
2020-10-20 14:29 ` Aurélien Aptel
2020-10-20 14:29   ` Aurélien Aptel
2020-10-20 16:55 ` Steve French
2020-10-20 16:55   ` Steve French

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.