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>
This commit is contained in:
parent
353eb83c14
commit
8aefcd557d
7 changed files with 74 additions and 25 deletions
|
|
@ -94,7 +94,7 @@ extern void jbd2_free(void *ptr, size_t size);
|
|||
*
|
||||
* This is an opaque datatype.
|
||||
**/
|
||||
typedef struct handle_s handle_t; /* Atomic operation type */
|
||||
typedef struct jbd2_journal_handle handle_t; /* Atomic operation type */
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -416,7 +416,7 @@ struct jbd2_revoke_table_s;
|
|||
* in so it can be fixed later.
|
||||
*/
|
||||
|
||||
struct handle_s
|
||||
struct jbd2_journal_handle
|
||||
{
|
||||
/* Which compound transaction is this update a part of? */
|
||||
transaction_t *h_transaction;
|
||||
|
|
@ -1158,6 +1158,22 @@ static inline void jbd2_free_handle(handle_t *handle)
|
|||
kmem_cache_free(jbd2_handle_cache, handle);
|
||||
}
|
||||
|
||||
/*
|
||||
* jbd2_inode management (optional, for those file systems that want to use
|
||||
* dynamically allocated jbd2_inode structures)
|
||||
*/
|
||||
extern struct kmem_cache *jbd2_inode_cache;
|
||||
|
||||
static inline struct jbd2_inode *jbd2_alloc_inode(gfp_t gfp_flags)
|
||||
{
|
||||
return kmem_cache_alloc(jbd2_inode_cache, gfp_flags);
|
||||
}
|
||||
|
||||
static inline void jbd2_free_inode(struct jbd2_inode *jinode)
|
||||
{
|
||||
kmem_cache_free(jbd2_inode_cache, jinode);
|
||||
}
|
||||
|
||||
/* Primary revoke support */
|
||||
#define JOURNAL_REVOKE_DEFAULT_HASH 256
|
||||
extern int jbd2_journal_init_revoke(journal_t *, int);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue