Skip to content

Commit 4d61eda

Browse files
Colin Ian Kingsmfrench
authored andcommitted
CIFS: make arrays static const, reduces object code size
Don't populate the read-only arrays types[] on the stack, instead make them both static const. Makes the object code smaller by over 200 bytes: Before: text data bss dec hex filename 111503 37696 448 149647 2488f fs/cifs/file.o After: text data bss dec hex filename 111140 37856 448 149444 247c4 fs/cifs/file.o Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Steve French <[email protected]> Reviewed-by: Ronnie Sahlberg <[email protected]>
1 parent 1fa089e commit 4d61eda

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

fs/cifs/file.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,8 +1102,10 @@ cifs_push_mandatory_locks(struct cifsFileInfo *cfile)
11021102
struct cifs_tcon *tcon;
11031103
unsigned int num, max_num, max_buf;
11041104
LOCKING_ANDX_RANGE *buf, *cur;
1105-
int types[] = {LOCKING_ANDX_LARGE_FILES,
1106-
LOCKING_ANDX_SHARED_LOCK | LOCKING_ANDX_LARGE_FILES};
1105+
static const int types[] = {
1106+
LOCKING_ANDX_LARGE_FILES,
1107+
LOCKING_ANDX_SHARED_LOCK | LOCKING_ANDX_LARGE_FILES
1108+
};
11071109
int i;
11081110

11091111
xid = get_xid();
@@ -1434,8 +1436,10 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
14341436
unsigned int xid)
14351437
{
14361438
int rc = 0, stored_rc;
1437-
int types[] = {LOCKING_ANDX_LARGE_FILES,
1438-
LOCKING_ANDX_SHARED_LOCK | LOCKING_ANDX_LARGE_FILES};
1439+
static const int types[] = {
1440+
LOCKING_ANDX_LARGE_FILES,
1441+
LOCKING_ANDX_SHARED_LOCK | LOCKING_ANDX_LARGE_FILES
1442+
};
14391443
unsigned int i;
14401444
unsigned int max_num, num, max_buf;
14411445
LOCKING_ANDX_RANGE *buf, *cur;

0 commit comments

Comments
 (0)