diff options
author | Theodore Ts'o <tytso@mit.edu> | 2011-01-10 12:29:43 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-01-10 12:29:43 -0500 |
commit | 8aefcd557d26d0023a36f9ec5afbf55e59f8f26b (patch) | |
tree | e13143306cd64525cddd2cc2513c448275a1d95a /include/linux/jbd2.h | |
parent | 353eb83c1422c6326eaab30ce044a179c6018169 (diff) |
ext4: dynamically allocate the jbd2_inode in ext4_inode_info as necessary
Replace the jbd2_inode structure (which is 48 bytes) with a pointer
and only allocate the jbd2_inode when it is needed --- that is, when
the file system has a journal present and the inode has been opened
for writing. This allows us to further slim down the ext4_inode_info
structure.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'include/linux/jbd2.h')
-rw-r--r-- | include/linux/jbd2.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 2ae86aa21fce..27e79c27ba08 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -94,7 +94,7 @@ extern void jbd2_free(void *ptr, size_t size); | |||
94 | * | 94 | * |
95 | * This is an opaque datatype. | 95 | * This is an opaque datatype. |
96 | **/ | 96 | **/ |
97 | typedef struct handle_s handle_t; /* Atomic operation type */ | 97 | typedef struct jbd2_journal_handle handle_t; /* Atomic operation type */ |
98 | 98 | ||
99 | 99 | ||
100 | /** | 100 | /** |
@@ -416,7 +416,7 @@ struct jbd2_revoke_table_s; | |||
416 | * in so it can be fixed later. | 416 | * in so it can be fixed later. |
417 | */ | 417 | */ |
418 | 418 | ||
419 | struct handle_s | 419 | struct jbd2_journal_handle |
420 | { | 420 | { |
421 | /* Which compound transaction is this update a part of? */ | 421 | /* Which compound transaction is this update a part of? */ |
422 | transaction_t *h_transaction; | 422 | transaction_t *h_transaction; |
@@ -1158,6 +1158,22 @@ static inline void jbd2_free_handle(handle_t *handle) | |||
1158 | kmem_cache_free(jbd2_handle_cache, handle); | 1158 | kmem_cache_free(jbd2_handle_cache, handle); |
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | /* | ||
1162 | * jbd2_inode management (optional, for those file systems that want to use | ||
1163 | * dynamically allocated jbd2_inode structures) | ||
1164 | */ | ||
1165 | extern struct kmem_cache *jbd2_inode_cache; | ||
1166 | |||
1167 | static inline struct jbd2_inode *jbd2_alloc_inode(gfp_t gfp_flags) | ||
1168 | { | ||
1169 | return kmem_cache_alloc(jbd2_inode_cache, gfp_flags); | ||
1170 | } | ||
1171 | |||
1172 | static inline void jbd2_free_inode(struct jbd2_inode *jinode) | ||
1173 | { | ||
1174 | kmem_cache_free(jbd2_inode_cache, jinode); | ||
1175 | } | ||
1176 | |||
1161 | /* Primary revoke support */ | 1177 | /* Primary revoke support */ |
1162 | #define JOURNAL_REVOKE_DEFAULT_HASH 256 | 1178 | #define JOURNAL_REVOKE_DEFAULT_HASH 256 |
1163 | extern int jbd2_journal_init_revoke(journal_t *, int); | 1179 | extern int jbd2_journal_init_revoke(journal_t *, int); |