LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Shrink ext3_inode_info by 8 bytes for !POSIX_ACL.
@ 2008-01-12 20:35 Indan Zupancic
  2008-01-18 19:16 ` Mingming Cao
  0 siblings, 1 reply; 3+ messages in thread
From: Indan Zupancic @ 2008-01-12 20:35 UTC (permalink / raw)
  To: linux-ext4, linux-kernel; +Cc: Indan Zupancic

i_file_acl and i_dir_acl aren't always needed.

With certain configs this makes 10 ext3_inode_cache objects fit in
one slab instead of the current 9, as the size shrinks from 416 to
408 bytes for 32 bit, !POSIX_ACL and !EXT3_FS_XATTR configs.

Signed-off-by: Indan Zupancic <indan@nul.nu>
---
 fs/ext3/ialloc.c          |    2 ++
 fs/ext3/inode.c           |   29 +++++++++++++++++++----------
 include/linux/ext3_fs_i.h |    2 ++
 3 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
index 1bc8cd8..01745bc 100644
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -574,8 +574,10 @@ got:
 	ei->i_frag_no = 0;
 	ei->i_frag_size = 0;
 #endif
+#ifdef CONFIG_EXT3_FS_POSIX_ACL
 	ei->i_file_acl = 0;
 	ei->i_dir_acl = 0;
+#endif
 	ei->i_dtime = 0;
 	ei->i_block_alloc_info = NULL;
 	ei->i_block_group = group;
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 9b162cd..20a8aeb 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -46,9 +46,12 @@ static int ext3_writepage_trans_blocks(struct inode *inode);
  */
 static int ext3_inode_is_fast_symlink(struct inode *inode)
 {
-	int ea_blocks = EXT3_I(inode)->i_file_acl ?
-		(inode->i_sb->s_blocksize >> 9) : 0;
+	int ea_blocks = 0;
 
+#ifdef CONFIG_EXT3_FS_POSIX_ACL
+	if (EXT3_I(inode)->i_file_acl)
+		ea_blocks = inode->i_sb->s_blocksize >> 9;
+#endif
 	return (S_ISLNK(inode->i_mode) && inode->i_blocks - ea_blocks == 0);
 }
 
@@ -2717,13 +2720,16 @@ void ext3_read_inode(struct inode * inode)
 	ei->i_frag_no = raw_inode->i_frag;
 	ei->i_frag_size = raw_inode->i_fsize;
 #endif
-	ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl);
-	if (!S_ISREG(inode->i_mode)) {
-		ei->i_dir_acl = le32_to_cpu(raw_inode->i_dir_acl);
-	} else {
+	if (S_ISREG(inode->i_mode)) {
 		inode->i_size |=
 			((__u64)le32_to_cpu(raw_inode->i_size_high)) << 32;
 	}
+#ifdef CONFIG_EXT3_FS_POSIX_ACL
+	else {
+		ei->i_dir_acl = le32_to_cpu(raw_inode->i_dir_acl);
+	}
+	ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl);
+#endif
 	ei->i_disksize = inode->i_size;
 	inode->i_generation = le32_to_cpu(raw_inode->i_generation);
 	ei->i_block_group = iloc.block_group;
@@ -2854,10 +2860,7 @@ static int ext3_do_update_inode(handle_t *handle,
 	raw_inode->i_frag = ei->i_frag_no;
 	raw_inode->i_fsize = ei->i_frag_size;
 #endif
-	raw_inode->i_file_acl = cpu_to_le32(ei->i_file_acl);
-	if (!S_ISREG(inode->i_mode)) {
-		raw_inode->i_dir_acl = cpu_to_le32(ei->i_dir_acl);
-	} else {
+	if (S_ISREG(inode->i_mode)) {
 		raw_inode->i_size_high =
 			cpu_to_le32(ei->i_disksize >> 32);
 		if (ei->i_disksize > 0x7fffffffULL) {
@@ -2883,6 +2886,12 @@ static int ext3_do_update_inode(handle_t *handle,
 			}
 		}
 	}
+#ifdef CONFIG_EXT3_FS_POSIX_ACL
+	else {
+		raw_inode->i_dir_acl = cpu_to_le32(ei->i_dir_acl);
+	}
+	raw_inode->i_file_acl = cpu_to_le32(ei->i_file_acl);
+#endif
 	raw_inode->i_generation = cpu_to_le32(inode->i_generation);
 	if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
 		if (old_valid_dev(inode->i_rdev)) {
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h
index 7894dd0..9e7f1b6 100644
--- a/include/linux/ext3_fs_i.h
+++ b/include/linux/ext3_fs_i.h
@@ -75,8 +75,10 @@ struct ext3_inode_info {
 	__u8	i_frag_no;
 	__u8	i_frag_size;
 #endif
+#ifdef CONFIG_EXT3_FS_POSIX_ACL
 	ext3_fsblk_t	i_file_acl;
 	__u32	i_dir_acl;
+#endif
 	__u32	i_dtime;
 
 	/*
-- 
1.5.3.7


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

* Re: [PATCH] Shrink ext3_inode_info by 8 bytes for !POSIX_ACL.
  2008-01-12 20:35 [PATCH] Shrink ext3_inode_info by 8 bytes for !POSIX_ACL Indan Zupancic
@ 2008-01-18 19:16 ` Mingming Cao
  2008-01-18 23:51   ` Indan Zupancic
  0 siblings, 1 reply; 3+ messages in thread
From: Mingming Cao @ 2008-01-18 19:16 UTC (permalink / raw)
  To: Indan Zupancic; +Cc: linux-ext4, linux-kernel

On Sat, 2008-01-12 at 21:35 +0100, Indan Zupancic wrote:
> i_file_acl and i_dir_acl aren't always needed.
> 
> With certain configs this makes 10 ext3_inode_cache objects fit in
> one slab instead of the current 9, as the size shrinks from 416 to
> 408 bytes for 32 bit, !POSIX_ACL and !EXT3_FS_XATTR configs.
> 
> Signed-off-by: Indan Zupancic <indan@nul.nu>
> ---
>  fs/ext3/ialloc.c          |    2 ++
>  fs/ext3/inode.c           |   29 +++++++++++++++++++----------
>  include/linux/ext3_fs_i.h |    2 ++
>  3 files changed, 23 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
> index 1bc8cd8..01745bc 100644
> --- a/fs/ext3/ialloc.c
> +++ b/fs/ext3/ialloc.c
> @@ -574,8 +574,10 @@ got:
>  	ei->i_frag_no = 0;
>  	ei->i_frag_size = 0;
>  #endif
> +#ifdef CONFIG_EXT3_FS_POSIX_ACL
>  	ei->i_file_acl = 0;
>  	ei->i_dir_acl = 0;
> +#endif

For regular file, i_dir_acl is being reused as i_size_high to support
large file.

Mingming


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

* Re: [PATCH] Shrink ext3_inode_info by 8 bytes for !POSIX_ACL.
  2008-01-18 19:16 ` Mingming Cao
@ 2008-01-18 23:51   ` Indan Zupancic
  0 siblings, 0 replies; 3+ messages in thread
From: Indan Zupancic @ 2008-01-18 23:51 UTC (permalink / raw)
  To: cmm; +Cc: linux-ext4, linux-kernel

On Fri, January 18, 2008 20:16, Mingming Cao wrote:
> On Sat, 2008-01-12 at 21:35 +0100, Indan Zupancic wrote:
>> i_file_acl and i_dir_acl aren't always needed.
>>
>> With certain configs this makes 10 ext3_inode_cache objects fit in
>> one slab instead of the current 9, as the size shrinks from 416 to
>> 408 bytes for 32 bit, !POSIX_ACL and !EXT3_FS_XATTR configs.
>>
>> Signed-off-by: Indan Zupancic <indan@nul.nu>
>> ---
>>  fs/ext3/ialloc.c          |    2 ++
>>  fs/ext3/inode.c           |   29 +++++++++++++++++++----------
>>  include/linux/ext3_fs_i.h |    2 ++
>>  3 files changed, 23 insertions(+), 10 deletions(-)
>>
>> diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
>> index 1bc8cd8..01745bc 100644
>> --- a/fs/ext3/ialloc.c
>> +++ b/fs/ext3/ialloc.c
>> @@ -574,8 +574,10 @@ got:
>>  	ei->i_frag_no = 0;
>>  	ei->i_frag_size = 0;
>>  #endif
>> +#ifdef CONFIG_EXT3_FS_POSIX_ACL
>>  	ei->i_file_acl = 0;
>>  	ei->i_dir_acl = 0;
>> +#endif
>
> For regular file, i_dir_acl is being reused as i_size_high to support
> large file.

Only the i_dir_acl of struct ext3_inode, not the one from ext3_inode_info.

Thanks,

Indan



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

end of thread, other threads:[~2008-01-18 23:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-12 20:35 [PATCH] Shrink ext3_inode_info by 8 bytes for !POSIX_ACL Indan Zupancic
2008-01-18 19:16 ` Mingming Cao
2008-01-18 23:51   ` Indan Zupancic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).