diff options
author | Theodore Ts'o <tytso@mit.edu> | 2011-01-10 12:18:25 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-01-10 12:18:25 -0500 |
commit | 353eb83c1422c6326eaab30ce044a179c6018169 (patch) | |
tree | fd43e39b344de5ee43d82c90f0affda68a65f2df /fs/ext4/ext4.h | |
parent | 8a2005d3f84457b7d7d8646ab5195341d9e5f06a (diff) |
ext4: drop i_state_flags on architectures with 64-bit longs
We can store the dynamic inode state flags in the high bits of
EXT4_I(inode)->i_flags, and eliminate i_state_flags. This saves 8
bytes from the size of ext4_inode_info structure, which when
multiplied by the number of the number of in the inode cache, can save
a lot of memory.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 50e3d24483fb..2fb531cfd48b 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -764,7 +764,9 @@ struct ext4_inode_info { | |||
764 | */ | 764 | */ |
765 | ext4_group_t i_block_group; | 765 | ext4_group_t i_block_group; |
766 | ext4_lblk_t i_dir_start_lookup; | 766 | ext4_lblk_t i_dir_start_lookup; |
767 | #if (BITS_PER_LONG < 64) | ||
767 | unsigned long i_state_flags; /* Dynamic state flags */ | 768 | unsigned long i_state_flags; /* Dynamic state flags */ |
769 | #endif | ||
768 | unsigned long i_flags; | 770 | unsigned long i_flags; |
769 | 771 | ||
770 | #ifdef CONFIG_EXT4_FS_XATTR | 772 | #ifdef CONFIG_EXT4_FS_XATTR |
@@ -1239,22 +1241,36 @@ enum { | |||
1239 | EXT4_STATE_DELALLOC_RESERVED, /* blks already reserved for delalloc */ | 1241 | EXT4_STATE_DELALLOC_RESERVED, /* blks already reserved for delalloc */ |
1240 | }; | 1242 | }; |
1241 | 1243 | ||
1242 | #define EXT4_INODE_BIT_FNS(name, field) \ | 1244 | #define EXT4_INODE_BIT_FNS(name, field, offset) \ |
1243 | static inline int ext4_test_inode_##name(struct inode *inode, int bit) \ | 1245 | static inline int ext4_test_inode_##name(struct inode *inode, int bit) \ |
1244 | { \ | 1246 | { \ |
1245 | return test_bit(bit, &EXT4_I(inode)->i_##field); \ | 1247 | return test_bit(bit + (offset), &EXT4_I(inode)->i_##field); \ |
1246 | } \ | 1248 | } \ |
1247 | static inline void ext4_set_inode_##name(struct inode *inode, int bit) \ | 1249 | static inline void ext4_set_inode_##name(struct inode *inode, int bit) \ |
1248 | { \ | 1250 | { \ |
1249 | set_bit(bit, &EXT4_I(inode)->i_##field); \ | 1251 | set_bit(bit + (offset), &EXT4_I(inode)->i_##field); \ |
1250 | } \ | 1252 | } \ |
1251 | static inline void ext4_clear_inode_##name(struct inode *inode, int bit) \ | 1253 | static inline void ext4_clear_inode_##name(struct inode *inode, int bit) \ |
1252 | { \ | 1254 | { \ |
1253 | clear_bit(bit, &EXT4_I(inode)->i_##field); \ | 1255 | clear_bit(bit + (offset), &EXT4_I(inode)->i_##field); \ |
1254 | } | 1256 | } |
1255 | 1257 | ||
1256 | EXT4_INODE_BIT_FNS(flag, flags) | 1258 | EXT4_INODE_BIT_FNS(flag, flags, 0) |
1257 | EXT4_INODE_BIT_FNS(state, state_flags) | 1259 | #if (BITS_PER_LONG < 64) |
1260 | EXT4_INODE_BIT_FNS(state, state_flags, 0) | ||
1261 | |||
1262 | static inline void ext4_clear_state_flags(struct ext4_inode_info *ei) | ||
1263 | { | ||
1264 | (ei)->i_state_flags = 0; | ||
1265 | } | ||
1266 | #else | ||
1267 | EXT4_INODE_BIT_FNS(state, flags, 32) | ||
1268 | |||
1269 | static inline void ext4_clear_state_flags(struct ext4_inode_info *ei) | ||
1270 | { | ||
1271 | /* We depend on the fact that callers will set i_flags */ | ||
1272 | } | ||
1273 | #endif | ||
1258 | #else | 1274 | #else |
1259 | /* Assume that user mode programs are passing in an ext4fs superblock, not | 1275 | /* Assume that user mode programs are passing in an ext4fs superblock, not |
1260 | * a kernel struct super_block. This will allow us to call the feature-test | 1276 | * a kernel struct super_block. This will allow us to call the feature-test |