summaryrefslogtreecommitdiff
path: root/fs/nilfs2/dat.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-11-14 16:35:01 +0900
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-11-20 10:05:50 +0900
commit8908b2f70b795299d21706b5a97676cfe7f9056a (patch)
tree527071b03f3dfb541a6306c59e601dce5c99fabd /fs/nilfs2/dat.c
parentdb38d5ad323362bfca118b52fe5906f97a69fb45 (diff)
downloadlinux-3.10-8908b2f70b795299d21706b5a97676cfe7f9056a.tar.gz
linux-3.10-8908b2f70b795299d21706b5a97676cfe7f9056a.tar.bz2
linux-3.10-8908b2f70b795299d21706b5a97676cfe7f9056a.zip
nilfs2: add palloc cache to dat
This adds the palloc cache to DAT file. The palloc cache is allocated on the extended region of nilfs_mdt_info struct. The struct nilfs_dat_info defines the extended on memory structure of DAT. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/dat.c')
-rw-r--r--fs/nilfs2/dat.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/fs/nilfs2/dat.c b/fs/nilfs2/dat.c
index eff3169ba10..187dd07ba86 100644
--- a/fs/nilfs2/dat.c
+++ b/fs/nilfs2/dat.c
@@ -33,6 +33,16 @@
#define NILFS_CNO_MIN ((__u64)1)
#define NILFS_CNO_MAX (~(__u64)0)
+struct nilfs_dat_info {
+ struct nilfs_mdt_info mi;
+ struct nilfs_palloc_cache palloc_cache;
+};
+
+static inline struct nilfs_dat_info *NILFS_DAT_I(struct inode *dat)
+{
+ return (struct nilfs_dat_info *)NILFS_MDT(dat);
+}
+
static int nilfs_dat_prepare_entry(struct inode *dat,
struct nilfs_palloc_req *req, int create)
{
@@ -445,16 +455,20 @@ struct inode *nilfs_dat_new(struct the_nilfs *nilfs, size_t entry_size)
{
static struct lock_class_key dat_lock_key;
struct inode *dat;
+ struct nilfs_dat_info *di;
int err;
- dat = nilfs_mdt_new(nilfs, NULL, NILFS_DAT_INO, 0);
+ dat = nilfs_mdt_new(nilfs, NULL, NILFS_DAT_INO, sizeof(*di));
if (dat) {
err = nilfs_palloc_init_blockgroup(dat, entry_size);
if (unlikely(err)) {
nilfs_mdt_destroy(dat);
return NULL;
}
- lockdep_set_class(&NILFS_MDT(dat)->mi_sem, &dat_lock_key);
+
+ di = NILFS_DAT_I(dat);
+ lockdep_set_class(&di->mi.mi_sem, &dat_lock_key);
+ nilfs_palloc_setup_cache(dat, &di->palloc_cache);
}
return dat;
}