mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
nilfs2: add palloc cache to ifile
This adds the palloc cache to ifile. The palloc cache is allocated on the extended region of nilfs_mdt_info struct. The struct nilfs_ifile_info defines the extended on memory structure of ifile. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
This commit is contained in:
parent
c3ea56c800
commit
49fa7a5902
1 changed files with 15 additions and 1 deletions
|
@ -29,6 +29,17 @@
|
||||||
#include "alloc.h"
|
#include "alloc.h"
|
||||||
#include "ifile.h"
|
#include "ifile.h"
|
||||||
|
|
||||||
|
|
||||||
|
struct nilfs_ifile_info {
|
||||||
|
struct nilfs_mdt_info mi;
|
||||||
|
struct nilfs_palloc_cache palloc_cache;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline struct nilfs_ifile_info *NILFS_IFILE_I(struct inode *ifile)
|
||||||
|
{
|
||||||
|
return (struct nilfs_ifile_info *)NILFS_MDT(ifile);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nilfs_ifile_create_inode - create a new disk inode
|
* nilfs_ifile_create_inode - create a new disk inode
|
||||||
* @ifile: ifile inode
|
* @ifile: ifile inode
|
||||||
|
@ -159,13 +170,16 @@ struct inode *nilfs_ifile_new(struct nilfs_sb_info *sbi, size_t inode_size)
|
||||||
struct inode *ifile;
|
struct inode *ifile;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
ifile = nilfs_mdt_new(sbi->s_nilfs, sbi->s_super, NILFS_IFILE_INO, 0);
|
ifile = nilfs_mdt_new(sbi->s_nilfs, sbi->s_super, NILFS_IFILE_INO,
|
||||||
|
sizeof(struct nilfs_ifile_info));
|
||||||
if (ifile) {
|
if (ifile) {
|
||||||
err = nilfs_palloc_init_blockgroup(ifile, inode_size);
|
err = nilfs_palloc_init_blockgroup(ifile, inode_size);
|
||||||
if (unlikely(err)) {
|
if (unlikely(err)) {
|
||||||
nilfs_mdt_destroy(ifile);
|
nilfs_mdt_destroy(ifile);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
nilfs_palloc_setup_cache(ifile,
|
||||||
|
&NILFS_IFILE_I(ifile)->palloc_cache);
|
||||||
}
|
}
|
||||||
return ifile;
|
return ifile;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue