]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - fs/nilfs2/dat.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[mv-sheeva.git] / fs / nilfs2 / dat.c
index 239a422349998c6f610683f0398353cbce8b58de..187dd07ba86c659b465daa6b988cf2b80cc9ce02 100644 (file)
 #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)
 {
@@ -426,6 +436,16 @@ ssize_t nilfs_dat_get_vinfo(struct inode *dat, void *buf, unsigned visz,
        return nvi;
 }
 
+/**
+ * nilfs_dat_read - read dat inode
+ * @dat: dat inode
+ * @raw_inode: on-disk dat inode
+ */
+int nilfs_dat_read(struct inode *dat, struct nilfs_inode *raw_inode)
+{
+       return nilfs_read_inode_common(dat, raw_inode);
+}
+
 /**
  * nilfs_dat_new - create dat file
  * @nilfs: nilfs object
@@ -435,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;
 }