diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-14 02:35:01 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-19 20:05:50 -0500 |
commit | 8908b2f70b795299d21706b5a97676cfe7f9056a (patch) | |
tree | 527071b03f3dfb541a6306c59e601dce5c99fabd /fs/nilfs2/dat.c | |
parent | db38d5ad323362bfca118b52fe5906f97a69fb45 (diff) |
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.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/fs/nilfs2/dat.c b/fs/nilfs2/dat.c index eff3169ba10f..187dd07ba86c 100644 --- a/fs/nilfs2/dat.c +++ b/fs/nilfs2/dat.c | |||
@@ -33,6 +33,16 @@ | |||
33 | #define NILFS_CNO_MIN ((__u64)1) | 33 | #define NILFS_CNO_MIN ((__u64)1) |
34 | #define NILFS_CNO_MAX (~(__u64)0) | 34 | #define NILFS_CNO_MAX (~(__u64)0) |
35 | 35 | ||
36 | struct nilfs_dat_info { | ||
37 | struct nilfs_mdt_info mi; | ||
38 | struct nilfs_palloc_cache palloc_cache; | ||
39 | }; | ||
40 | |||
41 | static inline struct nilfs_dat_info *NILFS_DAT_I(struct inode *dat) | ||
42 | { | ||
43 | return (struct nilfs_dat_info *)NILFS_MDT(dat); | ||
44 | } | ||
45 | |||
36 | static int nilfs_dat_prepare_entry(struct inode *dat, | 46 | static int nilfs_dat_prepare_entry(struct inode *dat, |
37 | struct nilfs_palloc_req *req, int create) | 47 | struct nilfs_palloc_req *req, int create) |
38 | { | 48 | { |
@@ -445,16 +455,20 @@ struct inode *nilfs_dat_new(struct the_nilfs *nilfs, size_t entry_size) | |||
445 | { | 455 | { |
446 | static struct lock_class_key dat_lock_key; | 456 | static struct lock_class_key dat_lock_key; |
447 | struct inode *dat; | 457 | struct inode *dat; |
458 | struct nilfs_dat_info *di; | ||
448 | int err; | 459 | int err; |
449 | 460 | ||
450 | dat = nilfs_mdt_new(nilfs, NULL, NILFS_DAT_INO, 0); | 461 | dat = nilfs_mdt_new(nilfs, NULL, NILFS_DAT_INO, sizeof(*di)); |
451 | if (dat) { | 462 | if (dat) { |
452 | err = nilfs_palloc_init_blockgroup(dat, entry_size); | 463 | err = nilfs_palloc_init_blockgroup(dat, entry_size); |
453 | if (unlikely(err)) { | 464 | if (unlikely(err)) { |
454 | nilfs_mdt_destroy(dat); | 465 | nilfs_mdt_destroy(dat); |
455 | return NULL; | 466 | return NULL; |
456 | } | 467 | } |
457 | lockdep_set_class(&NILFS_MDT(dat)->mi_sem, &dat_lock_key); | 468 | |
469 | di = NILFS_DAT_I(dat); | ||
470 | lockdep_set_class(&di->mi.mi_sem, &dat_lock_key); | ||
471 | nilfs_palloc_setup_cache(dat, &di->palloc_cache); | ||
458 | } | 472 | } |
459 | return dat; | 473 | return dat; |
460 | } | 474 | } |