diff options
-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 | } |