Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1734996 > unrolled thread
| Started by | Colin King <colin.king@canonical.com> |
|---|---|
| First post | 2017-09-19 17:10 +0200 |
| Last post | 2017-09-19 17:20 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] btrfs: make array types static const, reduces object code size Colin King <colin.king@canonical.com> - 2017-09-19 17:10 +0200
Re: [PATCH] btrfs: make array types static const, reduces object code size David Sterba <dsterba@suse.cz> - 2017-09-19 17:20 +0200
| From | Colin King <colin.king@canonical.com> |
|---|---|
| Date | 2017-09-19 17:10 +0200 |
| Subject | [PATCH] btrfs: make array types static const, reduces object code size |
| Message-ID | <ursjU-74b-33@gated-at.bofh.it> |
From: Colin Ian King <colin.king@canonical.com>
Don't populate the read-only array types on the stack, instead make
it static const. Makes the object code smaller by nearly 60 bytes:
Before:
text data bss dec hex filename
90536 6552 64 97152 17b80 fs/btrfs/ioctl.o
After:
text data bss dec hex filename
90414 6616 64 97094 17b46 fs/btrfs/ioctl.o
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
fs/btrfs/ioctl.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index a74ed6c12d6a..feab6f61cb97 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -4114,10 +4114,12 @@ static long btrfs_ioctl_space_info(struct btrfs_fs_info *fs_info,
struct btrfs_ioctl_space_info *dest_orig;
struct btrfs_ioctl_space_info __user *user_dest;
struct btrfs_space_info *info;
- u64 types[] = {BTRFS_BLOCK_GROUP_DATA,
- BTRFS_BLOCK_GROUP_SYSTEM,
- BTRFS_BLOCK_GROUP_METADATA,
- BTRFS_BLOCK_GROUP_DATA | BTRFS_BLOCK_GROUP_METADATA};
+ static const u64 types[] = {
+ BTRFS_BLOCK_GROUP_DATA,
+ BTRFS_BLOCK_GROUP_SYSTEM,
+ BTRFS_BLOCK_GROUP_METADATA,
+ BTRFS_BLOCK_GROUP_DATA | BTRFS_BLOCK_GROUP_METADATA
+ };
int num_types = 4;
int alloc_size;
int ret = 0;
--
2.14.1
[toc] | [next] | [standalone]
| From | David Sterba <dsterba@suse.cz> |
|---|---|
| Date | 2017-09-19 17:20 +0200 |
| Subject | Re: [PATCH] btrfs: make array types static const, reduces object code size |
| Message-ID | <urstz-77o-3@gated-at.bofh.it> |
| In reply to | #1734996 |
On Tue, Sep 19, 2017 at 04:01:23PM +0100, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Don't populate the read-only array types on the stack, instead make > it static const. Makes the object code smaller by nearly 60 bytes: > > Before: > text data bss dec hex filename > 90536 6552 64 97152 17b80 fs/btrfs/ioctl.o > > After: > text data bss dec hex filename > 90414 6616 64 97094 17b46 fs/btrfs/ioctl.o > > Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: David Sterba <dsterba@suse.com>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web